[PATCH v2 4/6] vhost-net: vhost-user: update vhost_net_virtqueue_restart()

2022-09-11 Thread Kangjie Xu
Update vhost_net_virtqueue_restart() for vhost-user scenario. In order to reuse some functions, we process the idx for vhost-user case. It is because vhost_get_vq_index behave differently in vhost-user. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 3 +++ 1 file

[PATCH v2 5/6] virtio-net: vhost-user: update queue_reset and queue_enable

2022-09-11 Thread Kangjie Xu
Update virtio_net_queue_reset() and virtio_net_queue_enable() for vhost-user scenario. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/virtio-net.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 6ab796b399

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

2022-09-11 Thread Kangjie Xu
Update vhost_net_virtqueue_reset() for vhost-user scenario. In order to reuse some functions, we process the idx for vhost-user scenario because vhost_get_vq_index behave differently for vhost-user. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 3 +++ 1 file

[PATCH v2 6/6] vhost: vhost-user: enable vq reset feature

2022-09-11 Thread Kangjie Xu
Add virtqueue reset feature for vhost-user. 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 8b80942e7c..ad319faee8 100644 --- a/hw/net/vhost_net.c +++ b/hw/net

[PATCH v2 0/6] Support VIRTIO_F_RING_RESET for vhost-user in virtio pci-modern

2022-09-11 Thread Kangjie Xu
mode, modify Qemu virtio-net to add PACKED feature to test packed mode. Guest Kernel Patch: https://lore.kernel.org/bpf/20220801063902.129329-1-xuanz...@linux.alibaba.com/ DPDK Patch: https://github.com/middaywords/dpdk/compare/72206323a5dd3182b13f61b25a64abdddfee595c...080d9d5a6bba8

[PATCH v2 2/6] vhost-user: add op to enable or disable a single vring

2022-09-11 Thread Kangjie Xu
There is only vhost_set_dev_enable op in VhostOps. Thus, we introduce the interface vhost_set_vring_enable to set the enable status for a single vring. Resetting a single vq will rely on this interface. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost-user.c

[PATCH v2 1/6] net: virtio: rename vhost_set_vring_enable to vhost_set_dev_enable

2022-09-11 Thread Kangjie Xu
Previously, vhost_set_vring_enable will enable/disable all vrings in a device, which causes ambiguity. So we rename it to vhost_set_dev_enable. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- backends/cryptodev-vhost.c| 12 ++-- hw/net/vhost_net-stub.c | 2

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

2022-09-11 Thread Kangjie Xu
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 --- hw/net/virtio-net.c | 21 + 1 file

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

2022-09-11 Thread Kangjie Xu
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/vhost_net.c | 52

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

2022-09-11 Thread 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 --- hw/core/machine.c | 4 +++- include/hw/virtio/virtio.h | 4 +++- 2 files changed, 6 insert

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

2022-09-11 Thread 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 +++-- 1 file

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

2022-09-11 Thread Kangjie Xu
. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- 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..8beecb4d22 100644 --- a/hw/net/vhost_net.c

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

2022-09-11 Thread Kangjie Xu
() 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 --- hw/net/virtio-net.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/hw/net

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

2022-09-11 Thread 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 --- hw/virtio/vhost.c | 8 include/hw/virtio/vhost.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost.c b/hw

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

2022-09-11 Thread Kangjie Xu
From: 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/h

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

2022-09-11 Thread Kangjie Xu
code. 2. Rename 'vhost_net_virtqueue_stop' to 'vhost_net_virtqueue_reset'. 3. Make PCI transport ready before device ready when queue_enabled is set to true. 4. Add some comments. v2: 1. Add support for vhost-net kernel scenario. 2. Add a new vhost-user message VHOST_USER_RESET_V

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

2022-09-11 Thread 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(+) diff --git a

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

2022-09-11 Thread Kangjie Xu
From: 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/vi

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

2022-09-11 Thread Kangjie Xu
. Migration thread also 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 Wan

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

