Received: from eggs.gnu.org ([2001:4830:134:3::10]:45893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX74q-0000G7-0Y for qemu-devel@nongnu.org; Thu, 25 Sep 2014 07:19:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XX74e-000430-Bd for qemu-devel@nongnu.org; Thu, 25 Sep 2014 07:19:11 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:47496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX74e-00041y-38 for qemu-devel@nongnu.org; Thu, 25 Sep 2014 07:19:00 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Sep 2014 12:08:43 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 132702190056 for ; Thu, 25 Sep 2014 12:08:20 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s8PB8f4036700188 for ; Thu, 25 Sep 2014 11:08:41 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s8PB8eiO016904 for ; Thu, 25 Sep 2014 05:08:40 -0600 Date: Thu, 25 Sep 2014 13:08:38 +0200 From: Cornelia Huck Message-ID: <20140925130838.492d655d.cornelia.huck@de.ibm.com> In-Reply-To: <1411559299-19042-21-git-send-email-imammedo@redhat.com> References: <1411559299-19042-1-git-send-email-imammedo@redhat.com> <1411559299-19042-21-git-send-email-imammedo@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 20/30] s390x: convert virtio-ccw to hotplug handler API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: dmitry@daynix.com, mst@redhat.com, agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, kraxel@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, rth@twiddle.net On Wed, 24 Sep 2014 11:48:09 +0000 Igor Mammedov wrote: > Signed-off-by: Igor Mammedov > --- > hw/s390x/virtio-ccw.c | 24 ++++++++++++++++-------- > 1 file changed, 16 insertions(+), 8 deletions(-) Well, I think I now see what's going on here. More below... > @@ -1620,13 +1620,13 @@ static Property virtio_ccw_properties[] = { > static void virtio_ccw_device_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc = DEVICE_CLASS(klass); > + HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass); > > dc->props = virtio_ccw_properties; > dc->init = virtio_ccw_busdev_init; > dc->exit = virtio_ccw_busdev_exit; > - dc->unplug = virtio_ccw_busdev_unplug; Before, this callback was invoked when a device of the virtio-ccw class was unplugged. > dc->bus_type = TYPE_VIRTUAL_CSS_BUS; > - > + hc->unplug = virtio_ccw_busdev_unplug; Now, this callback is supposed to be invoked instead. However, the unplugging code invokes the callback for the _parent bus_, which means... > } > > static const TypeInfo virtio_ccw_device_info = { > static void virtual_css_bridge_class_init(ObjectClass *klass, void *data) > { > SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); > + HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass); > > k->init = virtual_css_bridge_init; > + hc->unplug = qdev_simple_device_unplug_cb; ...we're invoking this one, as the parent bus for virtio-ccw devices is the virtual-css bus. If I change this callback to the virtio-ccw one, everything works as expected. > } So, to summarize, what happened before was bridge device <--- (simple unplug invoked for dev) -> virtual bus -> virtio proxy device <--- virtio unplug invoked for dev -> virtio bus -> virtio device which your patch changed to bridge device -> virtual bus <--- simple unplug invoked for virtio proxy dev -> virtio proxy device -> virtio bus <--- (virtio unplug invoked for virtio dev) -> virtio device Am I understanding this correctly?