[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 23/24] vhost-user: wait until link is up
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH 23/24] vhost-user: wait until link is up |
Date: |
Thu, 23 Jun 2016 19:45:33 +0300 |
On Thu, Jun 23, 2016 at 05:11:37AM -0400, Marc-André Lureau wrote:
> Hi
>
> ----- Original Message -----
> > On Tue, Jun 21, 2016 at 12:02:51PM +0200, address@hidden wrote:
> > > From: Marc-André Lureau <address@hidden>
> > >
> > > The chardev waits for an initial connection before starting qemu,
> > > vhost-user wants the backend negotiation to be completed. vhost-user is
> > > started in the net_vhost_user_event callback, which is synchronously
> > > called after the socket is connected.
> > >
> > > Signed-off-by: Marc-André Lureau <address@hidden>
> > > ---
> > > net/vhost-user.c | 10 +++++++++-
> > > 1 file changed, 9 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/net/vhost-user.c b/net/vhost-user.c
> > > index 95ed2d2..bb4a253 100644
> > > --- a/net/vhost-user.c
> > > +++ b/net/vhost-user.c
> > > @@ -248,7 +248,15 @@ static int net_vhost_user_init(NetClientState *peer,
> > > const char *device,
> > > s->chr = chr;
> > > }
> > >
> > > - qemu_chr_add_handlers(chr, NULL, NULL, net_vhost_user_event,
> > > nc[0].name);
> > > + do {
> > > + Error *err = NULL;
> > > + if (qemu_chr_wait_connected(chr, &err) < 0) {
> > > + error_report_err(err);
> > > + return -1;
> > > + }
> > > + qemu_chr_add_handlers(chr, NULL, NULL,
> > > + net_vhost_user_event, nc[0].name);
> > > + } while (nc->link_down);
> > >
> > > assert(s->vhost_net != NULL);
> >
> >
> > I don't get why this makes sense.
> > Why should vhost user poke at link down at all?
>
> It should wait for an initial valid connection (see the test case). Only
> after vhost_user_start() should it keep going. We could have
> VhostUserState.ready set to true when done, or we could check after
> qmp_set_link(.., true) status, like I did here. Does that make sense?
>
> thanks
I'd prefer something well contained. A dedicated flags sounds
reasonable.
commit d39c87d70763f2755d1d7a719817b06f0281fb01
Author: Wen Congyang <address@hidden>
Date: Wed Nov 11 14:53:29 2015 +0800
vhost-user: set link down when the char device is closed
was a quick hack. Disconnect should be transparent to guest and not
cause dhcp renegotiation and stuff.
The reason it's there is because we do not yet handle tx packets
when disconnected, so it reduces the chance of tx watchdog if we tell guest it
should not transmit anything new.
Once we fix that we will drop the link down thing, so don't rely on link
state please.
--
MST
- Re: [Qemu-devel] [PATCH 06/24] vhost-user: check vhost_user_write() return value, (continued)
- [Qemu-devel] [PATCH 15/24] vhost: fix calling vhost_dev_cleanup() after vhost_dev_init(), marcandre . lureau, 2016/06/21
- [Qemu-devel] [PATCH 16/24] vhost-user: keep vhost_net after a disconnection, marcandre . lureau, 2016/06/21
- [Qemu-devel] [PATCH 21/24] char: add chr_wait_connected callback, marcandre . lureau, 2016/06/21
- [Qemu-devel] [PATCH 18/24] get_vhost_net() should be != null after vhost_user_init, marcandre . lureau, 2016/06/21
- [Qemu-devel] [PATCH 22/24] char: add and use tcp_chr_wait_connected, marcandre . lureau, 2016/06/21
- [Qemu-devel] [PATCH 17/24] Revert "vhost-net: do not crash if backend is not present", marcandre . lureau, 2016/06/21
- [Qemu-devel] [PATCH 23/24] vhost-user: wait until link is up, marcandre . lureau, 2016/06/21
- [Qemu-devel] [PATCH 19/24] vhost-net: success if backend has no ops->vhost_migration_done, marcandre . lureau, 2016/06/21
- [Qemu-devel] [PATCH 24/24] tests: add /vhost-user/connect-fail test, marcandre . lureau, 2016/06/21
- [Qemu-devel] [PATCH 20/24] vhost: add assert() to check runtime behaviour, marcandre . lureau, 2016/06/21
- Re: [Qemu-devel] [PATCH 00/24] vhost-user reconnect fixes, Michael S. Tsirkin, 2016/06/23
Re: [Qemu-devel] [PATCH 00/24] vhost-user reconnect fixes, Michael S. Tsirkin, 2016/06/23