All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] net: set endianness on all backend devices
@ 2016-01-13 19:26 Laurent Vivier
  2016-01-14  8:01 ` Greg Kurz
  2016-01-21  8:42 ` Laurent Vivier
  0 siblings, 2 replies; 7+ messages in thread
From: Laurent Vivier @ 2016-01-13 19:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: lvivier, gkurz, mst

commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991
       vhost-net: tell tap backend about the vnet endianness

makes vhost net to set the endianness of the device, but only for
the first device.

In case of multiqueue, we have multiple devices... This patch sets the
endianness for all the devices of the interface.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 hw/net/vhost_net.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 318c3e6..10e233a 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -300,21 +300,19 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
     BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev)));
     VirtioBusState *vbus = VIRTIO_BUS(qbus);
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
-    int r, e, i;
+    int r, e, i, j;
 
     if (!k->set_guest_notifiers) {
         error_report("binding does not support guest notifiers");
-        r = -ENOSYS;
-        goto err;
+        return -ENOSYS;
     }
 
-    r = vhost_net_set_vnet_endian(dev, ncs[0].peer, true);
-    if (r < 0) {
-        goto err;
-    }
-
-    for (i = 0; i < total_queues; i++) {
-        vhost_net_set_vq_index(get_vhost_net(ncs[i].peer), i * 2);
+    for (j = 0; j < total_queues; j++) {
+        r = vhost_net_set_vnet_endian(dev, ncs[j].peer, true);
+        if (r < 0) {
+            goto err_endian;
+        }
+        vhost_net_set_vq_index(get_vhost_net(ncs[j].peer), j * 2);
     }
 
     r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true);
@@ -343,8 +341,9 @@ err_start:
         fflush(stderr);
     }
 err_endian:
-    vhost_net_set_vnet_endian(dev, ncs[0].peer, false);
-err:
+    while (--j >= 0) {
+        vhost_net_set_vnet_endian(dev, ncs[j].peer, false);
+    }
     return r;
 }
 
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH] net: set endianness on all backend devices
  2016-01-13 19:26 [Qemu-devel] [PATCH] net: set endianness on all backend devices Laurent Vivier
@ 2016-01-14  8:01 ` Greg Kurz
  2016-01-14 10:06   ` Cornelia Huck
  2016-01-21  8:42 ` Laurent Vivier
  1 sibling, 1 reply; 7+ messages in thread
From: Greg Kurz @ 2016-01-14  8:01 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-stable, qemu-devel, mst

On Wed, 13 Jan 2016 20:26:25 +0100
Laurent Vivier <lvivier@redhat.com> wrote:

> commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991
>        vhost-net: tell tap backend about the vnet endianness
> 
> makes vhost net to set the endianness of the device, but only for
> the first device.
> 
> In case of multiqueue, we have multiple devices... This patch sets the
> endianness for all the devices of the interface.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---

Thanks for fixing this bug... it's been there since 2.4.0. I guess we
should backport this to 2.4 and 2.5. Cc'ing stable.

Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com>

>  hw/net/vhost_net.c | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 318c3e6..10e233a 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -300,21 +300,19 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
>      BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev)));
>      VirtioBusState *vbus = VIRTIO_BUS(qbus);
>      VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
> -    int r, e, i;
> +    int r, e, i, j;
> 
>      if (!k->set_guest_notifiers) {
>          error_report("binding does not support guest notifiers");
> -        r = -ENOSYS;
> -        goto err;
> +        return -ENOSYS;
>      }
> 
> -    r = vhost_net_set_vnet_endian(dev, ncs[0].peer, true);
> -    if (r < 0) {
> -        goto err;
> -    }
> -
> -    for (i = 0; i < total_queues; i++) {
> -        vhost_net_set_vq_index(get_vhost_net(ncs[i].peer), i * 2);
> +    for (j = 0; j < total_queues; j++) {
> +        r = vhost_net_set_vnet_endian(dev, ncs[j].peer, true);
> +        if (r < 0) {
> +            goto err_endian;
> +        }
> +        vhost_net_set_vq_index(get_vhost_net(ncs[j].peer), j * 2);
>      }
> 
>      r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true);
> @@ -343,8 +341,9 @@ err_start:
>          fflush(stderr);
>      }
>  err_endian:
> -    vhost_net_set_vnet_endian(dev, ncs[0].peer, false);
> -err:
> +    while (--j >= 0) {
> +        vhost_net_set_vnet_endian(dev, ncs[j].peer, false);
> +    }
>      return r;
>  }
> 

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

* Re: [Qemu-devel] [PATCH] net: set endianness on all backend devices
  2016-01-14  8:01 ` Greg Kurz
