mbox series

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

Message ID 20230128071724.33677-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


Xuan Zhuo Jan. 28, 2023, 7:17 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.


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.


This patch set introduce new item "reset" into struct VirtQueue, then device can
know this virtqueue is per-queue reset state.

Xuan Zhuo (3):
  virtio: move struct VirtQueue to include file
  virtio: struct VirtQueue introduce reset
  virtio-net: virtio_net_flush_tx() check for per-queue reset

 hw/net/virtio-net.c        |  2 +-
 hw/virtio/virtio.c         | 57 ++++++--------------------------------
 include/hw/virtio/virtio.h | 55 ++++++++++++++++++++++++++++++++++--
 3 files changed, 62 insertions(+), 52 deletions(-)