Re: [PATCH net v4] virtio_net: Do not send RSS key if it is not supported

2024-04-07 Thread Xuan Zhuo
he > vitio is broken at QEMU side. > > Fix it by not sending RSS commands if the feature is not available in > the device. > > Fixes: c7114b1249fa ("drivers/net/virtio_net: Added basic RSS support.") > Cc: sta...@vger.kernel.org > Cc: qemu-devel@nongnu.org > Sig

Re: [PATCH] virtio_net: Do not send RSS key if it is not supported

2024-03-25 Thread Xuan Zhuo
On Mon, 25 Mar 2024 04:26:08 -0700, Breno Leitao wrote: > Hello Xuan, > > On Mon, Mar 25, 2024 at 01:57:53PM +0800, Xuan Zhuo wrote: > > On Fri, 22 Mar 2024 03:21:21 -0700, Breno Leitao wrote: > > > Hello Xuan, > > > > > > On Fri, Mar 22, 2024 at 10:00:2

Re: [PATCH] virtio_net: Do not send RSS key if it is not supported

2024-03-25 Thread Xuan Zhuo
On Fri, 22 Mar 2024 03:21:21 -0700, Breno Leitao wrote: > Hello Xuan, > > On Fri, Mar 22, 2024 at 10:00:22AM +0800, Xuan Zhuo wrote: > > On Thu, 21 Mar 2024 09:54:30 -0700, Breno Leitao wrote: > > > > 4) Since the command above does not have a key, then the last &g

Re: qemu fuzz crash in virtio_net_queue_reset()

2024-03-21 Thread Xuan Zhuo
On Wed, 20 Mar 2024 00:24:37 +0300, "Vladimir Sementsov-Ogievskiy" wrote: > Hi all! > > From fuzzing I've got a fuzz-data, which produces the following crash: > > qemu-fuzz-x86_64: ../hw/net/virtio-net.c:134: void > flush_or_purge_queued_packets(NetClientState *): Assertion >

Re: [PATCH] virtio_net: Do not send RSS key if it is not supported

2024-03-21 Thread Xuan Zhuo
On Thu, 21 Mar 2024 09:54:30 -0700, Breno Leitao wrote: > There is a bug when setting the RSS options in virtio_net that can break > the whole machine, getting the kernel into an infinite loop. > > Running the following command in any QEMU virtual machine with virtionet > will reproduce this

Re: [PATCH] virtio-net: not enable vq reset feature unconditionally

