On Wed, 15 Apr 2020 12:56:18 +0200, Marc-André Lureau <marcandre.lur...@gmail.com> wrote: > On Wed, Apr 15, 2020 at 3:07 AM Adalbert Lazăr <ala...@bitdefender.com> wrote: > > > > This is used by the VM introspection object, after handshake, to hand > > over the file descriptor to KVM. > > > > CC: "Marc-André Lureau" <marcandre.lur...@redhat.com> > > CC: Paolo Bonzini <pbonz...@redhat.com> > > Signed-off-by: Adalbert Lazăr <ala...@bitdefender.com> > > > patch looks ok, > Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> > > > 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 >