From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm0VR-0001SA-Qv for qemu-devel@nongnu.org; Wed, 27 Jul 2011 05:34:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qm0VQ-0002ph-Pc for qemu-devel@nongnu.org; Wed, 27 Jul 2011 05:34:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm0VQ-0002pY-HM for qemu-devel@nongnu.org; Wed, 27 Jul 2011 05:34:20 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6R9YJ29020573 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Jul 2011 05:34:19 -0400 Date: Wed, 27 Jul 2011 15:04:14 +0530 From: Amit Shah Message-ID: <20110727093414.GA27716@amit-x200.redhat.com> References: <437e364393661cf06deaad6f29f1039d3a672d1d.1311750065.git.amit.shah@redhat.com> <20110727090632.GA31946@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110727090632.GA31946@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: Check if balloon registration failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu list , Markus Armbruster On (Wed) 27 Jul 2011 [12:06:32], Michael S. Tsirkin wrote: > On Wed, Jul 27, 2011 at 12:31:08PM +0530, Amit Shah wrote: > > Multiple balloon registrations are not allowed; check if the > > registration with the qemu balloon api succeeded. If not, fail the > > device init. > > > > Signed-off-by: Amit Shah > > --- > > hw/virtio-balloon.c | 10 +++++++++- > > hw/virtio-pci.c | 3 +++ > > 2 files changed, 12 insertions(+), 1 deletions(-) > > > > diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c > > index 2ba7e95..304a31a 100644 > > --- a/hw/virtio-balloon.c > > +++ b/hw/virtio-balloon.c > > @@ -269,6 +269,7 @@ static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id) > > VirtIODevice *virtio_balloon_init(DeviceState *dev) > > { > > VirtIOBalloon *s; > > + int ret; > > > > s = (VirtIOBalloon *)virtio_common_init("virtio-balloon", > > VIRTIO_ID_BALLOON, > > @@ -278,12 +279,19 @@ VirtIODevice *virtio_balloon_init(DeviceState *dev) > > s->vdev.set_config = virtio_balloon_set_config; > > s->vdev.get_features = virtio_balloon_get_features; > > > > + ret = qemu_add_balloon_handler(virtio_balloon_to_target, > > + virtio_balloon_stat, s); > > + if (ret < 0) { > > + error_report("Another balloon device already registered"); > > We don't know why it failed at this point. I think > error report should be triggered by qemu_add_balloon_handler, > and this function would just cleanup and exit. OK, makes sense. Amit