[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option
From: |
Yongji Xie |
Subject: |
Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket |
Date: |
Wed, 19 Dec 2018 17:01:25 +0800 |
On Wed, 19 Dec 2018 at 00:09, Daniel P. Berrangé <address@hidden> wrote:
>
> On Tue, Dec 18, 2018 at 11:02:46AM -0500, Michael S. Tsirkin wrote:
> > On Tue, Dec 18, 2018 at 03:25:20PM +0000, Daniel P. Berrangé wrote:
> > > On Tue, Dec 18, 2018 at 04:24:26PM +0400, Marc-André Lureau wrote:
> > > > Hi
> > > >
> > > > On Tue, Dec 18, 2018 at 2:01 PM <address@hidden> wrote:
> > > > >
> > > > > From: Xie Yongji <address@hidden>
> > > > >
> > > > > New option "disconnected" is added to init the chardev socket
> > > > > in disconnected state. Then we can use qemu_chr_fe_wait_connected()
> > > > > to connect when necessary. Now it would be used for unix domain
> > > > > socket of vhost-user-blk device to support reconnect.
> > > >
> > > > What difference does that make if you wait for connection in
> > > > qemu_chr_fe_wait_connected(), or during chardev setup?
> > > >
> > > > "disconnected" is misleading, would it be possible to reuse
> > > > "wait/nowait" instead?
> > >
> > > Currently we default to doing a blocking connect in foreground,
> > > except if reconnect is non-zero, in which case we do a connect
> > > async in the background. This "disconnected" proposal effectively
> > > does a blocking connect, but delayed to later in startup.
> > >
> > > IOW, this could already be achieved if "reconnect" were set to
> > > non-zero. If the usage doesn't want reconnect though, I tend
> > > to agree that we should use the exisiting wait/nowait options
> > > to let it be controlled. I don't see that this "disconnected"
> > > option gives a compelling benefit over using wait/nowait.
> >
> > So the tricky thing is that we can not expose the
> > device to guest until we get a connection and can query
> > it for the first time. After that is completed,
> > we can reasonably support disconnected operation at least for net.
>
> The device code would still use qemu_chr_fe_wait_connected() in my proposal,
> so that its no different to the situation with the proposed "disconnected"
> flag.
>
I considered resuing wait/nowait before. One problem is that we will
have a thread to do connect async if backend is not started during
chardev setup.
Then if we use qemu_chr_fe_wait_connected() manually to connect in
device code, we may have some conflict in main thread like:
qemu_chr_fe_wait_connected()
tcp_chr_wait_connected()
tcp_chr_connect()
s->connected = 1;
qemu_chr_socket_connected()
check_report_connect_error()
qemu_chr_socket_restart_timer()
assert(s->connected == 0) /* qemu crash */
Thanks,
Yongji
- [Qemu-devel] [PATCH v2 for-4.0 0/7] vhost-user-blk: Add support for backend reconnecting, elohimes, 2018/12/18
- [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, elohimes, 2018/12/18
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Marc-André Lureau, 2018/12/18
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Yongji Xie, 2018/12/18
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Daniel P . Berrangé, 2018/12/18
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Michael S. Tsirkin, 2018/12/18
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Daniel P . Berrangé, 2018/12/18
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket,
Yongji Xie <=
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Michael S. Tsirkin, 2018/12/19
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Daniel P . Berrangé, 2018/12/19
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Michael S. Tsirkin, 2018/12/19
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Daniel P . Berrangé, 2018/12/19
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Michael S. Tsirkin, 2018/12/19
- Re: [Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket, Yongji Xie, 2018/12/19
[Qemu-devel] [PATCH v2 for-4.0 2/7] vhost-user: Support providing shared memory to backend, elohimes, 2018/12/18