2022-09-11 Thread Kangjie Xu
from here: https://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

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

2022-09-11 Thread 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 --- hw/virtio/vhost.c | 8 include/hw/virtio/vhost.h | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost.c b/hw

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

2022-09-11 Thread 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 1059aa45b4..97cdf9280b 100644 --- a/hw/net/vhost_net.c +++ b/hw/net

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

2022-09-11 Thread Kangjie Xu
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/virtio.c index

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

2022-09-05 Thread Kangjie Xu
在 2022/9/5 16:30, Jason Wang 写道: 在 2022/8/25 16:08, Kangjie Xu 写道: From: Xuan Zhuo virtio-net and vhost-kernel implement queue reset. Queued packets in the corresponding queue pair are flushed or purged. Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu ---   hw/net/virtio-net.c | 18

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

2022-09-05 Thread Kangjie Xu
在 2022/9/5 16:30, Jason Wang 写道: 在 2022/8/25 16:08, Kangjie Xu 写道: From: Xuan Zhuo virtio-net and vhost-kernel implement queue reset. Queued packets in the corresponding queue pair are flushed or purged. Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu ---   hw/net/virtio-net.c | 18

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

2022-09-05 Thread Kangjie Xu
在 2022/9/5 16:03, Jason Wang 写道: 在 2022/8/25 16:08, Kangjie Xu 写道: Introduce vhost_virtqueue_reset(), which can reset the specific virtqueue in the device. Then it will unmap vrings and the desc of the virtqueue. Here we do not reuse the vhost_net_stop_one() or vhost_dev_stop(), because

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

2022-09-05 Thread Kangjie Xu
在 2022/9/5 16:30, Jason Wang 写道: 在 2022/8/25 16:08, Kangjie Xu 写道: From: Xuan Zhuo virtio-net and vhost-kernel implement queue reset. Queued packets in the corresponding queue pair are flushed or purged. Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu ---   hw/net/virtio-net.c | 18

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

2022-09-05 Thread Kangjie Xu
在 2022/9/5 16:24, Jason Wang 写道: 在 2022/8/25 16:08, Kangjie Xu 写道: Introduce vhost_net_virtqueue_restart(), which can restart the specific virtqueue when the vhost net started running before. If it fails to restart the virtqueue, the device will be stopped. Here we do not reuse

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

2022-09-01 Thread Kangjie Xu
Do you have any comments about this patch set? Thanks 在 2022/8/25 16:08, Kangjie Xu 写道: The virtio queue reset function has already been defined in the virtio spec 1.2. The relevant virtio spec information is here: https://github.com/oasis-tcs/virtio-spec/issues/124 https

[PATCH 6/8] vhost-net: vhost-user: update vhost_net_virtqueue_restart()

2022-08-26 Thread Kangjie Xu
Update vhost_net_virtqueue_restart() for vhost-user scenario. In order to reuse some functions, we process the idx for vhost-user case. It is because vhost_get_vq_index behave differently in vhost-user. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 12

[PATCH 4/8] vhost-user: introduce vhost_reset_vring() interface

2022-08-26 Thread Kangjie Xu
Introduce the interface vhost_reset_vring(). The interface is a wrapper to send a VHOST_USER_RESET_VRING message to the back-end. It will reset an individual vring in the back-end. Meanwhile, it will wait for a reply to ensure the reset has been completed. Signed-off-by: Kangjie Xu Signed-off-by

[PATCH 7/8] virtio-net: vhost-user: update queue_reset and queue_enable

2022-08-26 Thread Kangjie Xu
Update virtio_net_queue_reset() and virtio_net_queue_enable() for vhost-user scenario. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/virtio-net.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 6ab796b399

[PATCH 5/8] vhost-net: vhost-user: update vhost_net_virtqueue_reset()

2022-08-26 Thread Kangjie Xu
Update vhost_net_virtqueue_reset() for vhost-user scenario. In order to reuse some functions, we process the idx for vhost-user scenario because vhost_get_vq_index behave differently for vhost-user. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 13

