mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-07 03:04:49 +00:00
DM: fix virtio_net tx_thread block issue
If guest doesn't initialize the net device, the tx thread will block at the first tx_cond wait. When virtio_net_tx_stop is invoked, the tx_thread will block on second tx_cond then. Check whether we should exit tx_thread after first tx_cond waiting Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Reviewed-by: Hao Li <hao.l.li@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
7f530772e6
commit
5def53d8e4
@ -714,6 +714,11 @@ virtio_net_tx_thread(void *param)
|
|||||||
pthread_mutex_lock(&net->tx_mtx);
|
pthread_mutex_lock(&net->tx_mtx);
|
||||||
error = pthread_cond_wait(&net->tx_cond, &net->tx_mtx);
|
error = pthread_cond_wait(&net->tx_cond, &net->tx_mtx);
|
||||||
assert(error == 0);
|
assert(error == 0);
|
||||||
|
if (net->closing) {
|
||||||
|
WPRINTF(("vtnet tx thread closing...\n"));
|
||||||
|
pthread_mutex_unlock(&net->tx_mtx);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* note - tx mutex is locked here */
|
/* note - tx mutex is locked here */
|
||||||
@ -729,6 +734,7 @@ virtio_net_tx_thread(void *param)
|
|||||||
assert(error == 0);
|
assert(error == 0);
|
||||||
if (net->closing) {
|
if (net->closing) {
|
||||||
WPRINTF(("vtnet tx thread closing...\n"));
|
WPRINTF(("vtnet tx thread closing...\n"));
|
||||||
|
pthread_mutex_unlock(&net->tx_mtx);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user