[PATCH V4 03/10] vhost-vdpa: prepare for the multiqueue support

Jason Wang posted 10 patches 4 years, 4 months ago
Maintainers: Jason Wang <jasowang@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
There is a newer version of this series
[PATCH V4 03/10] vhost-vdpa: prepare for the multiqueue support
Posted by Jason Wang 4 years, 4 months ago
Unlike vhost-kernel, vhost-vdpa adapts a single device multiqueue
model. So we need to simply use virtqueue index as the vhost virtqueue
index. This is a must for multiqueue to work for vhost-vdpa.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20210907090322.1756-4-jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/vhost-vdpa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index edac4017da..8587d30918 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -504,8 +504,8 @@ static int vhost_vdpa_get_vq_index(struct vhost_dev *dev, int idx)
 {
     assert(idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs);
 
-    trace_vhost_vdpa_get_vq_index(dev, idx, idx - dev->vq_index);
-    return idx - dev->vq_index;
+    trace_vhost_vdpa_get_vq_index(dev, idx, idx);
+    return idx;
 }
 
 static int vhost_vdpa_set_vring_ready(struct vhost_dev *dev)
-- 
2.25.1


Re: [PATCH V4 03/10] vhost-vdpa: prepare for the multiqueue support
Posted by Stefano Garzarella 4 years, 3 months ago
On Mon, Oct 11, 2021 at 12:28:22PM +0800, Jason Wang wrote:
>Unlike vhost-kernel, vhost-vdpa adapts a single device multiqueue
>model. So we need to simply use virtqueue index as the vhost virtqueue
>index. This is a must for multiqueue to work for vhost-vdpa.
>
>Signed-off-by: Jason Wang <jasowang@redhat.com>
>Message-Id: <20210907090322.1756-4-jasowang@redhat.com>
>Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>---
> hw/virtio/vhost-vdpa.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
>index edac4017da..8587d30918 100644
>--- a/hw/virtio/vhost-vdpa.c
>+++ b/hw/virtio/vhost-vdpa.c
>@@ -504,8 +504,8 @@ static int vhost_vdpa_get_vq_index(struct vhost_dev *dev, int idx)
> {
>     assert(idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs);

Should we also change this assert?

Thanks,
Stefano

>
>-    trace_vhost_vdpa_get_vq_index(dev, idx, idx - dev->vq_index);
>-    return idx - dev->vq_index;
>+    trace_vhost_vdpa_get_vq_index(dev, idx, idx);
>+    return idx;
> }
>
> static int vhost_vdpa_set_vring_ready(struct vhost_dev *dev)
>-- 
>2.25.1
>
>


Re: [PATCH V4 03/10] vhost-vdpa: prepare for the multiqueue support
Posted by Jason Wang 4 years, 3 months ago
On Mon, Oct 18, 2021 at 11:44 PM Stefano Garzarella <sgarzare@redhat.com> wrote:
>
> On Mon, Oct 11, 2021 at 12:28:22PM +0800, Jason Wang wrote:
> >Unlike vhost-kernel, vhost-vdpa adapts a single device multiqueue
> >model. So we need to simply use virtqueue index as the vhost virtqueue
> >index. This is a must for multiqueue to work for vhost-vdpa.
> >
> >Signed-off-by: Jason Wang <jasowang@redhat.com>
> >Message-Id: <20210907090322.1756-4-jasowang@redhat.com>
> >Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> >Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> >---
> > hw/virtio/vhost-vdpa.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> >index edac4017da..8587d30918 100644
> >--- a/hw/virtio/vhost-vdpa.c
> >+++ b/hw/virtio/vhost-vdpa.c
> >@@ -504,8 +504,8 @@ static int vhost_vdpa_get_vq_index(struct vhost_dev *dev, int idx)
> > {
> >     assert(idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs);
>
> Should we also change this assert?

I think this assert applies to multi-queue as well.

Thanks

>
> Thanks,
> Stefano
>
> >
> >-    trace_vhost_vdpa_get_vq_index(dev, idx, idx - dev->vq_index);
> >-    return idx - dev->vq_index;
> >+    trace_vhost_vdpa_get_vq_index(dev, idx, idx);
> >+    return idx;
> > }
> >
> > static int vhost_vdpa_set_vring_ready(struct vhost_dev *dev)
> >--
> >2.25.1
> >
> >
>