[PATCH 2/8] net: virtio: rename vhost_set_vring_enable to vhost_set_dev_enable

2022-08-26 Thread Kangjie Xu
Previously, vhost_set_vring_enable will enable/disable all vrings in a device, which causes ambiguity. So we rename it to vhost_set_dev_enable. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- backends/cryptodev-vhost.c| 12 ++-- hw/net/vhost_net-stub.c | 2

[PATCH 8/8] vhost: vhost-user: enable vq reset feature

2022-08-26 Thread Kangjie Xu
Add virtqueue reset feature for vhost-user. 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 13b9c11e68..745cb4375b 100644 --- a/hw/net/vhost_net.c +++ b/hw/net

[PATCH 3/8] vhost-user: add op to enable or disable a single vring

2022-08-26 Thread Kangjie Xu
There is only vhost_set_dev_enable op in VhostOps. Thus, we introduce the interface vhost_set_vring_enable to set the enable status for a single vring. Resetting a single vq will rely on this interface. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost-user.c

[PATCH 1/8] docs: vhost-user: add VHOST_USER_RESET_VRING message

2022-08-26 Thread Kangjie Xu
-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- docs/interop/vhost-user.rst | 10 ++ 1 file changed, 10 insertions(+) diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 3f18ab424e..ce7991b9d3 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost

[PATCH 0/8] Support VIRTIO_F_RING_RESET for vhost-user in virtio pci-modern

2022-08-26 Thread Kangjie Xu
/T/#t) 1. rename vhost_set_vring_enable to vhost_set_dev_enable. 2. add vhost-user message VHOST_USER_RESET_VRING 3. remove restart/reset functions of virtqueue in vhost module. Kangjie Xu (8): docs: vhost-user: add VHOST_USER_RESET_VRING message net: virtio: rename vhost_set_vring_enable to vh

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

2022-08-25 Thread 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 0716f6cd96..74c5147d6e 100644 --- a/hw/net/vhost_net.c +++ b/hw/net

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

2022-08-25 Thread Kangjie Xu
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 --- hw/net/virtio-net.c | 21 + 1 file

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

2022-08-25 Thread Kangjie Xu
ser message VHOST_USER_RESET_VRING. 3. Add migration compatibility for virtqueue reset. Kangjie Xu (10): virtio: introduce virtio_queue_enable() virtio: core: vq reset feature negotation support virtio-pci: support queue enable vhost: extract the logic of unmapping the vrings and de

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

2022-08-25 Thread Kangjie Xu
From: 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/vi

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

2022-08-25 Thread Kangjie Xu
From: Xuan Zhuo virtio-net and vhost-kernel implement queue reset. Queued packets in the corresponding queue pair are flushed or purged. Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu --- hw/net/virtio-net.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/hw/net

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

2022-08-25 Thread 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 --- hw/virtio/virtio-pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/virtio-pci.c

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

2022-08-25 Thread Kangjie Xu
A a new command line parameter "queue_reset" is added. Meanwhile, the vq reset feature is disabled for pre-7.1 machines. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/core/machine.c | 1 + include/hw/virtio/virtio.h | 4 +++- 2 files changed, 4 insertions(+),

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

2022-08-25 Thread Kangjie Xu
it may stop the device in the backend. 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/vhost_net.c | 22 ++ include/net/vhost_net.h | 2 ++ 2 files changed

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

2022-08-25 Thread Kangjie Xu
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/virtio.c index

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

2022-08-25 Thread Kangjie Xu
From: 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/h

[PATCH v3 08/15] vhost: extract the logic of unmapping the vrings and desc

2022-08-25 Thread Kangjie Xu
Introduce vhost_virtqueue_unmap() to ummap the vrings and desc of a virtqueue. The function will be re-used when resetting a virtqueue. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/vhost.c | 20 ++-- include/hw/virtio/vhost.h

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

2022-08-25 Thread Kangjie Xu
from here: https://github.com/oasis-tcs/virtio-spec/issues/89 Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu --- 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 v3 12/15] virtio-net: introduce flush_or_purge_queued_packets()

