From patchwork Thu Aug 1 02:17:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 263881 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DA5782C00B7 for ; Thu, 1 Aug 2013 12:29:53 +1000 (EST) Received: from localhost ([::1]:34933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4ieF-0004Jf-CS for incoming@patchwork.ozlabs.org; Wed, 31 Jul 2013 22:29:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4iSy-0003bJ-GL for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:18:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4iSn-0006P2-Vx for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:18:12 -0400 Received: from cantor2.suse.de ([195.135.220.15]:32779 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4iSn-0006Ob-HM for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:18:01 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1738EA51BB; Thu, 1 Aug 2013 04:18:01 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 1 Aug 2013 04:17:42 +0200 Message-Id: <1375323463-32747-22-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1375323463-32747-1-git-send-email-afaerber@suse.de> References: <1375323463-32747-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Kevin Wolf , Anthony Liguori , "Michael S. Tsirkin" , Stefan Hajnoczi , Amit Shah , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH for-next v2 21/22] virtio: Unrealize parent X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org VirtioDevice's DeviceClass::exit code cleaning up bus_name was overwritten by virtio-{blk,serial,net,scsi,balloon,rng} and vhost-scsi. Call their parent's DeviceClass::unrealize to fix this. Signed-off-by: Andreas Färber --- hw/block/virtio-blk.c | 4 ++++ hw/char/virtio-serial-bus.c | 4 ++++ hw/net/virtio-net.c | 4 ++++ hw/scsi/vhost-scsi.c | 4 ++++ hw/scsi/virtio-scsi.c | 4 ++++ hw/virtio/virtio-balloon.c | 4 ++++ hw/virtio/virtio-rng.c | 4 ++++ 7 files changed, 28 insertions(+) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 18fb020..0e45370 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -726,6 +726,8 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOBlock *s = VIRTIO_BLK(dev); + DeviceClass *parent_dc = DEVICE_CLASS(VIRTIO_BLK_GET_PARENT_CLASS(dev)); + #ifdef CONFIG_VIRTIO_BLK_DATA_PLANE remove_migration_state_change_notifier(&s->migration_state_notifier); virtio_blk_data_plane_destroy(s->dataplane); @@ -735,6 +737,8 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp) unregister_savevm(dev, "virtio-blk", s); blockdev_mark_auto_del(s->bs); virtio_cleanup(vdev); + + parent_dc->unrealize(dev, errp); } static Property virtio_blk_properties[] = { diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 1bed93f..ba221bf 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -996,6 +996,8 @@ static void virtio_serial_device_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOSerial *vser = VIRTIO_SERIAL(dev); + ObjectClass *parent_oc = VIRTIO_SERIAL_GET_PARENT_CLASS(dev); + DeviceClass *parent_dc = DEVICE_CLASS(parent_oc); unregister_savevm(dev, "virtio-console", vser); @@ -1009,6 +1011,8 @@ static void virtio_serial_device_unrealize(DeviceState *dev, Error **errp) g_free(vser->post_load); } virtio_cleanup(vdev); + + parent_dc->unrealize(dev, errp); } static Property virtio_serial_properties[] = { diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 16c230f..55d404e 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1573,6 +1573,8 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIONet *n = VIRTIO_NET(dev); + ObjectClass *parent_oc = VIRTIO_NET_GET_PARENT_CLASS(dev); + DeviceClass *parent_dc = DEVICE_CLASS(parent_oc); int i; /* This will stop vhost backend if appropriate. */ @@ -1609,6 +1611,8 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp) g_free(n->vqs); qemu_del_nic(n->nic); virtio_cleanup(vdev); + + parent_dc->unrealize(dev, errp); } static void virtio_net_instance_init(Object *obj) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 6e495b8..ad7cc9b 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -248,6 +248,8 @@ static void vhost_scsi_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VHostSCSI *s = VHOST_SCSI(dev); + ObjectClass *parent_oc = VHOST_SCSI_GET_PARENT_CLASS(dev); + DeviceClass *parent_dc = DEVICE_CLASS(parent_oc); migrate_del_blocker(s->migration_blocker); error_free(s->migration_blocker); @@ -258,6 +260,8 @@ static void vhost_scsi_unrealize(DeviceState *dev, Error **errp) g_free(s->dev.vqs); virtio_scsi_common_unrealize(dev, errp); + + parent_dc->unrealize(dev, errp); } static Property vhost_scsi_properties[] = { diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 9bddd3a..ac0ecdf 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -655,10 +655,14 @@ void virtio_scsi_common_unrealize(DeviceState *dev, Error **errp) static void virtio_scsi_device_unrealize(DeviceState *dev, Error **errp) { VirtIOSCSI *s = VIRTIO_SCSI(dev); + ObjectClass *parent_oc = VIRTIO_SCSI_GET_PARENT_CLASS(dev); + DeviceClass *parent_dc = DEVICE_CLASS(parent_oc); unregister_savevm(dev, "virtio-scsi", s); virtio_scsi_common_unrealize(dev, errp); + + parent_dc->unrealize(dev, errp); } static Property virtio_scsi_properties[] = { diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 9b65732..861dc3d 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -378,11 +378,15 @@ static void virtio_balloon_device_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOBalloon *s = VIRTIO_BALLOON(dev); + ObjectClass *parent_oc = VIRTIO_BALLOON_GET_PARENT_CLASS(dev); + DeviceClass *parent_dc = DEVICE_CLASS(parent_oc); balloon_stats_destroy_timer(s); qemu_remove_balloon_handler(s); unregister_savevm(dev, "virtio-balloon", s); virtio_cleanup(vdev); + + parent_dc->unrealize(dev, errp); } static Property virtio_balloon_properties[] = { diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 7c4526a..7d207a8 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -189,11 +189,15 @@ static void virtio_rng_device_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIORNG *vrng = VIRTIO_RNG(dev); + ObjectClass *parent_oc = VIRTIO_RNG_GET_PARENT_CLASS(dev); + DeviceClass *parent_dc = DEVICE_CLASS(parent_oc); qemu_del_timer(vrng->rate_limit_timer); qemu_free_timer(vrng->rate_limit_timer); unregister_savevm(dev, "virtio-rng", vrng); virtio_cleanup(vdev); + + parent_dc->unrealize(dev, errp); } static Property virtio_rng_properties[] = {