qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3] vhost_net: cleanup recovery
@ 2014-09-03 10:35 Michael S. Tsirkin
  2014-09-03 10:48 ` Andrey Korolyov
  2014-09-03 10:52 ` Jason Wang
  0 siblings, 2 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-09-03 10:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jason Wang, Andrey Korolyov, qemu-stable

commit aad4dce934649b3a398396fc2a76f215bb194ea4
    vhost_net: start/stop guest notifiers properly

changed the order of calls for guest notifiers,
but did not recover in the correct (reverse) order.
Fix it up.

Cc: qemu-stable@nongnu.org
Cc: Andrey Korolyov <andrey@xdel.ru>
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/net/vhost_net.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index ba5d544..3819044 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -289,7 +289,7 @@ 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, i = 0;
+    int r, e, i;
 
     if (!vhost_net_device_endian_ok(dev)) {
         error_report("vhost-net does not support cross-endian");
@@ -317,16 +317,22 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
         r = vhost_net_start_one(get_vhost_net(ncs[i].peer), dev);
 
         if (r < 0) {
-            goto err;
+            goto err_start;
         }
     }
 
     return 0;
 
-err:
+err_start:
     while (--i >= 0) {
         vhost_net_stop_one(get_vhost_net(ncs[i].peer), dev);
     }
+    e = k->set_guest_notifiers(qbus->parent, total_queues * 2, false);
+    if (e < 0) {
+        fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", e);
+        fflush(stderr);
+    }
+err:
     return r;
 }
 
-- 
MST

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

* Re: [Qemu-devel] [PATCH v3] vhost_net: cleanup recovery
  2014-09-03 10:35 [Qemu-devel] [PATCH v3] vhost_net: cleanup recovery Michael S. Tsirkin
@ 2014-09-03 10:48 ` Andrey Korolyov
  2014-09-03 10:52 ` Jason Wang
  1 sibling, 0 replies; 4+ messages in thread
From: Andrey Korolyov @ 2014-09-03 10:48 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Jason Wang, qemu-devel@nongnu.org, qemu-stable

On Wed, Sep 3, 2014 at 2:35 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> commit aad4dce934649b3a398396fc2a76f215bb194ea4
>     vhost_net: start/stop guest notifiers properly
>
> changed the order of calls for guest notifiers,
> but did not recover in the correct (reverse) order.
> Fix it up.
>
> Cc: qemu-stable@nongnu.org
> Cc: Andrey Korolyov <andrey@xdel.ru>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/net/vhost_net.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index ba5d544..3819044 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -289,7 +289,7 @@ 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, i = 0;
> +    int r, e, i;
>
>      if (!vhost_net_device_endian_ok(dev)) {
>          error_report("vhost-net does not support cross-endian");
> @@ -317,16 +317,22 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
>          r = vhost_net_start_one(get_vhost_net(ncs[i].peer), dev);
>
>          if (r < 0) {
> -            goto err;
> +            goto err_start;
>          }
>      }
>
>      return 0;
>
> -err:
> +err_start:
>      while (--i >= 0) {
>          vhost_net_stop_one(get_vhost_net(ncs[i].peer), dev);
>      }
> +    e = k->set_guest_notifiers(qbus->parent, total_queues * 2, false);
> +    if (e < 0) {
> +        fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", e);
> +        fflush(stderr);
> +    }
> +err:
>      return r;
>  }
>
> --
> MST


Except thing that the accel reinitialization takes place now at every
reset, everything is OK (problematic tree with just this patch
applied):

qemu-system-x86_64: unable to start vhost net: 95: falling back on
userspace virtio
qemu-system-x86_64: unable to start vhost net: 95: falling back on
userspace virtio
... reset...
qemu-system-x86_64: unable to start vhost net: 95: falling back on
userspace virtio
qemu-system-x86_64: unable to start vhost net: 95: falling back on
userspace virtio

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