2023-05-08 Thread Xuan Zhuo
On Mon, 8 May 2023 11:09:46 +0200, Eugenio Perez Martin wrote: > On Sat, May 6, 2023 at 4:25 AM Xuan Zhuo wrote: > > > > On Thu, 4 May 2023 12:14:47 +0200, =?utf-8?q?Eugenio_P=C3=A9rez?= > > wrote: > > > The commit 93a97dc5200a ("virtio-net

Re: [PATCH] virtio-net: not enable vq reset feature unconditionally

2023-05-08 Thread Xuan Zhuo
On Mon, 8 May 2023 14:44:21 +0800, Jason Wang wrote: > On Sun, May 7, 2023 at 2:01 PM Michael S. Tsirkin wrote: > > > > On Sat, May 06, 2023 at 10:13:36AM +0800, Xuan Zhuo wrote: > > > On Thu, 4 May 2023 12:14:47 +0200, =?utf-8?q?Eugenio_P=C3=A9rez?= > >

Re: [PATCH] virtio-net: not enable vq reset feature unconditionally

2023-05-05 Thread Xuan Zhuo
On Thu, 4 May 2023 12:14:47 +0200, =?utf-8?q?Eugenio_P=C3=A9rez?= wrote: > The commit 93a97dc5200a ("virtio-net: enable vq reset feature") enables > unconditionally vq reset feature as long as the device is emulated. > This makes impossible to actually disable the feature, and it causes >

Re: [PATCH v2 07/10] contrib/gitdm: add Alibaba to the domain-map

2023-03-12 Thread Xuan Zhuo
Cc: LIU Zhiwei > Cc: Xuan Zhuo > Cc: Guo Ren Reviewed-by: Xuan Zhuo Thanks. > --- > contrib/gitdm/domain-map| 1 + > contrib/gitdm/group-map-alibaba | 7 +++ > gitdm.config| 1 + > 3 files changed, 9 insertions(+) > create mode 10

[PATCH v2 1/2] virtio_net: virtio_net_tx_complete() stop flush new packets for purge operation

2023-02-05 Thread Xuan Zhuo
For async tx, virtio_net_tx_complete() is called when purge or flush operation is done. But for purge operation, we should not try to flush new packet from tx queue. The purge operation means we will stop the queue soon. Signed-off-by: Xuan Zhuo --- hw/net/virtio-net.c | 32

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

2023-02-05 Thread Xuan Zhuo
ent 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 (

[PATCH v2 2/2] virtio_net: just purge tx when dev/queue reset

2023-02-05 Thread Xuan Zhuo
mu-project/qemu/-/issues/1451 Reported-by: Alexander Bulekov Signed-off-by: Xuan Zhuo --- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 6daa1e5ac1..2ac6d3dad9 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/vi

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-30 Thread Xuan Zhuo
On Mon, 30 Jan 2023 15:49:36 +0800, Jason Wang wrote: > On Mon, Jan 30, 2023 at 1:32 PM Michael S. Tsirkin wrote: > > > > On Mon, Jan 30, 2023 at 10:15:12AM +0800, Xuan Zhuo wrote: > > > On Sun, 29 Jan 2023 07:15:47 -0500, "Michael S. Tsirkin" > > > w

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-30 Thread Xuan Zhuo
On Tue, 31 Jan 2023 11:27:42 +0800, Jason Wang wrote: > On Mon, Jan 30, 2023 at 6:26 PM Xuan Zhuo wrote: > > > > On Mon, 30 Jan 2023 16:40:08 +0800, Jason Wang wrote: > > > On Mon, Jan 30, 2023 at 4:03 PM Xuan Zhuo > > > wrote: > > > > > >

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-30 Thread Xuan Zhuo
On Mon, 30 Jan 2023 16:40:08 +0800, Jason Wang wrote: > On Mon, Jan 30, 2023 at 4:03 PM Xuan Zhuo wrote: > > > > On Mon, 30 Jan 2023 15:49:36 +0800, Jason Wang wrote: > > > On Mon, Jan 30, 2023 at 1:32 PM Michael S. Tsirkin > > > wrote: > > > > >

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-30 Thread Xuan Zhuo
On Mon, 30 Jan 2023 15:49:36 +0800, Jason Wang wrote: > On Mon, Jan 30, 2023 at 1:32 PM Michael S. Tsirkin wrote: > > > > On Mon, Jan 30, 2023 at 10:15:12AM +0800, Xuan Zhuo wrote: > > > On Sun, 29 Jan 2023 07:15:47 -0500, "Michael S. Tsirkin" > > > w

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-29 Thread Xuan Zhuo
On Mon, 30 Jan 2023 11:01:40 +0800, Jason Wang wrote: > On Sun, Jan 29, 2023 at 3:44 PM Xuan Zhuo wrote: > > > > On Sun, 29 Jan 2023 14:23:21 +0800, Jason Wang wrote: > > > On Sun, Jan 29, 2023 at 10:52 AM Xuan Zhuo > > > wrote: > > > > >

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-29 Thread Xuan Zhuo
On Sun, 29 Jan 2023 07:15:47 -0500, "Michael S. Tsirkin" wrote: > On Sun, Jan 29, 2023 at 08:03:42PM +0800, Xuan Zhuo wrote: > > On Sun, 29 Jan 2023 06:57:29 -0500, "Michael S. Tsirkin" > > wrote: > > > On Sun, Jan 29, 2023 at 04:23:08PM +0800, Xua

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-29 Thread Xuan Zhuo
On Sun, 29 Jan 2023 06:57:29 -0500, "Michael S. Tsirkin" wrote: > On Sun, Jan 29, 2023 at 04:23:08PM +0800, Xuan Zhuo wrote: > > On Sun, 29 Jan 2023 03:12:12 -0500, "Michael S. Tsirkin" > > wrote: > > > On Sun, Jan 29, 2023 at 03:28:28PM +0800, Xua

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-29 Thread Xuan Zhuo
On Sun, 29 Jan 2023 07:15:47 -0500, "Michael S. Tsirkin" wrote: > On Sun, Jan 29, 2023 at 08:03:42PM +0800, Xuan Zhuo wrote: > > On Sun, 29 Jan 2023 06:57:29 -0500, "Michael S. Tsirkin" > > wrote: > > > On Sun, Jan 29, 2023 at 04:23:08PM +0800, Xua

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-29 Thread Xuan Zhuo
On Sun, 29 Jan 2023 03:12:12 -0500, "Michael S. Tsirkin" wrote: > On Sun, Jan 29, 2023 at 03:28:28PM +0800, Xuan Zhuo wrote: > > On Sun, 29 Jan 2023 02:25:43 -0500, "Michael S. Tsirkin" > > wrote: > > > On Sun, Jan 29, 2023 at 10:51:50AM +0800, Xuan

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-28 Thread Xuan Zhuo
On Sun, 29 Jan 2023 14:23:21 +0800, Jason Wang wrote: > On Sun, Jan 29, 2023 at 10:52 AM Xuan Zhuo wrote: > > > > Check whether it is per-queue reset state in virtio_net_flush_tx(). > > > > Before per-queue reset, we need to recover async tx resources. At this &g

Re: [PATCH v1 1/2] virtio: struct VirtQueue introduce reset

2023-01-28 Thread Xuan Zhuo
On Sun, 29 Jan 2023 02:37:22 -0500, "Michael S. Tsirkin" wrote: > On Sun, Jan 29, 2023 at 03:15:16PM +0800, Xuan Zhuo wrote: > > On Sun, 29 Jan 2023 02:12:36 -0500, "Michael S. Tsirkin" > > wrote: > > > > > > subject seems wrong. > >

Re: [PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-28 Thread Xuan Zhuo
On Sun, 29 Jan 2023 02:25:43 -0500, "Michael S. Tsirkin" wrote: > On Sun, Jan 29, 2023 at 10:51:50AM +0800, Xuan Zhuo wrote: > > Check whether it is per-queue reset state in virtio_net_flush_tx(). > > > > Before per-queue reset, we need to recover async

Re: [PATCH v1 1/2] virtio: struct VirtQueue introduce reset

2023-01-28 Thread Xuan Zhuo
On Sun, 29 Jan 2023 02:12:36 -0500, "Michael S. Tsirkin" wrote: > > subject seems wrong. Will fix. > > On Sun, Jan 29, 2023 at 10:51:49AM +0800, Xuan Zhuo wrote: > > In the current design, we stop the device from operating on the vring > > during per-queu

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

2023-01-28 Thread Xuan Zhuo
ed_by_reset 2. add api: virtio_queue_reset_state() Xuan Zhuo (2): virtio: struct VirtQueue introduce reset virtio-net: virtio_net_flush_tx() check for per-queue reset hw/net/virtio-net.c| 3 ++- hw/virtio/virtio.c | 15 +++ include/hw/virtio/virtio.h | 1 + 3 files changed, 18

[PATCH v1 1/2] virtio: struct VirtQueue introduce reset

2023-01-28 Thread Xuan Zhuo
sending resources, virtio-net should be able to perceive that the current queue is in the per-queue reset state, and stop sending new packets from the tx queue. Signed-off-by: Xuan Zhuo --- hw/virtio/virtio.c | 15 +++ include/hw/virtio/virtio.h | 1 + 2 files changed, 16

[PATCH v1 2/2] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-28 Thread Xuan Zhuo
. Fixes: 7dc6be52 ("virtio-net: support queue reset") Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1451 Reported-by: Alexander Bulekov Signed-off-by: Xuan Zhuo --- hw/net/virtio-net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/

Re: [PATCH 2/3] virtio: struct VirtQueue introduce reset

2023-01-28 Thread Xuan Zhuo
On Sat, 28 Jan 2023 05:22:05 -0500, "Michael S. Tsirkin" wrote: > On Sat, Jan 28, 2023 at 03:17:23PM +0800, Xuan Zhuo wrote: > > In the current design, we stop the device from operating on the vring > > during per-queue reset by resetting the structure VirtQueue. >

Re: [PATCH 1/3] virtio: move struct VirtQueue to include file

2023-01-28 Thread Xuan Zhuo
On Sat, 28 Jan 2023 05:23:46 -0500, "Michael S. Tsirkin" wrote: > On Sat, Jan 28, 2023 at 03:17:22PM +0800, Xuan Zhuo wrote: > > This patch move struct VirtQueue into virtio.h. > > > > In order to implement Queue Reset, we have to record the queue reset &g

[PATCH 1/3] virtio: move struct VirtQueue to include file

2023-01-27 Thread Xuan Zhuo
This patch move struct VirtQueue into virtio.h. In order to implement Queue Reset, we have to record the queue reset status of in struct VirtQueue and provide it to device. Signed-off-by: Xuan Zhuo --- hw/virtio/virtio.c | 49 --- include/hw/virtio

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

2023-01-27 Thread Xuan Zhuo
ent again. This leads to asserted. assert(!virtio_net_get_subqueue(nc)->async_tx.elem); 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

[PATCH 3/3] virtio-net: virtio_net_flush_tx() check for per-queue reset

2023-01-27 Thread Xuan Zhuo
. Fixes: 7dc6be52 ("virtio-net: support queue reset") Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1451 Reported-by: Alexander Bulekov Signed-off-by: Xuan Zhuo --- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/vi

[PATCH 2/3] virtio: struct VirtQueue introduce reset

2023-01-27 Thread Xuan Zhuo
asynchronous sending resources, virtio-net should be able to perceive that the current queue is in the per-queue reset state, and stop sending new packets from the tx queue. Signed-off-by: Xuan Zhuo --- hw/virtio/virtio.c | 8 include/hw/virtio/virtio.h | 3 +++ 2 files changed, 11

[PATCH v1] virtio-net: fix for heap-buffer-overflow

2022-11-10 Thread Xuan Zhuo
VIRTIO_QUEUE_MAX but greater or equal than cvq index could hit this. Other devices are similar. Signed-off-by: Xuan Zhuo --- hw/net/virtio-net.c| 18 -- include/hw/virtio/virtio.h | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/

Re: [PATCH] virtio-net: fix for heap-buffer-overflow

2022-11-10 Thread Xuan Zhuo
On Thu, 10 Nov 2022 17:18:23 +0800, Jason Wang wrote: > On Thu, Nov 10, 2022 at 4:28 PM Xuan Zhuo wrote: > > > > Run shell script: > > > > cat << EOF | valgrind qemu-system-i386 -display none -machine > > accel=qtest, -m \ > > 512M -M q

[PATCH] virtio-net: fix for heap-buffer-overflow

2022-11-10 Thread Xuan Zhuo
tps://gitlab.com/qemu-project/qemu/-/issues/1309 Here, the queue_index is the index of the cvq, but cvq does not have the corresponding NetClientState, so overflow appears. I add a check here, ignore illegal queue_index and cvq queue_index. Signed-off-by: Xuan Zhuo --- hw/net/v

Re: QEMU | Heap-overflow in virtio_net_queue_enable (#1309)

2022-11-09 Thread Xuan Zhuo
On Thu, 10 Nov 2022 13:18:54 +0800, Jason Wang wrote: > On Thu, Nov 10, 2022 at 1:12 PM Michael S. Tsirkin wrote: > > > > Xuan Zhuo pls take a look ASAP. > > > > On Thu, Nov 10, 2022 at 03:04:41AM +, Alexander Bulekov (@a1xndr) wrote: > > Alexande

Re: QEMU | Heap-overflow in virtio_net_queue_enable (#1309)

2022-11-09 Thread Xuan Zhuo
On Thu, 10 Nov 2022 00:11:00 -0500, "Michael S. Tsirkin" wrote: > Xuan Zhuo pls take a look ASAP. > > On Thu, Nov 10, 2022 at 03:04:41AM +, Alexander Bulekov (@a1xndr) wrote: > Alexander Bulekov created an issue: #1309 > > Hello, > > I bisected this

Re: [PATCH] virtio: remove the excess virtio features check

2022-11-09 Thread Xuan Zhuo
On Wed, 9 Nov 2022 09:46:18 -0500, "Michael S. Tsirkin" wrote: > On Wed, Nov 09, 2022 at 07:10:21PM +0800, Xuan Zhuo wrote: > > In virtio_queue_enable(), we checked virtio feature VIRTIO_F_VERSION_1. > > > > This check is not necessary, and conflict with Se

[PATCH] virtio: remove the excess virtio features check

2022-11-09 Thread Xuan Zhuo
In virtio_queue_enable(), we checked virtio feature VIRTIO_F_VERSION_1. This check is not necessary, and conflict with SeaBIOS. The problem appeared in SeaBIOS. But we also remove this check. Link: https://www.mail-archive.com/qemu-devel@nongnu.org/msg920538.html Signed-off-by: Xuan Zhuo

Re: [PULL v4 29/83] virtio: introduce virtio_queue_enable()

2022-11-08 Thread Xuan Zhuo
On Wed, 9 Nov 2022 02:04:17 -0500, "Michael S. Tsirkin" wrote: > On Wed, Nov 09, 2022 at 02:56:01PM +0800, Xuan Zhuo wrote: > > On Wed, 9 Nov 2022 14:55:03 +0800, Jason Wang wrote: > > > > > > 在 2022/11/9 14:51, Michael S. Tsirkin 写道: > > > > On

Re: [PULL v4 29/83] virtio: introduce virtio_queue_enable()

2022-11-08 Thread Xuan Zhuo
On Wed, 9 Nov 2022 02:01:38 -0500, "Michael S. Tsirkin" wrote: > On Wed, Nov 09, 2022 at 02:48:29PM +0800, Xuan Zhuo wrote: > > On Wed, 9 Nov 2022 01:39:32 -0500, "Michael S. Tsirkin" > > wrote: > > > On Wed, Nov 09, 2022 at 11:31:23AM +0800, Jason

Re: [PULL v4 29/83] virtio: introduce virtio_queue_enable()

2022-11-08 Thread Xuan Zhuo
ON_Q_ENABLE is written and related virtqueue can be > >>>> started. It only supports the devices of virtio 1 or later. The > >>>> not-supported devices can only start the virtqueue when DRIVER_OK. > >>>> > >>>> Signed-off-by: Kangjie Xu >

Re: [PULL v4 29/83] virtio: introduce virtio_queue_enable()

2022-11-08 Thread Xuan Zhuo
LE is written and related virtqueue can be > > > > started. It only supports the devices of virtio 1 or later. The > > > > not-supported devices can only start the virtqueue when DRIVER_OK. > > > > > > > > Signed-off-by: Kangjie Xu > > > >

[PATCH v6 06/15] virtio-pci: support queue enable

2022-10-17 Thread Xuan Zhuo
From: Kangjie Xu PCI devices support device specific vq enable. Based on this function, the driver can re-enable the virtqueue after the virtqueue is reset. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/virtio-pci.c | 1 + 1 file changed, 1 insertion

[PATCH v6 05/15] virtio-pci: support queue reset

2022-10-17 Thread Xuan Zhuo
needs the lock. As a result, when migration of virtio devices starts, the 'reset' status of VirtIOPCIQueue will always be 0. Thus, we do not need to add it in vmstate_virtio_pci_modern_queue_state. Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu Acked-by: Jason Wang --- hw/virtio/virtio-pci.c

[PATCH v6 14/15] vhost: vhost-kernel: enable vq reset feature

2022-10-17 Thread Xuan Zhuo
From: Kangjie Xu Add virtqueue reset feature for vhost-kernel. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/net/vhost_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index d2926e2ed6..53b2fac4f6 100644

[PATCH v6 12/15] virtio-net: support queue reset

2022-10-17 Thread Xuan Zhuo
() and virtio_net_flush_tx() will not receive or send packets. For vhost-net, the datapath will be disabled in vhost_net_virtqueue_reset(). Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu Acked-by: Jason Wang --- hw/net/virtio-net.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/hw/net

[PATCH v6 10/15] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart()

2022-10-17 Thread Xuan Zhuo
at queue pair level. The mem table and features do not change, so we can call the vhost_virtqueue_start() to restart a specific queue. This patch only considers the case of vhost-kernel, when NetClientDriver is NET_CLIENT_DRIVER_TAP. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason

[PATCH v6 09/15] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_reset()

2022-10-17 Thread Xuan Zhuo
his reset virtqueue here. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/net/vhost_net-stub.c | 6 ++ hw/net/vhost_net.c | 25 + include/net/vhost_net.h | 2 ++ 3 files changed, 33 insertions(+) diff --git a/hw/net/vhost_net-stub.c

[PATCH v6 03/15] virtio: introduce virtio_queue_enable()

2022-10-17 Thread Xuan Zhuo
devices can only start the virtqueue when DRIVER_OK. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/virtio.c | 14 ++ include/hw/virtio/virtio.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio

[PATCH v6 00/15] Support VIRTIO_F_RING_RESET for virtio-net, vhost-net kernel in virtio pci-modern

2022-10-17 Thread Xuan Zhuo
_net_virtqueue_reset() vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart() virtio-net: introduce flush_or_purge_queued_packets() virtio-net: support queue_enable vhost: vhost-kernel: enable vq reset feature Xuan Zhuo (5): virtio: introduce __virtio_queue_reset() vir

[PATCH v6 04/15] virtio: core: vq reset feature negotation support

2022-10-17 Thread Xuan Zhuo
From: Kangjie Xu A a new command line parameter "queue_reset" is added. Meanwhile, the vq reset feature is disabled for pre-7.2 machines. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/core/machine.c | 4 +++- include/hw/virtio/virtio.h |

[PATCH v6 02/15] virtio: introduce virtio_queue_reset()

2022-10-17 Thread Xuan Zhuo
Introduce a new interface function virtio_queue_reset() to implement reset for vq. Add a new callback to VirtioDeviceClass for queue reset operation for each child device. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/virtio.c | 11 +++ include/hw/virtio/virtio.h

[PATCH v6 13/15] virtio-net: support queue_enable

2022-10-17 Thread Xuan Zhuo
and all vqs are not initalized until VIRTIO_PCI_COMMON_STATUS is written. Thus, we should use vhost_started to differentiate the two cases: vq reset and device start. Currently it only supports vhost-kernel. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/net/virtio

[PATCH v6 08/15] vhost: expose vhost_virtqueue_stop()

2022-10-17 Thread Xuan Zhuo
From: Kangjie Xu Expose vhost_virtqueue_stop(), we need to use it when resetting a virtqueue. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/vhost.c | 8 include/hw/virtio/vhost.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions

[PATCH v6 11/15] virtio-net: introduce flush_or_purge_queued_packets()

2022-10-17 Thread Xuan Zhuo
From: Kangjie Xu Introduce the fucntion flush_or_purge_queued_packets(), it will be used in device reset and virtqueue reset. Therefore, we extract the common logic as a new function. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/net/virtio-net.c | 17

[PATCH v6 15/15] virtio-net: enable vq reset feature

2022-10-17 Thread Xuan Zhuo
Add virtqueue reset feature for virtio-net Signed-off-by: Xuan Zhuo --- hw/net/virtio-net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index f5adba45d5..975bbc22f9 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -788,6 +788,7

[PATCH v6 07/15] vhost: expose vhost_virtqueue_start()

2022-10-17 Thread Xuan Zhuo
From: Kangjie Xu Expose vhost_virtqueue_start(), we need to use it when restarting a virtqueue. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/vhost.c | 8 include/hw/virtio/vhost.h | 3 +++ 2 files changed, 7 insertions(+), 4

[PATCH v6 01/15] virtio: introduce __virtio_queue_reset()

2022-10-17 Thread Xuan Zhuo
Separate the logic of vq reset. This logic will be called directly later. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/virtio.c | 37 + 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c

Re: [PATCH v2 3/6] vhost-net: vhost-user: update vhost_net_virtqueue_reset()

2022-09-26 Thread Xuan Zhuo
On Thu, 15 Sep 2022 10:12:11 +0800, Jason Wang wrote: > On Wed, Sep 14, 2022 at 2:21 PM Xuan Zhuo wrote: > > > > On Wed, 14 Sep 2022 11:13:29 +0800, Jason Wang wrote: > > > > > > 在 2022/9/12 11:10, Kangjie Xu 写道: > > > > Update vhost_

Re: [PATCH v2 3/6] vhost-net: vhost-user: update vhost_net_virtqueue_reset()

2022-09-15 Thread Xuan Zhuo
On Thu, 15 Sep 2022 10:12:11 +0800, Jason Wang wrote: > On Wed, Sep 14, 2022 at 2:21 PM Xuan Zhuo wrote: > > > > On Wed, 14 Sep 2022 11:13:29 +0800, Jason Wang wrote: > > > > > > 在 2022/9/12 11:10, Kangjie Xu 写道: > > > > Update vhost_

Re: [PATCH v2 3/6] vhost-net: vhost-user: update vhost_net_virtqueue_reset()

2022-09-14 Thread Xuan Zhuo
q_index behave > > differently for vhost-user. > > > > Signed-off-by: Kangjie Xu > > Signed-off-by: Xuan Zhuo > > --- > > hw/net/vhost_net.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net

[PATCH v5 14/15] virtio-net: support queue_enable

2022-09-13 Thread Xuan Zhuo
and all vqs are not initalized until VIRTIO_PCI_COMMON_STATUS is written. Thus, we should use vhost_started to differentiate the two cases: vq reset and device start. Currently it only supports vhost-kernel. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/net/virtio

[PATCH v5 09/15] vhost: expose vhost_virtqueue_stop()

2022-09-13 Thread Xuan Zhuo
From: Kangjie Xu Expose vhost_virtqueue_stop(), we need to use it when resetting a virtqueue. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/vhost.c | 8 include/hw/virtio/vhost.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions

[PATCH v5 00/15] Support VIRTIO_F_RING_RESET for virtio-net, vhost-net kernel in virtio pci-modern

2022-09-13 Thread Xuan Zhuo
ue_enable vhost: vhost-kernel: enable vq reset feature Xuan Zhuo (5): virtio: sync relevant definitions with linux virtio: introduce __virtio_queue_reset() virtio: introduce virtio_queue_reset() virtio-pci: support queue reset virtio-net: support queue reset hw/core/machine.c

[PATCH v5 13/15] virtio-net: support queue reset

2022-09-13 Thread Xuan Zhuo
() and virtio_net_flush_tx() will not receive or send packets. For vhost-net, the datapath will be disabled in vhost_net_virtqueue_reset(). Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu Acked-by: Jason Wang --- hw/net/virtio-net.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/hw/net

[PATCH v5 11/15] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart()

2022-09-13 Thread Xuan Zhuo
at queue pair level. The mem table and features do not change, so we can call the vhost_virtqueue_start() to restart a specific queue. This patch only considers the case of vhost-kernel, when NetClientDriver is NET_CLIENT_DRIVER_TAP. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net

[PATCH v5 07/15] virtio-pci: support queue enable

2022-09-13 Thread Xuan Zhuo
From: Kangjie Xu PCI devices support device specific vq enable. Based on this function, the driver can re-enable the virtqueue after the virtqueue is reset. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/virtio-pci.c | 1 + 1 file changed, 1 insertion

[PATCH v5 01/15] virtio: sync relevant definitions with linux

2022-09-13 Thread Xuan Zhuo
://github.com/oasis-tcs/virtio-spec/issues/89 Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu Acked-by: Jason Wang --- include/standard-headers/linux/virtio_config.h | 5 + include/standard-headers/linux/virtio_pci.h| 2 ++ 2 files changed, 7 insertions(+) diff --git a/include/standard

[PATCH v5 03/15] virtio: introduce virtio_queue_reset()

2022-09-13 Thread Xuan Zhuo
Introduce a new interface function virtio_queue_reset() to implement reset for vq. Add a new callback to VirtioDeviceClass for queue reset operation for each child device. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/virtio.c | 11 +++ include/hw/virtio/virtio.h

[PATCH v5 06/15] virtio-pci: support queue reset

2022-09-13 Thread Xuan Zhuo
needs the lock. As a result, when migration of virtio devices starts, the 'reset' status of VirtIOPCIQueue will always be 0. Thus, we do not need to add it in vmstate_virtio_pci_modern_queue_state. Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu Acked-by: Jason Wang --- hw/virtio/virtio-pci.c

[PATCH v5 15/15] vhost: vhost-kernel: enable vq reset feature

2022-09-13 Thread Xuan Zhuo
From: Kangjie Xu Add virtqueue reset feature for vhost-kernel. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index d2926e2ed6..53b2fac4f6 100644 --- a/hw/net/vhost_net.c

[PATCH v5 12/15] virtio-net: introduce flush_or_purge_queued_packets()

2022-09-13 Thread Xuan Zhuo
From: Kangjie Xu Introduce the fucntion flush_or_purge_queued_packets(), it will be used in device reset and virtqueue reset. Therefore, we extract the common logic as a new function. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/net/virtio-net.c | 17

[PATCH v5 08/15] vhost: expose vhost_virtqueue_start()

2022-09-13 Thread Xuan Zhuo
From: Kangjie Xu Expose vhost_virtqueue_start(), we need to use it when restarting a virtqueue. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/vhost.c | 8 include/hw/virtio/vhost.h | 3 +++ 2 files changed, 7 insertions(+), 4

[PATCH v5 05/15] virtio: core: vq reset feature negotation support

2022-09-13 Thread Xuan Zhuo
From: Kangjie Xu A a new command line parameter "queue_reset" is added. Meanwhile, the vq reset feature is disabled for pre-7.2 machines. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/core/machine.c | 4 +++- include/hw/virtio/virtio.h |

[PATCH v5 10/15] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_reset()

2022-09-13 Thread Xuan Zhuo
his reset virtqueue here. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/net/vhost_net.c | 25 + include/net/vhost_net.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index d28f8b974b..8

[PATCH v5 04/15] virtio: introduce virtio_queue_enable()

2022-09-13 Thread Xuan Zhuo
devices can only start the virtqueue when DRIVER_OK. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/virtio.c | 14 ++ include/hw/virtio/virtio.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio

[PATCH v5 02/15] virtio: introduce __virtio_queue_reset()

2022-09-13 Thread Xuan Zhuo
Separate the logic of vq reset. This logic will be called directly later. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/virtio.c | 37 + 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c

Re: [PATCH 00/24] Support VIRTIO_F_RING_RESET for virtio-net, vhost-user, vhost-kernel in virtio pci-modern

2022-08-16 Thread Xuan Zhuo
On Tue, 16 Aug 2022 02:22:16 -0400, "Michael S. Tsirkin" wrote: > On Tue, Aug 16, 2022 at 02:15:57PM +0800, Xuan Zhuo wrote: > > On Tue, 16 Aug 2022 02:14:10 -0400, "Michael S. Tsirkin" > > wrote: > > > On Tue, Aug 16, 2022 at 09:06:12AM +0800, Kang

Re: [PATCH 00/24] Support VIRTIO_F_RING_RESET for virtio-net, vhost-user, vhost-kernel in virtio pci-modern

2022-08-16 Thread Xuan Zhuo
eue enable > > vhost: extract the logic of unmapping the vrings and desc > > vhost: introduce vhost_dev_virtqueue_stop() > > vhost: introduce vhost_dev_virtqueue_restart() > > vhost-net: vhost-kernel: introduce vhost_net_virtqueue_stop() > > vhost-net: vhost-