2022-08-25 Thread 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 --- hw/net/virtio-net.c | 17 +++-- 1 file changed, 11

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

2022-08-25 Thread Kangjie Xu
. Migration thread also 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 --- hw/virtio/vi

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

2022-08-25 Thread Kangjie Xu
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/vhost_net.c | 52

[PATCH v3 09/15] vhost: expose vhost_virtqueue_start()

2022-08-25 Thread 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 --- hw/virtio/vhost.c | 8 include/hw/virtio/vhost.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost.c b/hw

Re: [PATCH v2 07/24] virtio-pci: support queue enable

2022-08-24 Thread Kangjie Xu
在 2022/8/25 10:52, Jason Wang 写道: On Wed, Aug 24, 2022 at 7:27 PM Kangjie Xu wrote: 在 2022/8/24 16:59, Jason Wang 写道: 在 2022/8/23 16:20, Kangjie Xu 写道: 在 2022/8/23 15:44, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: PCI devices support vq enable. Nit: it might be "su

Re: [PATCH v2 07/24] virtio-pci: support queue enable

2022-08-24 Thread Kangjie Xu
在 2022/8/24 16:59, Jason Wang 写道: 在 2022/8/23 16:20, Kangjie Xu 写道: 在 2022/8/23 15:44, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: PCI devices support vq enable. Nit: it might be "support device specific vq enable" Get it. Based on this function, the driver can re-

Re: [PATCH v2 15/24] vhost-user: add op to enable or disable a single vring

2022-08-24 Thread Kangjie Xu
在 2022/8/24 17:02, Jason Wang 写道: 在 2022/8/24 11:09, Kangjie Xu 写道: 在 2022/8/24 10:53, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: The interface to set enable status for a single vring is lacked in VhostOps, since the vhost_set_vring_enable_op will manipulate all virtqueues in a

Re: [PATCH v2 18/24] vhost-net: vhost-user: update vhost_net_virtqueue_stop()

2022-08-24 Thread Kangjie Xu
在 2022/8/24 17:04, Jason Wang 写道: 在 2022/8/24 12:57, Kangjie Xu 写道: 在 2022/8/24 12:05, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Update vhost_net_virtqueue_stop() for vhost-user scenario. Let's explain why it is needed now or why it doesn't cause any issue or it'

Re: [PATCH v2 12/24] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart()

2022-08-24 Thread Kangjie Xu
在 2022/8/24 17:01, Jason Wang 写道: 在 2022/8/24 10:53, Kangjie Xu 写道: 在 2022/8/24 10:44, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Introduce vhost_net_virtqueue_restart(), which can restart the virtqueue when the vhost net started running before. If it fails to restart the virtqueue

Re: [PATCH v2 17/24] vhost: vhost-user: update vhost_dev_virtqueue_restart()

2022-08-23 Thread Kangjie Xu
在 2022/8/24 12:03, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Update vhost_dev_virtqueue_restart() for vhost-user scenario. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo ---   hw/virtio/vhost.c | 26 ++   1 file changed, 22 insertions(+), 4 deletions

Re: [PATCH v2 16/24] vhost: vhost-user: update vhost_dev_virtqueue_stop()

2022-08-23 Thread Kangjie Xu
在 2022/8/24 11:56, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Update vhost_dev_virtqueue_stop() for vhost-user scenario. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo ---   hw/virtio/vhost.c | 19 +++   1 file changed, 19 insertions(+) diff --git a/hw/virtio

Re: [PATCH v2 18/24] vhost-net: vhost-user: update vhost_net_virtqueue_stop()

2022-08-23 Thread Kangjie Xu
在 2022/8/24 12:05, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Update vhost_net_virtqueue_stop() for vhost-user scenario. Let's explain why it is needed now or why it doesn't cause any issue or it's a bug fix or not. Thanks This patch is to suppport vq reset for

Re: [PATCH v2 11/24] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_stop()

