[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v1 05/26] char-socket: add 'fd' property
From: |
Adalbert Lazăr |
Subject: |
Re: [RFC PATCH v1 05/26] char-socket: add 'fd' property |
Date: |
Wed, 15 Apr 2020 15:55:31 +0300 |
User-agent: |
void |
On Wed, 15 Apr 2020 12:56:18 +0200, Marc-André Lureau <address@hidden> wrote:
> On Wed, Apr 15, 2020 at 3:07 AM Adalbert Lazăr <address@hidden> wrote:
> >
> > This is used by the VM introspection object, after handshake, to hand
> > over the file descriptor to KVM.
> >
> > CC: "Marc-André Lureau" <address@hidden>
> > CC: Paolo Bonzini <address@hidden>
> > Signed-off-by: Adalbert Lazăr <address@hidden>
>
>
> patch looks ok,
> Reviewed-by: Marc-André Lureau <address@hidden>
>
>
> Though I wonder about potential conflicts of fd usage here..
>
The 'plan' was to pass the file descriptor to KVM, disable socket
reconnect and forget about this file descriptor. But, we need a way
to signal from KVM to QEMU that the file descriptor was closed and to
reconnect the socket.
There were some vsock issues in kernel (shutdown on the socket was
not detected in some cases or something else) and having the fd checked
for POLLHUP in QEMU helped, but these issues might be already fixed,
because I've seen a lot of improvements made on vsock code.
>
> > ---
> > chardev/char-socket.c | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> >
> > diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> > index 22ab242748..76d0fb8839 100644
> > --- a/chardev/char-socket.c
> > +++ b/chardev/char-socket.c
> > @@ -1499,6 +1499,21 @@ static bool char_socket_get_reconnecting(Object
> > *obj, Error **errp)
> > return s->reconnect_time > 0;
> > }
> >
> > +static void
> > +char_socket_get_fd(Object *obj, Visitor *v, const char *name, void *opaque,
> > + Error **errp)
> > +{
> > + int fd = -1;
> > + SocketChardev *s = SOCKET_CHARDEV(obj);
> > + QIOChannelSocket *sock = QIO_CHANNEL_SOCKET(s->sioc);
> > +
> > + if (sock) {
> > + fd = sock->fd;
> > + }
> > +
> > + visit_type_int32(v, name, &fd, errp);
> > +}
> > +
> > static int tcp_chr_reconnect_time(Chardev *chr, int secs)
> > {
> > SocketChardev *s = SOCKET_CHARDEV(chr);
> > @@ -1539,6 +1554,9 @@ static void char_socket_class_init(ObjectClass *oc,
> > void *data)
> > object_class_property_add_bool(oc, "reconnecting",
> > char_socket_get_reconnecting,
> > NULL, &error_abort);
> > +
> > + object_class_property_add(oc, "fd", "int32", char_socket_get_fd,
> > + NULL, NULL, NULL, &error_abort);
> > }
> >
> > static const TypeInfo char_socket_type_info = {
> >
>
>
> --
> Marc-André Lureau
>
- Re: [RFC PATCH v1 03/26] char-socket: fix the client mode when created through QMP, (continued)
[RFC PATCH v1 08/26] kvm: add VM introspection usage documentation, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 04/26] char-socket: add 'reconnecting' property, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 06/26] E820: extend the table access interface, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 07/26] linux-headers: update with VM introspection interface, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 05/26] char-socket: add 'fd' property, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 13/26] kvm: vmi: block the object destruction if the chardev is connected, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 09/26] kvm: introduce the VM introspection object, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 02/26] char-socket: allow vsock parameters (cid, port), Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 01/26] chardev: tcp: allow to change the reconnect timer, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 14/26] kvm: vmi: allow only one instance of the introspection object, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 11/26] kvm: vmi: add 'handshake_timeout' property, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 15/26] kvm: vmi: reconnect the socket on reset, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 19/26] kvm: vmi: intercept force-reset, Adalbert Lazăr, 2020/04/14