mbox series

[v2,0/2] virtio: fix for assertion failure: virtio_net_get_subqueue(nc)->async_tx.elem failed

Message ID 20230206032105.35831-1-xuanzhuo@linux.alibaba.com (mailing list archive)
Headers show
Series virtio: fix for assertion failure: virtio_net_get_subqueue(nc)->async_tx.elem failed | expand

Message

Xuan Zhuo Feb. 6, 2023, 3:21 a.m. UTC
In the current design, we stop the device from operating on the vring
during per-queue reset by resetting the structure VirtQueue.

But before the reset operation, when recycling some resources, we should
stop referencing new vring resources.

This bug is caused by this reason.

    https://gitlab.com/qemu-project/qemu/-/issues/1451

Before we reset the structure, we called the ->queue_reset callback to let the
device reclaim resources. Here virtio-net tries to release the packets sent
asynchronously, but during this process virtio_net_flush_tx() will be called,
and new data will be sent again. This leads to asserted.

     assert(!virtio_net_get_subqueue(nc)->async_tx.elem);

v2:
    1. fix by stop flush inside virtio_net_tx_complete() when purge packets.

v1:
    1. rename "reset" to disabled_by_reset
    2. add api: virtio_queue_reset_state()

Xuan Zhuo (2):
  virtio_net: virtio_net_tx_complete() stop flush new packets for purge
    operation
  virtio_net: just purge tx when dev/queue reset

 hw/net/virtio-net.c | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

--
2.32.0.3.g01195cf9f