From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKncx-0006yk-3K for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:16:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKncr-0007eR-VL for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:16:33 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51143 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKncr-0007eF-Oz for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:16:29 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u66EEL4f016789 for ; Wed, 6 Jul 2016 10:16:29 -0400 Received: from e23smtp09.au.ibm.com (e23smtp09.au.ibm.com [202.81.31.142]) by mx0b-001b2d01.pphosted.com with ESMTP id 240nej9upc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 06 Jul 2016 10:16:29 -0400 Received: from localhost by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 7 Jul 2016 00:16:26 +1000 Date: Wed, 6 Jul 2016 19:46:13 +0530 From: Bharata B Rao Reply-To: bharata@linux.vnet.ibm.com References: <1467795561-1007-1-git-send-email-bharata@linux.vnet.ibm.com> <1467795561-1007-2-git-send-email-bharata@linux.vnet.ibm.com> <20160706125749.5a38adab@172-15-179-184.lightspeed.austtx.sbcglobal.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160706125749.5a38adab@172-15-179-184.lightspeed.austtx.sbcglobal.net> Message-Id: <20160706141613.GE25522@in.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v1 1/5] cpu, target-ppc: Move cpu_vmstate_[un]register calls to cpu_common_[un]realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, groug@kaod.org, nikunj@linux.vnet.ibm.com, pbonzini@redhat.com On Wed, Jul 06, 2016 at 12:57:49PM +0200, Igor Mammedov wrote: > On Wed, 6 Jul 2016 14:29:17 +0530 > Bharata B Rao wrote: > > > Move vmstate_register() call to cpu_common_realize(). > > Introduce cpu_common_unrealize() and move vmstate_unregister() to it. > > > > Change those archs that implement their own CPU unrealize routine to > > mandatorily call CPUClass::unrealize(). > > > > Signed-off-by: Bharata B Rao > > --- > > exec.c | 53 > > ++++++++++++++++++++++++++++----------------- > > include/qom/cpu.h | 2 ++ qom/cpu.c | 7 > > ++++++ target-ppc/cpu-qom.h | 2 ++ > > target-ppc/translate_init.c | 3 +++ > > 5 files changed, 47 insertions(+), 20 deletions(-) > > > > diff --git a/exec.c b/exec.c > > index 0122ef7..fb73910 100644 > > --- a/exec.c > > +++ b/exec.c > > @@ -594,9 +594,7 @@ AddressSpace *cpu_get_address_space(CPUState > > *cpu, int asidx) /* Return the AddressSpace corresponding to the > > specified index */ return cpu->cpu_ases[asidx].as; > > } > > -#endif > > > > -#ifndef CONFIG_USER_ONLY > > static DECLARE_BITMAP(cpu_index_map, MAX_CPUMASK_BITS); > > > > static int cpu_get_free_index(Error **errp) > > @@ -617,6 +615,31 @@ static void cpu_release_index(CPUState *cpu) > > { > > bitmap_clear(cpu_index_map, cpu->cpu_index, 1); > > } > > + > > +void cpu_vmstate_register(CPUState *cpu) > > +{ > > + CPUClass *cc = CPU_GET_CLASS(cpu); > > + > > + if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { > > + vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, > > cpu); > > + } > > + if (cc->vmsd != NULL) { > > + vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu); > > + } > > +} > > + > > +void cpu_vmstate_unregister(CPUState *cpu) > > +{ > > + CPUClass *cc = CPU_GET_CLASS(cpu); > > + > > + if (cc->vmsd != NULL) { > > + vmstate_unregister(NULL, cc->vmsd, cpu); > > + } > > + if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { > > + vmstate_unregister(NULL, &vmstate_cpu_common, cpu); > > + } > > +} > > Is there any reason to keep these in exec.c, > I'd put them in qom/cpu.c I started with it, had to move vmstate_cpu_common and its pre/post_load routines and one of them called tlb_flush() whose header qom/cpu.c didn't like. So I saved the movement for later. Regards, Bharata.