Skip to contentSkip to conversation

vhost: don't set vring call fd to -1 in vhost_virtqueue_start for vhost-user

PATCH In review ZhiPeng Lu 2 participants 5 messages Aug 21, 2017 – Aug 22, 2017

lore
Share & tools
lore

ZhiPeng Lu

author
#0 lore raw

PATCH 1/1 vhost: don't set vring call fd to -1 in vhost_virtqueue_start for vhost-user

commit 96a3d98d2cdbd897ff5ab33427aa4cfb94077665 (vhost: don't set vring call if no vector) set vring call fd to -1 for drivers does not use interrupt at all(e.g virtio-net pmd). That patch setting vring call fd to -1 cause the network to not work when running dpdk in the guest. The openvswitch port status is down by executing the command "ovs-vsctl list interface" in host of running the guest. The network is ok if it doesn't set vring call fd to -1 in vhost_virtqueue_start.
The patch doesn't set vring call fd to -1 for vhost-user.

---
 hw/virtio/vhost.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/virtio/vhost.c +2 -1
index 6eddb09..bb8db7d 100644
@@ -1098,7 +1098,8 @@ static int vhost_virtqueue_start(struct vhost_dev *dev,
 
     if (k->query_guest_notifiers &&
         k->query_guest_notifiers(qbus->parent) &&
-        virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) {
+        virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR &&
+        vdev->use_guest_notifier_mask) {
         file.fd = -1;
         r = dev->vhost_ops->vhost_set_vring_call(dev, &file);
         if (r) {
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 19 lines · ZhiPeng Lu

commit 96a3d98d2cdbd897ff5ab33427aa4cfb94077665 (vhost: don't set vring call if no vector) set vring call fd to -1 for drivers does not use interrupt at all(e.g virtio-net pmd). That patch setting vring call fd to -1 cause the network to not work when running dpdk in the guest. The openvswitch port status is down by executing the command "ovs-vsctl list interface" in host of running the guest. The network is ok if it doesn't set vring call fd to -1 in vhost_virtqueue_start.
The patch doesn't set vring call fd to -1 for vhost-user.

---
  hw/virtio/vhost.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
hw/virtio/vhost.c +0 -0
index 6eddb09..bb8db7d 100644

hw/virtio/vhost.c static int vhost_virtqueue_start(struct vhost_dev *dev, · line 1105

Quoted 9 lines
hw/virtio/vhost.c +2 -1
@@ -1098,7 +1098,8 @@ static int vhost_virtqueue_start(struct vhost_dev *dev,
 
      if (k->query_guest_notifiers &&
          k->query_guest_notifiers(qbus->parent) &&
-        virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) {
+        virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR &&
+        vdev->use_guest_notifier_mask) {
          file.fd = -1;
          r = dev->vhost_ops->vhost_set_vring_call(dev, &file);
          if (r) {

Hi:

Which kind/version of vhost-user bakcend did you use? What happen if we don't do vhost_set_vring_call for it? Is this a bug of vhost-user backend instead of qemu?

Thanks

#2 lore raw

[Qemu-devel] 答复: Re: [PATCH] vhost: don't set vring call fd to -1 invhost_virtqueue_start for vhost-user

Quoted 1 line

On 2017年08月21日 09:50, ZhiPeng Lu wrote:>> commit 96a3d98d2cdbd897ff5ab33427aa4cfb94077665 (vhost: don't set vring call>> if no vector) set vring call fd to -1 for drivers does not use interrupt>> at all(e.g virtio-net pmd). That patch setting vring call fd to -1 cause>> the network to not work when running dpdk in the guest. The openvswitch port>> status is down by executing the command "ovs-vsctl list interface">> in host of running the guest. The network is ok if it doesn't set vring call fd>> to -1 in vhost_virtqueue_start.>> The patch doesn't set vring call fd to -1 for vhost-user.>>>> Signed-off-by: ZhiPeng Lu <[email protected]>>> --->> hw/virtio/vhost.c | 3 ++->> 1 file changed, 2 insertions(+), 1 deletion(-)>>>> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c>> index 6eddb09..bb8db7d 100644>> --- a/hw/virtio/vhost.c>> +++ b/hw/virtio/vhost.c>> @@ -1098,7 +1098,8 @@ static int vhost_virtqueue_start(struct vhost_dev *dev,>> >> if (k->query_guest_notifiers &&>> k->query_guest_notifiers(qbus->parent) &&>> - virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) {>> + virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR &&>> + vdev->use_guest_notifier_mask) {>> file.fd = -1>> r = dev->vhost_ops->vhost_set_vring_call(dev, &file)>> if (r) {>Hi:>Which kind/version of vhost-user bakcend did you use? What happen if we >don't do vhost_set_vring_call for it? Is this a bug of vhost-user >backend instead of qemu?---- I use qemu-2.8.1 ,but i think that the latest version of QEMU also has problems like this.

if (!vdev->use_guest_notifier_mask) {

        /* TODO: check and handle errors. */

        vhost_virtqueue_mask(dev, vdev, idx, false) 

        ---------- set right  callfd 

    }




    if (k->query_guest_notifiers &&

        k->query_guest_notifiers(qbus->parent) &&

        virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) {

        file.fd = -1

        r = dev->vhost_ops->vhost_set_vring_call(dev, &file)

-----------set call fd to -1

        if (r) {

            goto fail_vector

        }

    }

So the callfd of ovs+dpdk in host is -1. it can't be able to interact with the guest.

为了让您的VPlat虚拟机故障和docker故障得到高效的处理,请上报故障到: $VPlat技术支持。

芦志朋 luzhipeng

IT开发工程师 IT Development
Engineer
操作系统产品部/中心研究院/系统产品 OS Product Dept./Central R&D Institute/System Product

四川省成都市天府大道中段800号
E: [email protected]
www.zte.com.cn

原始邮件

发件人: <[email protected]>
收件人:芦志朋10108272 <[email protected]>
抄送人: <[email protected]>
日 期 :2017年08月21日 11:11
主 题 :Re: [Qemu-devel] [PATCH] vhost: don't set vring call fd to -1 invhost_virtqueue_start for vhost-user

Quoted 19 lines · ZhiPeng Lu

commit 96a3d98d2cdbd897ff5ab33427aa4cfb94077665 (vhost: don't set vring call if no vector) set vring call fd to -1 for drivers does not use interrupt at all(e.g virtio-net pmd). That patch setting vring call fd to -1 cause the network to not work when running dpdk in the guest. The openvswitch port status is down by executing the command "ovs-vsctl list interface" in host of running the guest. The network is ok if it doesn't set vring call fd to -1 in vhost_virtqueue_start.
The patch doesn't set vring call fd to -1 for vhost-user.

---
  hw/virtio/vhost.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
hw/virtio/vhost.c +0 -0
index 6eddb09..bb8db7d 100644

hw/virtio/vhost.c static int vhost_virtqueue_start(struct vhost_dev *dev, · line 1105

Quoted 9 lines
hw/virtio/vhost.c +2 -1
@@ -1098,7 +1098,8 @@ static int vhost_virtqueue_start(struct vhost_dev *dev,
 
      if (k->query_guest_notifiers &&
          k->query_guest_notifiers(qbus->parent) &&
-        virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) {
+        virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR &&
+        vdev->use_guest_notifier_mask) {
          file.fd = -1
          r = dev->vhost_ops->vhost_set_vring_call(dev, &file)
          if (r) {

Hi:

Which kind/version of vhost-user bakcend did you use? What happen if we don't do vhost_set_vring_call for it? Is this a bug of vhost-user backend instead of qemu?

Thanks

#3 lore raw

Re: [Qemu-devel] 答复: Re: [PATCH] vhost: don't set vring call fd to -1 invhost_virtqueue_start for vhost-user

Quoted 33 lines · On 2017年08月21日 11:28, [email protected] wrote:
  if (!vdev->use_guest_notifier_mask) {
         /* TODO: check and handle errors. */

         vhost_virtqueue_mask(dev, vdev, idx, false)

         ---------- set right  callfd

     }




     if (k->query_guest_notifiers &&

         k->query_guest_notifiers(qbus->parent) &&

         virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) {

         file.fd = -1

         r = dev->vhost_ops->vhost_set_vring_call(dev, &file)

-----------set call fd to -1

         if (r) {

             goto fail_vector

         }

     }
Quoted 3 lines

So the callfd of ovs+dpdk in host is -1. it can't be able to interact with the guest.

The queue does not even an vector, so it won't generate any interrupt. Why callfd is still needed?

Thanks

#4 lore raw

[Qemu-devel] 答复: Re: 答复: Re: [PATCH] vhost: don't set vring call fd to -1 invhost_virtqueue_start for vhost-user

Quoted 4 lines · On 2017年08月21日 11:28, [email protected] wrote:
Quoted 3 lines

if (!vdev->use_guest_notifier_mask) {>>> > /* TODO: check and handle errors. */>>> < vhost_virtqueue_mask(dev, vdev, idx, false)>> ---------- set right callfd>> }>>>>> if (k->query_guest_notifiers &&>> k->query_guest_notifiers(qbus->parent) &&>> virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) {>> file.fd = -1>> r = dev->vhost_ops->vhost_set_vring_call(dev, &file)>> -----------set call fd to -1>> if (r) {>> goto fail_vector>> }>> }>>> So the callfd of ovs+dpdk in host is -1. it can't be able to interact with the guest.>>>>>The queue does not even an vector, so it won't generate any interrupt. >Why callfd is still needed?

----it's a bug of my vhost-user backend. Thanks.

为了让您的VPlat虚拟机故障和docker故障得到高效的处理,请上报故障到: $VPlat技术支持。

芦志朋 luzhipeng

IT开发工程师 IT Development
Engineer
操作系统产品部/中心研究院/系统产品 OS Product Dept./Central R&D Institute/System Product

四川省成都市天府大道中段800号
E: [email protected]
www.zte.com.cn

原始邮件

发件人: <[email protected]>
收件人:芦志朋10108272
抄送人: <[email protected]> <[email protected]>
日 期 :2017年08月21日 11:35
主 题 :Re: [Qemu-devel] 答复: Re: [PATCH] vhost: don't set vring call fd to -1 invhost_virtqueue_start for vhost-user

Quoted 33 lines · On 2017年08月21日 11:28, [email protected] wrote:
  if (!vdev->use_guest_notifier_mask) {
         /* TODO: check and handle errors. */

         vhost_virtqueue_mask(dev, vdev, idx, false)

         ---------- set right  callfd

     }




     if (k->query_guest_notifiers &&

         k->query_guest_notifiers(qbus->parent) &&

         virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) {

         file.fd = -1

         r = dev->vhost_ops->vhost_set_vring_call(dev, &file)

-----------set call fd to -1

         if (r) {

             goto fail_vector

         }

     }
Quoted 3 lines

So the callfd of ovs+dpdk in host is -1. it can't be able to interact with the guest.

The queue does not even an vector, so it won't generate any interrupt. Why callfd is still needed?

Thanks