From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQr2-00058e-0A for qemu-devel@nongnu.org; Thu, 19 Nov 2015 10:10:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzQqx-00067L-W2 for qemu-devel@nongnu.org; Thu, 19 Nov 2015 10:10:31 -0500 Received: from e34.co.us.ibm.com ([32.97.110.152]:36239) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQqx-00066d-O8 for qemu-devel@nongnu.org; Thu, 19 Nov 2015 10:10:27 -0500 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 19 Nov 2015 08:10:26 -0700 Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 3FD0C19D8026 for ; Thu, 19 Nov 2015 07:58:31 -0700 (MST) Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tAJFAM4W32243862 for ; Thu, 19 Nov 2015 08:10:23 -0700 Received: from d03av05.boulder.ibm.com (localhost [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tAJFALB1017220 for ; Thu, 19 Nov 2015 08:10:21 -0700 From: Matthew Rosato Date: Thu, 19 Nov 2015 10:10:12 -0500 Message-Id: <1447945814-15765-8-git-send-email-mjrosato@linux.vnet.ibm.com> In-Reply-To: <1447945814-15765-1-git-send-email-mjrosato@linux.vnet.ibm.com> References: <1447945814-15765-1-git-send-email-mjrosato@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v2 7/9] s390x/cpu: Extra cleanup during CPU finalize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: agraf@suse.de, borntraeger@de.ibm.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, afaerber@suse.de, rth@twiddle.net In preparation for unplug, do some additional cleanup work to undo work originally done in cpu_exec_init. This patch is based on work done by Bharata B Rao. Signed-off-by: Matthew Rosato --- target-s390x/cpu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c index 0ef67a1..060a3cc 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -261,6 +261,20 @@ static void s390_cpu_finalize(Object *obj) { #if !defined(CONFIG_USER_ONLY) S390CPU *cpu = S390_CPU(obj); + CPUState *cs = CPU(cpu); + CPUClass *cc = CPU_GET_CLASS(cs); + CPUS390XState *env = &cpu->env; + + QTAILQ_REMOVE(&cpus, cs, node); + if (cc->vmsd != NULL) { + vmstate_unregister(NULL, cc->vmsd, cs); + } +#if defined(CPU_SAVE_VERSION) + unregister_savevm(NULL, "cpu", cs->env_ptr); +#endif + if (qdev_get_vmsd(DEVICE(cs)) == NULL) { + vmstate_unregister(NULL, &vmstate_cpu_common, cs); + } qemu_unregister_reset(s390_cpu_machine_reset_cb, cpu); g_free(cpu->irqstate); -- 1.9.1