linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vhost-net: support VIRTIO_F_RING_RESET
@ 2022-08-25  8:56 Kangjie Xu
  2022-09-05  8:32 ` Jason Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Kangjie Xu @ 2022-08-25  8:56 UTC (permalink / raw)
  To: virtualization
  Cc: mst, jasowang, kvm, netdev, bpf, linux-kernel, hengqi, xuanzhuo

Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
queue individually.

VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
information is in
    oasis-tcs/virtio-spec#124
    oasis-tcs/virtio-spec#139

The implementation only adds the feature bit in supported features. It
does not require any other changes because we reuse the existing vhost
protocol.

The virtqueue reset process can be concluded as two parts:
1. The driver can reset a virtqueue. When it is triggered, we use the
set_backend to disable the virtqueue.
2. After the virtqueue is disabled, the driver may optionally re-enable
it. The process is basically similar to when the device is started,
except that the restart process does not need to set features and set
mem table since they do not change. QEMU will send messages containing
size, base, addr, kickfd and callfd of the virtqueue in order.
Specifically, the host kernel will receive these messages in order:
    a. VHOST_SET_VRING_NUM
    b. VHOST_SET_VRING_BASE
    c. VHOST_SET_VRING_ADDR
    d. VHOST_SET_VRING_KICK
    e. VHOST_SET_VRING_CALL
    f. VHOST_NET_SET_BACKEND
Finally, after we use set_backend to attach the virtqueue, the virtqueue
will be enabled and start to work.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---

Test environment and method:
    Host: 5.19.0-rc3
    Qemu: QEMU emulator version 7.0.50 (With vq rset support)
    Guest: 5.19.0-rc3 (With vq reset support)
    Test Cmd: ethtool -g eth1; ethtool -G eth1 rx $1 tx $2; ethtool -g eth1;

    The drvier can resize the virtio queue, then virtio queue reset function should
    be triggered.

    The default is split mode, modify Qemu virtio-net to add PACKED feature to 
    test packed mode.

Guest Kernel Patch:
    https://lore.kernel.org/bpf/20220801063902.129329-1-xuanzhuo@linux.alibaba.com/

QEMU Patch:
    https://lore.kernel.org/qemu-devel/cover.1661414345.git.kangjie.xu@linux.alibaba.com/

Looking forward to your review and comments. Thanks.

 drivers/vhost/net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 68e4ecd1cc0e..8a34928d4fef 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -73,7 +73,8 @@ enum {
 	VHOST_NET_FEATURES = VHOST_FEATURES |
 			 (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
 			 (1ULL << VIRTIO_NET_F_MRG_RXBUF) |
-			 (1ULL << VIRTIO_F_ACCESS_PLATFORM)
+			 (1ULL << VIRTIO_F_ACCESS_PLATFORM) |
+			 (1ULL << VIRTIO_F_RING_RESET)
 };
 
 enum {
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] vhost-net: support VIRTIO_F_RING_RESET
  2022-08-25  8:56 [PATCH] vhost-net: support VIRTIO_F_RING_RESET Kangjie Xu
@ 2022-09-05  8:32 ` Jason Wang
  2023-01-30  7:39   ` Xuan Zhuo
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Wang @ 2022-09-05  8:32 UTC (permalink / raw)
  To: Kangjie Xu, virtualization
  Cc: mst, kvm, netdev, bpf, linux-kernel, hengqi, xuanzhuo


在 2022/8/25 16:56, Kangjie Xu 写道:
> Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
> queue individually.
>
> VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
> information is in
>      oasis-tcs/virtio-spec#124
>      oasis-tcs/virtio-spec#139
>
> The implementation only adds the feature bit in supported features. It
> does not require any other changes because we reuse the existing vhost
> protocol.
>
> The virtqueue reset process can be concluded as two parts:
> 1. The driver can reset a virtqueue. When it is triggered, we use the
> set_backend to disable the virtqueue.
> 2. After the virtqueue is disabled, the driver may optionally re-enable
> it. The process is basically similar to when the device is started,
> except that the restart process does not need to set features and set
> mem table since they do not change. QEMU will send messages containing
> size, base, addr, kickfd and callfd of the virtqueue in order.
> Specifically, the host kernel will receive these messages in order:
>      a. VHOST_SET_VRING_NUM
>      b. VHOST_SET_VRING_BASE
>      c. VHOST_SET_VRING_ADDR
>      d. VHOST_SET_VRING_KICK
>      e. VHOST_SET_VRING_CALL
>      f. VHOST_NET_SET_BACKEND
> Finally, after we use set_backend to attach the virtqueue, the virtqueue
> will be enabled and start to work.
>
> Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
> Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>


Acked-by: Jason Wang <jasowang@redhat.com>


> ---
>
> Test environment and method:
>      Host: 5.19.0-rc3
>      Qemu: QEMU emulator version 7.0.50 (With vq rset support)
>      Guest: 5.19.0-rc3 (With vq reset support)
>      Test Cmd: ethtool -g eth1; ethtool -G eth1 rx $1 tx $2; ethtool -g eth1;
>
>      The drvier can resize the virtio queue, then virtio queue reset function should
>      be triggered.
>
>      The default is split mode, modify Qemu virtio-net to add PACKED feature to
>      test packed mode.
>
> Guest Kernel Patch:
>      https://lore.kernel.org/bpf/20220801063902.129329-1-xuanzhuo@linux.alibaba.com/
>
> QEMU Patch:
>      https://lore.kernel.org/qemu-devel/cover.1661414345.git.kangjie.xu@linux.alibaba.com/
>
> Looking forward to your review and comments. Thanks.
>
>   drivers/vhost/net.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 68e4ecd1cc0e..8a34928d4fef 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -73,7 +73,8 @@ enum {
>   	VHOST_NET_FEATURES = VHOST_FEATURES |
>   			 (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
>   			 (1ULL << VIRTIO_NET_F_MRG_RXBUF) |
> -			 (1ULL << VIRTIO_F_ACCESS_PLATFORM)
> +			 (1ULL << VIRTIO_F_ACCESS_PLATFORM) |
> +			 (1ULL << VIRTIO_F_RING_RESET)
>   };
>   
>   enum {


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vhost-net: support VIRTIO_F_RING_RESET
  2022-09-05  8:32 ` Jason Wang
