From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLQV2-0005oQ-Kr for qemu-devel@nongnu.org; Fri, 08 Jul 2016 03:47:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLQUz-0005b7-Bm for qemu-devel@nongnu.org; Fri, 08 Jul 2016 03:47:00 -0400 Received: from 5.mo69.mail-out.ovh.net ([46.105.43.105]:59294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLQUz-0005b2-06 for qemu-devel@nongnu.org; Fri, 08 Jul 2016 03:46:57 -0400 Received: from player779.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo69.mail-out.ovh.net (Postfix) with ESMTP id 09A9A101103B for ; Fri, 8 Jul 2016 09:46:56 +0200 (CEST) Date: Fri, 8 Jul 2016 09:46:47 +0200 From: Greg Kurz Message-ID: <20160708094647.6267415c@bahia.lan> In-Reply-To: <20160708052533.GN14675@voom.fritz.box> References: <1467903025-13383-1-git-send-email-bharata@linux.vnet.ibm.com> <1467903025-13383-4-git-send-email-bharata@linux.vnet.ibm.com> <20160707181131.3d9926fc@bahia.lan> <20160708052533.GN14675@voom.fritz.box> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/j8BHp36OjknEWXWXARc6zNW"; protocol="application/pgp-signature" Subject: Re: [Qemu-devel] [RFC PATCH v2 3/5] spapr: Set stable_cpu_id for threads of CPU cores List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: Bharata B Rao , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, imammedo@redhat.com, nikunj@linux.vnet.ibm.com, pbonzini@redhat.com --Sig_/j8BHp36OjknEWXWXARc6zNW Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 8 Jul 2016 15:25:33 +1000 David Gibson wrote: > On Thu, Jul 07, 2016 at 06:11:31PM +0200, Greg Kurz wrote: > > On Thu, 7 Jul 2016 20:20:23 +0530 > > Bharata B Rao wrote: > > =20 > > > Conditonally set stable_cpu_id for CPU threads that are created as pa= rt > > > of spapr CPU cores. The use of stable_cpu_id is enabled for pseries-2= .7 > > > onwards. > > > =20 > >=20 > > The last sentence is a bit confusing since the enablement actually happ= ens > > in patch 5/5. > > =20 > > > Signed-off-by: Bharata B Rao > > > --- > > > hw/ppc/spapr_cpu_core.c | 7 +++++++ > > > 1 file changed, 7 insertions(+) > > >=20 > > > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c > > > index b104778..0ec3513 100644 > > > --- a/hw/ppc/spapr_cpu_core.c > > > +++ b/hw/ppc/spapr_cpu_core.c > > > @@ -293,8 +293,15 @@ static void spapr_cpu_core_realize(DeviceState *= dev, Error **errp) > > > for (i =3D 0; i < cc->nr_threads; i++) { > > > char id[32]; > > > obj =3D sc->threads + i * size; > > > + CPUState *cs; > > > =20 > > > object_initialize(obj, size, typename); > > > + cs =3D CPU(obj); > > > + > > > + /* Use core_id (which is actually cpu_dt_id) as stable CPU i= d */ =20 > >=20 > > It isn't what I had in mind. More something like below: > >=20 > > In ppc_spapr_init(): > >=20 > > for (i =3D 0; i < spapr_max_cores; i++) { > > spapr->cores[i]->stable_id =3D i * smp_threads; > > } > >=20 > >=20 > > In spapr_cpu_core_realize(): > >=20 > > for (j =3D 0; j < cc->nr_threads; j++) { > > stable_cpu_id =3D cc->stable_id + j; > > } > >=20 > > So we need to introduce cc->stable_id. =20 >=20 > No, we don't. Cores have had a stable ID since they were introduced. >=20 I agree core_dt_id is stable but it is a DT concept. static void ppc_spapr_init(MachineState *machine) { [...] for (i =3D 0; i < spapr_max_cores; i++) { int core_dt_id =3D i * smt; [...] object_property_set_int(core, core_dt_id, CPU_CORE_PROP_COR= E_ID, &error_fatal); This patch produces stable_cpu_id in the [0...smt * smp_cores) range. I fin= d it awkward it depends on the host setup. I'm suggesting we introduce cc->stable_id to be able to compute a simple stable_cpu_id in the range [0...max_cpus), like x86 and ARM. > Instead we should be setting the thread stable ids based on the core > stable id. >=20 > > I think stable_cpu_id is the prerequisite to compute both cpu_dt_id and= instance_id. > >=20 > > Makes sense ? > > =20 > > > + if (cs->has_stable_cpu_id) { > > > + cs->stable_cpu_id =3D cc->core_id + i; > > > + } > > > snprintf(id, sizeof(id), "thread[%d]", i); > > > object_property_add_child(OBJECT(sc), id, obj, &local_err); > > > if (local_err) { =20 > > =20 >=20 --Sig_/j8BHp36OjknEWXWXARc6zNW Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAld/WmcACgkQAvw66wEB28JZswCfepS4Q92+5FsnwlprWiYY/JQG 2wMAn22y75Ned6N+OnVNKGMYsA5YnG/t =SgWL -----END PGP SIGNATURE----- --Sig_/j8BHp36OjknEWXWXARc6zNW--