2022-08-23 Thread Kangjie Xu
在 2022/8/24 10:40, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Introduce vhost_virtqueue_stop(), which can reset the virtqueue in the device. Then it will unmap vrings and the desc of the virtqueue. This patch only considers the case for vhost-kernel, when NetClientDriver is

Re: [PATCH v2 15/24] vhost-user: add op to enable or disable a single vring

2022-08-23 Thread Kangjie Xu
在 2022/8/24 10:53, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: The interface to set enable status for a single vring is lacked in VhostOps, since the vhost_set_vring_enable_op will manipulate all virtqueues in a device. Resetting a single vq will rely on this interface. Signed-off-by

Re: [PATCH v2 14/24] vhost-user: introduce vhost_reset_vring() interface

2022-08-23 Thread Kangjie Xu
在 2022/8/24 10:50, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Introduce the interface vhost_reset_vring(). The interface is a wrapper to send a VHOST_USER_RESET_VRING message to the back-end. It will reset an individual vring in the back-end. Meanwhile, it will wait for a reply to

Re: [PATCH v2 12/24] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart()

2022-08-23 Thread Kangjie Xu
在 2022/8/24 10:44, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Introduce vhost_net_virtqueue_restart(), which can restart the virtqueue when the vhost net started running before. If it fails to restart the virtqueue, the device will be stopped. This patch only considers the case for

Re: [PATCH v2 11/24] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_stop()

2022-08-23 Thread Kangjie Xu
在 2022/8/24 10:40, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Introduce vhost_virtqueue_stop(), which can reset the virtqueue in the device. Then it will unmap vrings and the desc of the virtqueue. This patch only considers the case for vhost-kernel, when NetClientDriver is

Re: [PATCH v2 10/24] vhost: introduce vhost_dev_virtqueue_restart()

2022-08-23 Thread Kangjie Xu
在 2022/8/24 10:37, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Introduce vhost_dev_virtqueue_restart(), which can restart the virtqueue when the vhost has already started running. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo ---   hw/virtio/vhost.c | 13

Re: [PATCH v2 07/24] virtio-pci: support queue enable

2022-08-23 Thread Kangjie Xu
在 2022/8/23 15:44, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: PCI devices support vq enable. Nit: it might be "support device specific vq enable" Get it. Based on this function, the driver can re-enable the virtqueue after the virtqueue is reset. Signed-off-by:

Re: [PATCH v2 09/24] vhost: introduce vhost_dev_virtqueue_stop()

2022-08-23 Thread Kangjie Xu
在 2022/8/23 15:52, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: Introduce vhost_dev_virtqueue_stop(), which can ummap the vrings and the desc of it. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo ---   hw/virtio/vhost.c | 9 +   include/hw/virtio/vhost.h | 3 +++   2

Re: [PATCH v2 06/24] virtio-pci: support queue reset

2022-08-23 Thread Kangjie Xu
在 2022/8/23 15:40, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: From: Xuan Zhuo PCI devices support vq reset. Based on this function, the driver can adjust the size of the ring, and quickly recycle the buffer in the ring. The migration of the virtio devices will not happen during a

Re: [PATCH v2 05/24] virtio: core: vq reset feature negotation support

2022-08-23 Thread Kangjie Xu
在 2022/8/23 15:34, Jason Wang 写道: 在 2022/8/16 09:06, Kangjie Xu 写道: A a new command line parameter "queue_reset" is added. Meanwhile, the vq reset feature is disabled for pre-7.1 machines. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo ---   hw/core/machine.c  | 1 +

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

2022-08-22 Thread Kangjie Xu
patch set, thanks. :) Best regards, Kangjie 在 2022/8/16 09:06, Kangjie Xu 写道: The virtio queue reset function has already been defined in the virtio spec 1.2. The relevant virtio spec information is here: https://github.com/oasis-tcs/virtio-spec/issues/124 https://github.com/oasis

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

2022-08-16 Thread Kangjie Xu
在 2022/8/16 14:22, Michael S. Tsirkin 写道: 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, Kangjie Xu wrote: The virtio queue reset function has already been defi

[PATCH v2 19/24] vhost-net: vhost-user: update vhost_net_virtqueue_restart()

2022-08-15 Thread Kangjie Xu
Update vhost_net_virtqueue_restart() for vhost-user scenario. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index c0d408f3b4..778081e54a 100644 --- a/hw/net/vhost_net.c

[PATCH v2 20/24] virtio-net: introduce flush_or_purge_queued_packets()

2022-08-15 Thread 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 --- hw/net/virtio-net.c | 17 +++-- 1 file changed, 11

[PATCH v2 24/24] vhost: vhost-user: enable vq reset feature

2022-08-15 Thread Kangjie Xu
Add virtqueue reset feature for vhost-user. 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 9ea160e4e9..5bc89f2842 100644 --- a/hw/net/vhost_net.c +++ b/hw/net

[PATCH v2 18/24] vhost-net: vhost-user: update vhost_net_virtqueue_stop()

2022-08-15 Thread Kangjie Xu
Update vhost_net_virtqueue_stop() for vhost-user scenario. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 2ab67e875e..c0d408f3b4 100644 --- a/hw/net/vhost_net.c

[PATCH v2 21/24] virtio-net: support queue reset

2022-08-15 Thread Kangjie Xu
From: Xuan Zhuo virtio-net, vhost-kernel, vhost-user implement queue reset. Queued packets in the corresponding queue pair are flushed or purged. Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu --- hw/net/virtio-net.c | 19 +++ 1 file changed, 19 insertions(+) diff --git

[PATCH v2 16/24] vhost: vhost-user: update vhost_dev_virtqueue_stop()

2022-08-15 Thread Kangjie Xu
Update vhost_dev_virtqueue_stop() for vhost-user scenario. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index fc3f550c76..a0d6824353 100644 --- a/hw/virtio

[PATCH v2 22/24] virtio-net: support queue_enable

2022-08-15 Thread Kangjie Xu
vhost is not started 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-user and vhost-kernel. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo

[PATCH v2 14/24] vhost-user: introduce vhost_reset_vring() interface

2022-08-15 Thread Kangjie Xu
Introduce the interface vhost_reset_vring(). The interface is a wrapper to send a VHOST_USER_RESET_VRING message to the back-end. It will reset an individual vring in the back-end. Meanwhile, it will wait for a reply to ensure the reset has been completed. Signed-off-by: Kangjie Xu Signed-off-by

[PATCH v2 15/24] vhost-user: add op to enable or disable a single vring

2022-08-15 Thread Kangjie Xu
The interface to set enable status for a single vring is lacked in VhostOps, since the vhost_set_vring_enable_op will manipulate all virtqueues in a device. Resetting a single vq will rely on this interface. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost-user.c

[PATCH v2 11/24] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_stop()

2022-08-15 Thread Kangjie Xu
Introduce vhost_virtqueue_stop(), which can reset the virtqueue in the device. Then it will unmap vrings and the desc of the virtqueue. This patch only considers the case for vhost-kernel, when NetClientDriver is NET_CLIENT_DRIVER_TAP. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw

[PATCH v2 17/24] vhost: vhost-user: update vhost_dev_virtqueue_restart()

2022-08-15 Thread Kangjie Xu
Update vhost_dev_virtqueue_restart() for vhost-user scenario. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost.c | 26 ++ 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index a0d6824353

[PATCH v2 12/24] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart()

2022-08-15 Thread Kangjie Xu
: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 48 + include/net/vhost_net.h | 2 ++ 2 files changed, 50 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index aa60dd901c..2ab67e875e 100644 --- a/hw/net/vhost_net.c

[PATCH v2 10/24] vhost: introduce vhost_dev_virtqueue_restart()

2022-08-15 Thread Kangjie Xu
Introduce vhost_dev_virtqueue_restart(), which can restart the virtqueue when the vhost has already started running. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost.c | 13 + include/hw/virtio/vhost.h | 2 ++ 2 files changed, 15 insertions(+) diff

