From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPYUl-0006R6-NI for qemu-devel@nongnu.org; Tue, 09 Apr 2013 09:22:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPYUg-0006ve-O4 for qemu-devel@nongnu.org; Tue, 09 Apr 2013 09:21:55 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55662 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPYUg-0006vA-Em for qemu-devel@nongnu.org; Tue, 09 Apr 2013 09:21:50 -0400 Message-ID: <516415EC.6050105@suse.de> Date: Tue, 09 Apr 2013 15:21:48 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1365172636-28628-1-git-send-email-imammedo@redhat.com> <1365172636-28628-7-git-send-email-imammedo@redhat.com> <20130408201311.GI2719@otherpad.lan.raisama.net> <20130409122635.6c8df15f@nial.usersys.redhat.com> In-Reply-To: <20130409122635.6c8df15f@nial.usersys.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 06/22] cpu: introduce CPUClass.resume() method List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: aliguori@us.ibm.com, Eduardo Habkost , claudio.fontana@huawei.com, qemu-devel@nongnu.org, aderumier@odiso.com, lcapitulino@redhat.com, jfrei@linux.vnet.ibm.com, yang.z.zhang@intel.com, pbonzini@redhat.com, lig.fnst@cn.fujitsu.com, rth@twiddle.net Am 09.04.2013 12:26, schrieb Igor Mammedov: > On Mon, 8 Apr 2013 17:13:11 -0300 > Eduardo Habkost wrote: >=20 >> On Fri, Apr 05, 2013 at 04:36:58PM +0200, Igor Mammedov wrote: >>> ... and call it if defined from CPUClass.realize() if CPU was hotplug= ged >>> >>> by default leave .resume() unset (i.e. NULL) and override it for soft= mmu >>> in qemu_init_vcpu() if it's still unset. >>> >>> Signed-off-by: Igor Mammedov >> [...] >>> diff --git a/cpus.c b/cpus.c >>> index 9b9a32f..6b793c5 100644 >>> --- a/cpus.c >>> +++ b/cpus.c >>> @@ -973,6 +973,13 @@ void pause_all_vcpus(void) >> [...] >>> @@ -1042,7 +1047,11 @@ void qemu_init_vcpu(void *_env) >>> { >>> CPUArchState *env =3D _env; >>> CPUState *cpu =3D ENV_GET_CPU(env); >>> + CPUClass *klass =3D CPU_GET_CLASS(cpu); >>> =20 >>> + if (klass->resume =3D=3D NULL) { >>> + klass->resume =3D resume_vcpu; >>> + } >> >> So you are initializing a field of CPUClass struct inside a CPU object >> initialization function. And that's a function that is not even >> converted to QOM yet, and buried inside a non-trivial function call tr= ee >> (hence easy to be called at the wrong time if one day we reorder the >> initialization steps). > init step are not likely to change this drastically but main reason why > it's here see below. >=20 >> >> Can't we do this on class_init(), where it belongs? If we need differe= nt >> implementations for softmmu/user, we can add a stub for *-user. I thin= k >> even an explicit #ifdef inside resume_vcpu() would be preferable to >> this. > Generally I agree with you that class_init() would be more correct, but > ifdefs in qom/cpu.c defeat purpose to build qom/cpu.c only once for all > targets, that Andreas are working towards. Indeed. Anthony had suggested to introduce a cpu-softmmu.c or something like that it we ever need to distinguish. Not sure how they would interface though. ;) Andreas >=20 > It asks surely asks for resume_vcpu() stub in libqemustubs, and I'd do = it > there weren't objections to it. >=20 > Paolo, > it looks like a good candidate for libqemustubs, would it be ok to add= stub > there? >=20 >> >> >>> cpu->nr_cores =3D smp_cores; >>> cpu->nr_threads =3D smp_threads; >>> cpu->stopped =3D true; >> [...] >> >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg