From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ab1Pq-0001ic-Ue for qemu-devel@nongnu.org; Wed, 02 Mar 2016 02:41:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ab1Pn-0006NY-Oa for qemu-devel@nongnu.org; Wed, 02 Mar 2016 02:41:50 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:43604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ab1Pn-0006NM-FH for qemu-devel@nongnu.org; Wed, 02 Mar 2016 02:41:47 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 2 Mar 2016 07:41:44 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id A49FF17D805A for ; Wed, 2 Mar 2016 07:41:55 +0000 (GMT) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u227fUqt65011744 for ; Wed, 2 Mar 2016 07:41:30 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u227fUbE004317 for ; Wed, 2 Mar 2016 00:41:30 -0700 Date: Wed, 2 Mar 2016 08:41:28 +0100 From: David Hildenbrand Message-ID: <20160302084128.0944e394@thinkpad-w530> In-Reply-To: <1456866806-31466-4-git-send-email-mjrosato@linux.vnet.ibm.com> References: <1456866806-31466-1-git-send-email-mjrosato@linux.vnet.ibm.com> <1456866806-31466-4-git-send-email-mjrosato@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v7 3/6] s390x/cpu: Move some CPU initialization into realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Matthew Rosato Cc: imammedo@redhat.com, qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, bharata@linux.vnet.ibm.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, afaerber@suse.de, rth@twiddle.net > In preparation for hotplug, defer some CPU initialization > until the device is actually being realized. >=20 > Signed-off-by: Matthew Rosato > Reviewed-by: Andreas F=C3=A4rber > --- > target-s390x/cpu.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c > index 603c2a1..8dfd063 100644 > --- a/target-s390x/cpu.c > +++ b/target-s390x/cpu.c > @@ -195,7 +195,13 @@ static void s390_cpu_realizefn(DeviceState *dev, Err= or **errp) > { > CPUState *cs =3D CPU(dev); > S390CPUClass *scc =3D S390_CPU_GET_CLASS(dev); > + S390CPU *cpu =3D S390_CPU(dev); > + CPUS390XState *env =3D &cpu->env; >=20 > +#if !defined(CONFIG_USER_ONLY) > + qemu_register_reset(s390_cpu_machine_reset_cb, cpu); > +#endif > + env->cpu_num =3D cs->cpu_index; > s390_cpu_gdb_init(cs); > qemu_init_vcpu(cs); > #if !defined(CONFIG_USER_ONLY) > @@ -213,7 +219,6 @@ static void s390_cpu_initfn(Object *obj) > S390CPU *cpu =3D S390_CPU(obj); > CPUS390XState *env =3D &cpu->env; > static bool inited; > - static int cpu_num =3D 0; > #if !defined(CONFIG_USER_ONLY) > struct tm tm; > #endif > @@ -223,7 +228,6 @@ static void s390_cpu_initfn(Object *obj) > cs->exception_index =3D EXCP_HLT; > cpu_exec_init(cs, &error_abort); > #if !defined(CONFIG_USER_ONLY) > - qemu_register_reset(s390_cpu_machine_reset_cb, cpu); > qemu_get_timedate(&tm, 0); > env->tod_offset =3D TOD_UNIX_EPOCH + > (time2tod(mktimegm(&tm)) * 1000000000ULL); > @@ -232,7 +236,6 @@ static void s390_cpu_initfn(Object *obj) > env->cpu_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_cpu_timer,= cpu); > s390_cpu_set_state(CPU_STATE_STOPPED, cpu); > #endif > - env->cpu_num =3D cpu_num++; >=20 > if (tcg_enabled() && !inited) { > inited =3D true; Hmm, two things a) env is not needed in this patch b) This patch breaks cpu creation temporarily (cpu number rework). cpu_num = is always 0 - a problem at east for tcg. You should introduce scc->next_cpu_id in this patch, cpu->id can be left in the error handling patch. David