* Re: [Qemu-devel] [PATCH v3] vhost_net: cleanup recovery
  2014-09-03 10:35 [Qemu-devel] [PATCH v3] vhost_net: cleanup recovery Michael S. Tsirkin
  2014-09-03 10:48 ` Andrey Korolyov
@ 2014-09-03 10:52 ` Jason Wang
  2014-09-03 11:26   ` Michael S. Tsirkin
  1 sibling, 1 reply; 4+ messages in thread
From: Jason Wang @ 2014-09-03 10:52 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: Andrey Korolyov, qemu-stable

On 09/03/2014 06:35 PM, Michael S. Tsirkin wrote:
> commit aad4dce934649b3a398396fc2a76f215bb194ea4
>     vhost_net: start/stop guest notifiers properly
>
> changed the order of calls for guest notifiers,
> but did not recover in the correct (reverse) order.
> Fix it up.
>
> Cc: qemu-stable@nongnu.org
> Cc: Andrey Korolyov <andrey@xdel.ru>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/net/vhost_net.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index ba5d544..3819044 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -289,7 +289,7 @@ 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, i = 0;
> +    int r, e, i;
>  
>      if (!vhost_net_device_endian_ok(dev)) {
>          error_report("vhost-net does not support cross-endian");
> @@ -317,16 +317,22 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
>          r = vhost_net_start_one(get_vhost_net(ncs[i].peer), dev);
>  
>          if (r < 0) {
> -            goto err;
> +            goto err_start;
>          }
>      }
>  
>      return 0;
>  
> -err:
> +err_start:
>      while (--i >= 0) {
>          vhost_net_stop_one(get_vhost_net(ncs[i].peer), dev);
>      }
> +    e = k->set_guest_notifiers(qbus->parent, total_queues * 2, false);
> +    if (e < 0) {
> +        fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", e);
> +        fflush(stderr);
> +    }
> +err:
>      return r;
>  }
>  

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

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

* Re: [Qemu-devel] [PATCH v3] vhost_net: cleanup recovery
  2014-09-03 10:52 ` Jason Wang
@ 2014-09-03 11:26   ` Michael S. Tsirkin
  0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-09-03 11:26 UTC (permalink / raw)
  To: Jason Wang; +Cc: Andrey Korolyov, qemu-devel, qemu-stable

On Wed, Sep 03, 2014 at 06:52:46PM +0800, Jason Wang wrote:
> On 09/03/2014 06:35 PM, Michael S. Tsirkin wrote:
> > commit aad4dce934649b3a398396fc2a76f215bb194ea4
> >     vhost_net: start/stop guest notifiers properly
> >
> > changed the order of calls for guest notifiers,
> > but did not recover in the correct (reverse) order.
> > Fix it up.
> >
> > Cc: qemu-stable@nongnu.org
> > Cc: Andrey Korolyov <andrey@xdel.ru>
> > Cc: Jason Wang <jasowang@redhat.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  hw/net/vhost_net.c | 12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> > index ba5d544..3819044 100644
> > --- a/hw/net/vhost_net.c
> > +++ b/hw/net/vhost_net.c
> > @@ -289,7 +289,7 @@ 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, i = 0;
> > +    int r, e, i;
> >  
> >      if (!vhost_net_device_endian_ok(dev)) {
> >          error_report("vhost-net does not support cross-endian");
> > @@ -317,16 +317,22 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
> >          r = vhost_net_start_one(get_vhost_net(ncs[i].peer), dev);
> >  
> >          if (r < 0) {
> > -            goto err;
> > +            goto err_start;
> >          }
> >      }
> >  
> >      return 0;
> >  
> > -err:
> > +err_start:
> >      while (--i >= 0) {
> >          vhost_net_stop_one(get_vhost_net(ncs[i].peer), dev);
> >      }
> > +    e = k->set_guest_notifiers(qbus->parent, total_queues * 2, false);
> > +    if (e < 0) {
> > +        fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", e);
> > +        fflush(stderr);
> > +    }
> > +err:
> >      return r;
> >  }
> >  
> 
> Acked-by: Jason Wang <jasowang@redhat.com>


OK I will just roll this up into the original patch.

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

end of thread, other threads:[~2014-09-03 11:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-03 10:35 [Qemu-devel] [PATCH v3] vhost_net: cleanup recovery Michael S. Tsirkin
2014-09-03 10:48 ` Andrey Korolyov
2014-09-03 10:52 ` Jason Wang
2014-09-03 11:26   ` 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).