@ 2023-01-30  7:39   ` Xuan Zhuo
  2023-01-30 10:29     ` Michael S. Tsirkin
  0 siblings, 1 reply; 4+ messages in thread
From: Xuan Zhuo @ 2023-01-30  7:39 UTC (permalink / raw)
  To: Jason Wang
  Cc: mst, kvm, netdev, bpf, linux-kernel, hengqi, Kangjie Xu, virtualization

On Mon, 5 Sep 2022 16:32:19 +0800, Jason Wang <jasowang@redhat.com> wrote:
>
> 在 2022/8/25 16:56, Kangjie Xu 写道:
> > Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
> > queue individually.
> >
> > VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
> > information is in
> >      oasis-tcs/virtio-spec#124
> >      oasis-tcs/virtio-spec#139
> >
> > The implementation only adds the feature bit in supported features. It
> > does not require any other changes because we reuse the existing vhost
> > protocol.
> >
> > The virtqueue reset process can be concluded as two parts:
> > 1. The driver can reset a virtqueue. When it is triggered, we use the
> > set_backend to disable the virtqueue.
> > 2. After the virtqueue is disabled, the driver may optionally re-enable
> > it. The process is basically similar to when the device is started,
> > except that the restart process does not need to set features and set
> > mem table since they do not change. QEMU will send messages containing
> > size, base, addr, kickfd and callfd of the virtqueue in order.
> > Specifically, the host kernel will receive these messages in order:
> >      a. VHOST_SET_VRING_NUM
> >      b. VHOST_SET_VRING_BASE
> >      c. VHOST_SET_VRING_ADDR
> >      d. VHOST_SET_VRING_KICK
> >      e. VHOST_SET_VRING_CALL
> >      f. VHOST_NET_SET_BACKEND
> > Finally, after we use set_backend to attach the virtqueue, the virtqueue
> > will be enabled and start to work.
> >
> > Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
> > Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
>
>
> Acked-by: Jason Wang <jasowang@redhat.com>

@mst

Do we miss this?

Thanks.

