From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=53796 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oqk8F-0007A4-8z for qemu-devel@nongnu.org; Wed, 01 Sep 2010 06:01:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oqk8D-0003cz-T1 for qemu-devel@nongnu.org; Wed, 01 Sep 2010 06:01:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25827) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oqk8D-0003c9-ML for qemu-devel@nongnu.org; Wed, 01 Sep 2010 06:01:25 -0400 Date: Wed, 1 Sep 2010 15:30:58 +0530 From: Amit Shah Message-ID: <20100901100058.GL25022@amit-laptop.redhat.com> References: <56229764a86564887032c74806e7d5f80d267741.1283242936.git.amit.shah@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56229764a86564887032c74806e7d5f80d267741.1283242936.git.amit.shah@redhat.com> Subject: [Qemu-devel] Re: [PATCH] virtio-serial: Unplug port if guest reports failure in adding it List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Juan Quintela On (Tue) Aug 31 2010 [13:52:22], Amit Shah wrote: > If a guest reports failure in adding a port, we shouldn't keep it lying > around. > > Signed-off-by: Amit Shah > --- > hw/virtio-serial-bus.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c > index 74ba5ec..86c2364 100644 > --- a/hw/virtio-serial-bus.c > +++ b/hw/virtio-serial-bus.c > @@ -303,6 +303,7 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len) > if (!cpkt.value) { > error_report("virtio-serial-bus: Guest failure in adding port %u for device %s\n", > port->id, vser->bus->qbus.name); > + qdev_unplug(&port->dev); > break; > } > /* OK, ignore this patch. My original thinking was that if the device got added successfully in qemu and failed to be added by the guest (can happen for a variety of reasons), we should keep the device lying around and tell the user about it. If the user doesn't want the device any more, it can be unplugged. I briefly thought that shouldn't be the case: if a guest can't use a device, it's no good to let it lie around in qemu. Just had a brief chat with Dan and he supported the original idea, so we'll let the device exist in qemu and let libvirt / the user yank it away if that's needed. (Of course, users of the device itself should check if the guest addition was successful by using virtio_serial_guest_ready(port)) Amit