@ 2016-01-14 10:06   ` Cornelia Huck
  0 siblings, 0 replies; 7+ messages in thread
From: Cornelia Huck @ 2016-01-14 10:06 UTC (permalink / raw)
  To: Greg Kurz; +Cc: Laurent Vivier, mst, qemu-stable, qemu-devel

On Thu, 14 Jan 2016 09:01:49 +0100
Greg Kurz <gkurz@linux.vnet.ibm.com> wrote:

> On Wed, 13 Jan 2016 20:26:25 +0100
> Laurent Vivier <lvivier@redhat.com> wrote:
> 
> > commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991
> >        vhost-net: tell tap backend about the vnet endianness
> > 
> > makes vhost net to set the endianness of the device, but only for
> > the first device.
> > 
> > In case of multiqueue, we have multiple devices... This patch sets the
> > endianness for all the devices of the interface.
> > 
> > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> > ---
> 
> Thanks for fixing this bug... it's been there since 2.4.0. I guess we
> should backport this to 2.4 and 2.5. Cc'ing stable.

Agree on backporting this.

> Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> 
> >  hw/net/vhost_net.c | 23 +++++++++++------------
> >  1 file changed, 11 insertions(+), 12 deletions(-)
> > 
> > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> > index 318c3e6..10e233a 100644
> > --- a/hw/net/vhost_net.c
> > +++ b/hw/net/vhost_net.c
> > @@ -300,21 +300,19 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
> >      BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev)));
> >      VirtioBusState *vbus = VIRTIO_BUS(qbus);
> >      VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
> > -    int r, e, i;
> > +    int r, e, i, j;

Nice alphabet soup ;)

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>

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

* Re: [Qemu-devel] [PATCH] net: set endianness on all backend devices
  2016-01-13 19:26 [Qemu-devel] [PATCH] net: set endianness on all backend devices Laurent Vivier
  2016-01-14  8:01 ` Greg Kurz
@ 2016-01-21  8:42 ` Laurent Vivier
  2016-01-22  6:44   ` Jason Wang
  1 sibling, 1 reply; 7+ messages in thread
From: Laurent Vivier @ 2016-01-21  8:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jason Wang, mst, gkurz

ping

[added Jason in cc:]

On 13/01/2016 20:26, Laurent Vivier wrote:
> commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991
>        vhost-net: tell tap backend about the vnet endianness
> 
> makes vhost net to set the endianness of the device, but only for
> the first device.
> 
> In case of multiqueue, we have multiple devices... This patch sets the
> endianness for all the devices of the interface.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  hw/net/vhost_net.c | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 318c3e6..10e233a 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -300,21 +300,19 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
>      BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev)));
>      VirtioBusState *vbus = VIRTIO_BUS(qbus);
>      VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
> -    int r, e, i;
> +    int r, e, i, j;
>  
>      if (!k->set_guest_notifiers) {
>          error_report("binding does not support guest notifiers");
> -        r = -ENOSYS;
> -        goto err;
> +        return -ENOSYS;
>      }
>  
> -    r = vhost_net_set_vnet_endian(dev, ncs[0].peer, true);
> -    if (r < 0) {
> -        goto err;
> -    }
> -
> -    for (i = 0; i < total_queues; i++) {
> -        vhost_net_set_vq_index(get_vhost_net(ncs[i].peer), i * 2);
> +    for (j = 0; j < total_queues; j++) {
> +        r = vhost_net_set_vnet_endian(dev, ncs[j].peer, true);
> +        if (r < 0) {
> +            goto err_endian;
> +        }
> +        vhost_net_set_vq_index(get_vhost_net(ncs[j].peer), j * 2);
>      }
>  
>      r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true);
> @@ -343,8 +341,9 @@ err_start:
>          fflush(stderr);
>      }
>  err_endian:
> -    vhost_net_set_vnet_endian(dev, ncs[0].peer, false);
> -err:
> +    while (--j >= 0) {
> +        vhost_net_set_vnet_endian(dev, ncs[j].peer, false);
> +    }
>      return r;
>  }
>  
> 

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