>
>
> > ---
> >
> > Test environment and method:
> >      Host: 5.19.0-rc3
> >      Qemu: QEMU emulator version 7.0.50 (With vq rset support)
> >      Guest: 5.19.0-rc3 (With vq reset support)
> >      Test Cmd: ethtool -g eth1; ethtool -G eth1 rx $1 tx $2; ethtool -g eth1;
> >
> >      The drvier can resize the virtio queue, then virtio queue reset function should
> >      be triggered.
> >
> >      The default is split mode, modify Qemu virtio-net to add PACKED feature to
> >      test packed mode.
> >
> > Guest Kernel Patch:
> >      https://lore.kernel.org/bpf/20220801063902.129329-1-xuanzhuo@linux.alibaba.com/
> >
> > QEMU Patch:
> >      https://lore.kernel.org/qemu-devel/cover.1661414345.git.kangjie.xu@linux.alibaba.com/
> >
> > Looking forward to your review and comments. Thanks.
> >
> >   drivers/vhost/net.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > index 68e4ecd1cc0e..8a34928d4fef 100644
> > --- a/drivers/vhost/net.c
> > +++ b/drivers/vhost/net.c
> > @@ -73,7 +73,8 @@ enum {
> >   	VHOST_NET_FEATURES = VHOST_FEATURES |
> >   			 (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
> >   			 (1ULL << VIRTIO_NET_F_MRG_RXBUF) |
> > -			 (1ULL << VIRTIO_F_ACCESS_PLATFORM)
> > +			 (1ULL << VIRTIO_F_ACCESS_PLATFORM) |
> > +			 (1ULL << VIRTIO_F_RING_RESET)
> >   };
> >
> >   enum {
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vhost-net: support VIRTIO_F_RING_RESET
  2023-01-30  7:39   ` Xuan Zhuo
@ 2023-01-30 10:29     ` Michael S. Tsirkin
  0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2023-01-30 10:29 UTC (permalink / raw)
  To: Xuan Zhuo
  Cc: Jason Wang, kvm, netdev, bpf, linux-kernel, hengqi, Kangjie Xu,
	virtualization

On Mon, Jan 30, 2023 at 03:39:06PM +0800, Xuan Zhuo wrote:
> On Mon, 5 Sep 2022 16:32:19 +0800, Jason Wang <jasowang@redhat.com> wrote:
> >
> > 在 2022/8/25 16:56, Kangjie Xu 写道:
> > > Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
> > > queue individually.
> > >
> > > VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
> > > information is in
> > >      oasis-tcs/virtio-spec#124
> > >      oasis-tcs/virtio-spec#139
> > >
> > > The implementation only adds the feature bit in supported features. It
> > > does not require any other changes because we reuse the existing vhost
> > > protocol.
> > >
> > > The virtqueue reset process can be concluded as two parts:
> > > 1. The driver can reset a virtqueue. When it is triggered, we use the
> > > set_backend to disable the virtqueue.
> > > 2. After the virtqueue is disabled, the driver may optionally re-enable
> > > it. The process is basically similar to when the device is started,
> > > except that the restart process does not need to set features and set
> > > mem table since they do not change. QEMU will send messages containing
> > > size, base, addr, kickfd and callfd of the virtqueue in order.
> > > Specifically, the host kernel will receive these messages in order:
> > >      a. VHOST_SET_VRING_NUM
> > >      b. VHOST_SET_VRING_BASE
> > >      c. VHOST_SET_VRING_ADDR
> > >      d. VHOST_SET_VRING_KICK
> > >      e. VHOST_SET_VRING_CALL
> > >      f. VHOST_NET_SET_BACKEND
> > > Finally, after we use set_backend to attach the virtqueue, the virtqueue
> > > will be enabled and start to work.
> > >
> > > Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
> > > Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> >
> >
> > Acked-by: Jason Wang <jasowang@redhat.com>
> 
> @mst
> 
> Do we miss this?
> 
> Thanks.

I did, thanks! tagged now.

> >
> >
> > > ---
> > >
> > > Test environment and method:
> > >      Host: 5.19.0-rc3
> > >      Qemu: QEMU emulator version 7.0.50 (With vq rset support)
> > >      Guest: 5.19.0-rc3 (With vq reset support)
> > >      Test Cmd: ethtool -g eth1; ethtool -G eth1 rx $1 tx $2; ethtool -g eth1;
> > >
> > >      The drvier can resize the virtio queue, then virtio queue reset function should
> > >      be triggered.
> > >
> > >      The default is split mode, modify Qemu virtio-net to add PACKED feature to
> > >      test packed mode.
> > >
> > > Guest Kernel Patch:
> > >      https://lore.kernel.org/bpf/20220801063902.129329-1-xuanzhuo@linux.alibaba.com/
> > >
> > > QEMU Patch:
> > >      https://lore.kernel.org/qemu-devel/cover.1661414345.git.kangjie.xu@linux.alibaba.com/
> > >
> > > Looking forward to your review and comments. Thanks.
> > >
> > >   drivers/vhost/net.c | 3 ++-
> > >   1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > > index 68e4ecd1cc0e..8a34928d4fef 100644
> > > --- a/drivers/vhost/net.c
> > > +++ b/drivers/vhost/net.c
> > > @@ -73,7 +73,8 @@ enum {
> > >   	VHOST_NET_FEATURES = VHOST_FEATURES |
> > >   			 (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
> > >   			 (1ULL << VIRTIO_NET_F_MRG_RXBUF) |
> > > -			 (1ULL << VIRTIO_F_ACCESS_PLATFORM)
> > > +			 (1ULL << VIRTIO_F_ACCESS_PLATFORM) |
> > > +			 (1ULL << VIRTIO_F_RING_RESET)
> > >   };
> > >
> > >   enum {
> >


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-30 10:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25  8:56 [PATCH] vhost-net: support VIRTIO_F_RING_RESET Kangjie Xu
2022-09-05  8:32 ` Jason Wang
2023-01-30  7:39   ` Xuan Zhuo
2023-01-30 10:29     ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).