[PATCH v2 09/24] vhost: introduce vhost_dev_virtqueue_stop()

2022-08-15 Thread Kangjie Xu
Introduce vhost_dev_virtqueue_stop(), which can ummap the vrings and the desc of it. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost.c | 9 + include/hw/virtio/vhost.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio

[PATCH v2 02/24] virtio: introduce __virtio_queue_reset()

2022-08-15 Thread Kangjie Xu
From: Xuan Zhuo Separate the logic of vq reset. This logic will be called directly later. Signed-off-by: Xuan Zhuo --- hw/virtio/virtio.c | 37 + 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 5d

[PATCH v2 05/24] virtio: core: vq reset feature negotation support

2022-08-15 Thread Kangjie Xu
A a new command line parameter "queue_reset" is added. Meanwhile, the vq reset feature is disabled for pre-7.1 machines. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/core/machine.c | 1 + include/hw/virtio/virtio.h | 4 +++- 2 files changed, 4 insertions(+),

[PATCH v2 08/24] vhost: extract the logic of unmapping the vrings and desc

2022-08-15 Thread Kangjie Xu
Introduce vhost_virtqueue_unmap() to ummap the vrings and desc of a virtqueue. The function will be used later. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/hw/virtio/vhost.c

[PATCH v2 01/24] virtio: sync relevant definitions with linux

2022-08-15 Thread Kangjie Xu
from here: https://github.com/oasis-tcs/virtio-spec/issues/89 Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu --- 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 v2 23/24] vhost: vhost-kernel: enable vq reset feature

2022-08-15 Thread 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 778081e54a..9ea160e4e9 100644 --- a/hw/net/vhost_net.c +++ b/hw/net

[PATCH v2 06/24] virtio-pci: support queue reset

2022-08-15 Thread Kangjie Xu
. Migration thread also needs the lock. As a result, we do not need to migrate the reset state of VirtIOPCIQueue. Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu --- hw/virtio/virtio-pci.c | 19 +++ include/hw/virtio/virtio-pci.h | 1 + 2 files changed, 20 insertions(+) diff

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

2022-08-15 Thread Kangjie Xu
rds/linux/commit/19a91e0d7167b2031e46078c6215c213b89cb2c3 Looking forward to your review and comments. Thanks. Kangjie Xu (19): virtio: introduce virtio_queue_enable() virtio: core: vq reset feature negotation support virtio-pci: support queue enable vhost: extract the l

[PATCH v2 03/24] virtio: introduce virtio_queue_reset()

2022-08-15 Thread Kangjie Xu
From: 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 --- hw/virtio/virtio.c | 11 +++ include/hw/virtio/virtio.h | 2

[PATCH v2 13/24] docs: vhost-user: add VHOST_USER_RESET_VRING message

2022-08-15 Thread Kangjie Xu
-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- docs/interop/vhost-user.rst | 10 ++ 1 file changed, 10 insertions(+) diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 3f18ab424e..ce7991b9d3 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost

[PATCH v2 04/24] virtio: introduce virtio_queue_enable()

2022-08-15 Thread Kangjie Xu
start the virtqueue when DRIVER_OK. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- 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/virtio.c index 0e9d41366f..141f18c633 100644

[PATCH v2 07/24] virtio-pci: support queue enable

2022-08-15 Thread Kangjie Xu
PCI devices support 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 --- hw/virtio/virtio-pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio

Re: [PATCH 08/16] vhost: add op to enable or disable a single vring

2022-07-28 Thread Kangjie Xu
在 2022/7/28 10:41, Jason Wang 写道: On Wed, Jul 27, 2022 at 3:05 PM Kangjie Xu wrote: 在 2022/7/27 12:55, Jason Wang 写道: On Tue, Jul 26, 2022 at 2:39 PM Kangjie Xu wrote: 在 2022/7/26 11:49, Jason Wang 写道: 在 2022/7/18 19:17, Kangjie Xu 写道: The interface to set enable status for a single

  1   2   >