* Re: [Qemu-devel] [PATCH] net: set endianness on all backend devices
  2016-01-21  8:42 ` Laurent Vivier
@ 2016-01-22  6:44   ` Jason Wang
  2016-01-26 10:53     ` Laurent Vivier
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Wang @ 2016-01-22  6:44 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel; +Cc: mst, gkurz



On 01/21/2016 04:42 PM, Laurent Vivier wrote:
> ping
>
> [added Jason in cc:]
>
> On 13/01/2016 20:26, Laurent Vivier wrote:
>> commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991
>>        vhost-net: tell tap backend about the vnet endianness
>>
>> makes vhost net to set the endianness of the device, but only for
>> the first device.
>>
>> In case of multiqueue, we have multiple devices... This patch sets the
>> endianness for all the devices of the interface.
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>>  hw/net/vhost_net.c | 23 +++++++++++------------
>>  1 file changed, 11 insertions(+), 12 deletions(-)
>>
>> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
>> index 318c3e6..10e233a 100644
>> --- a/hw/net/vhost_net.c
>> +++ b/hw/net/vhost_net.c
>> @@ -300,21 +300,19 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
>>      BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev)));
>>      VirtioBusState *vbus = VIRTIO_BUS(qbus);
>>      VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
>> -    int r, e, i;
>> +    int r, e, i, j;
>>  
>>      if (!k->set_guest_notifiers) {
>>          error_report("binding does not support guest notifiers");
>> -        r = -ENOSYS;
>> -        goto err;
>> +        return -ENOSYS;
>>      }
>>  
>> -    r = vhost_net_set_vnet_endian(dev, ncs[0].peer, true);
>> -    if (r < 0) {
>> -        goto err;
>> -    }
>> -
>> -    for (i = 0; i < total_queues; i++) {
>> -        vhost_net_set_vq_index(get_vhost_net(ncs[i].peer), i * 2);
>> +    for (j = 0; j < total_queues; j++) {
>> +        r = vhost_net_set_vnet_endian(dev, ncs[j].peer, true);
>> +        if (r < 0) {
>> +            goto err_endian;
>> +        }
>> +        vhost_net_set_vq_index(get_vhost_net(ncs[j].peer), j * 2);
>>      }
>>  
>>      r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true);
>> @@ -343,8 +341,9 @@ err_start:
>>          fflush(stderr);
>>      }
>>  err_endian:
>> -    vhost_net_set_vnet_endian(dev, ncs[0].peer, false);
>> -err:
>> +    while (--j >= 0) {
>> +        vhost_net_set_vnet_endian(dev, ncs[j].peer, false);
>> +    }
>>      return r;
>>  }
>>  

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

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

* Re: [Qemu-devel] [PATCH] net: set endianness on all backend devices
  2016-01-22  6:44   ` Jason Wang
@ 2016-01-26 10:53     ` Laurent Vivier
  2016-01-26 13:15       ` Greg Kurz
  0 siblings, 1 reply; 7+ messages in thread
From: Laurent Vivier @ 2016-01-26 10:53 UTC (permalink / raw)
  To: Jason Wang, qemu-devel; +Cc: gkurz, mst



On 22/01/2016 07:44, Jason Wang wrote:
> 
> 
> On 01/21/2016 04:42 PM, Laurent Vivier wrote:
>> ping
>>
>> [added Jason in cc:]
>>
>> On 13/01/2016 20:26, Laurent Vivier wrote:
>>> commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991
>>>        vhost-net: tell tap backend about the vnet endianness
>>>
>>> makes vhost net to set the endianness of the device, but only for
>>> the first device.
>>>
>>> In case of multiqueue, we have multiple devices... This patch sets the
>>> endianness for all the devices of the interface.
>>>
>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>>> ---
>>>  hw/net/vhost_net.c | 23 +++++++++++------------
>>>  1 file changed, 11 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
>>> index 318c3e6..10e233a 100644
>>> --- a/hw/net/vhost_net.c
>>> +++ b/hw/net/vhost_net.c
>>> @@ -300,21 +300,19 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
>>>      BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev)));
>>>      VirtioBusState *vbus = VIRTIO_BUS(qbus);
>>>      VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
>>> -    int r, e, i;
>>> +    int r, e, i, j;
>>>  
>>>      if (!k->set_guest_notifiers) {
>>>          error_report("binding does not support guest notifiers");
>>> -        r = -ENOSYS;
>>> -        goto err;
>>> +        return -ENOSYS;
>>>      }
>>>  
>>> -    r = vhost_net_set_vnet_endian(dev, ncs[0].peer, true);
>>> -    if (r < 0) {
>>> -        goto err;
>>> -    }
>>> -
>>> -    for (i = 0; i < total_queues; i++) {
>>> -        vhost_net_set_vq_index(get_vhost_net(ncs[i].peer), i * 2);
>>> +    for (j = 0; j < total_queues; j++) {
>>> +        r = vhost_net_set_vnet_endian(dev, ncs[j].peer, true);
>>> +        if (r < 0) {
>>> +            goto err_endian;
>>> +        }
>>> +        vhost_net_set_vq_index(get_vhost_net(ncs[j].peer), j * 2);
>>>      }
>>>  
>>>      r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true);
>>> @@ -343,8 +341,9 @@ err_start:
>>>          fflush(stderr);
>>>      }
>>>  err_endian:
>>> -    vhost_net_set_vnet_endian(dev, ncs[0].peer, false);
>>> -err:
>>> +    while (--j >= 0) {
>>> +        vhost_net_set_vnet_endian(dev, ncs[j].peer, false);
>>> +    }
>>>      return r;
>>>  }
>>>  
> 
> Reviewed-by: Jason Wang <jasowang@redhat.com>

Thanks Jason.

Who can pick this in his tree ?

Laurent

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

* Re: [Qemu-devel] [PATCH] net: set endianness on all backend devices
  2016-01-26 10:53     ` Laurent Vivier
@ 2016-01-26 13:15       ` Greg Kurz
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kurz @ 2016-01-26 13:15 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Jason Wang, qemu-devel, mst

On Tue, 26 Jan 2016 11:53:21 +0100
Laurent Vivier <lvivier@redhat.com> wrote:

> On 22/01/2016 07:44, Jason Wang wrote:
> > 
> > 
> > On 01/21/2016 04:42 PM, Laurent Vivier wrote:  
> >> ping
> >>
> >> [added Jason in cc:]
> >>
> >> On 13/01/2016 20:26, Laurent Vivier wrote:  
> >>> commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991
> >>>        vhost-net: tell tap backend about the vnet endianness
> >>>
> >>> makes vhost net to set the endianness of the device, but only for
> >>> the first device.
> >>>
> >>> In case of multiqueue, we have multiple devices... This patch sets the
> >>> endianness for all the devices of the interface.
> >>>
> >>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> >>> ---
> >>>  hw/net/vhost_net.c | 23 +++++++++++------------
> >>>  1 file changed, 11 insertions(+), 12 deletions(-)
> >>>
> >>> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> >>> index 318c3e6..10e233a 100644
> >>> --- a/hw/net/vhost_net.c
> >>> +++ b/hw/net/vhost_net.c
> >>> @@ -300,21 +300,19 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
> >>>      BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev)));
> >>>      VirtioBusState *vbus = VIRTIO_BUS(qbus);
> >>>      VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
> >>> -    int r, e, i;
> >>> +    int r, e, i, j;
> >>>  
> >>>      if (!k->set_guest_notifiers) {
> >>>          error_report("binding does not support guest notifiers");
> >>> -        r = -ENOSYS;
> >>> -        goto err;
> >>> +        return -ENOSYS;
> >>>      }
> >>>  
> >>> -    r = vhost_net_set_vnet_endian(dev, ncs[0].peer, true);
> >>> -    if (r < 0) {
> >>> -        goto err;
> >>> -    }
> >>> -
> >>> -    for (i = 0; i < total_queues; i++) {
> >>> -        vhost_net_set_vq_index(get_vhost_net(ncs[i].peer), i * 2);
> >>> +    for (j = 0; j < total_queues; j++) {
> >>> +        r = vhost_net_set_vnet_endian(dev, ncs[j].peer, true);
> >>> +        if (r < 0) {
> >>> +            goto err_endian;
> >>> +        }
> >>> +        vhost_net_set_vq_index(get_vhost_net(ncs[j].peer), j * 2);
> >>>      }
> >>>  
> >>>      r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true);
> >>> @@ -343,8 +341,9 @@ err_start:
> >>>          fflush(stderr);
> >>>      }
> >>>  err_endian:
> >>> -    vhost_net_set_vnet_endian(dev, ncs[0].peer, false);
> >>> -err:
> >>> +    while (--j >= 0) {
> >>> +        vhost_net_set_vnet_endian(dev, ncs[j].peer, false);
> >>> +    }
> >>>      return r;
> >>>  }
> >>>    
> > 
> > Reviewed-by: Jason Wang <jasowang@redhat.com>  
> 
> Thanks Jason.
> 
> Who can pick this in his tree ?
> 

According to MAINTAINERS, this must go through Michael's tree, but it
looks like he is very busy reworking memory barriers in the kernel...

> Laurent
> 

--
Greg

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

end of thread, other threads:[~2016-01-26 13:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-13 19:26 [Qemu-devel] [PATCH] net: set endianness on all backend devices Laurent Vivier
2016-01-14  8:01 ` Greg Kurz
2016-01-14 10:06   ` Cornelia Huck
2016-01-21  8:42 ` Laurent Vivier
2016-01-22  6:44   ` Jason Wang
2016-01-26 10:53     ` Laurent Vivier
2016-01-26 13:15       ` Greg Kurz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.