From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLOP5-0002Yn-0e for qemu-devel@nongnu.org; Fri, 08 Jul 2016 01:32:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLOP1-0007RP-MO for qemu-devel@nongnu.org; Fri, 08 Jul 2016 01:32:42 -0400 Date: Fri, 8 Jul 2016 15:25:33 +1000 From: David Gibson Message-ID: <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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dngyMJhgXGAL5Gb8" Content-Disposition: inline In-Reply-To: <20160707181131.3d9926fc@bahia.lan> 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: Greg Kurz Cc: Bharata B Rao , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, imammedo@redhat.com, nikunj@linux.vnet.ibm.com, pbonzini@redhat.com --dngyMJhgXGAL5Gb8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 part > > 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 happens > 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 *de= v, 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 id = */ >=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. No, we don't. Cores have had a stable ID since they were introduced. Instead we should be setting the thread stable ids based on the core stable id. > I think stable_cpu_id is the prerequisite to compute both cpu_dt_id and i= nstance_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 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --dngyMJhgXGAL5Gb8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXfzlNAAoJEGw4ysog2bOSWHwQALY1dbk6vPzPoKATvL41xZk9 t36+32VAnpCQ/vAuRwxA9fCZRlpUleAQwxayhUfRuq0hVjeJ6DAjNbw3wlAi7ckX Oa0sl8UAfJDdWMwbWvN3ABdylzMieVwRoLmOvKE9HVPNOISq9XJ3DnRXpXGWdgFe wPyT63qiUFyddXtg5dJoaSblcG+0o5aPNzFzuUSpoGbaNRWx85piESPsaYS/tDsm sPPUOxGL5sbojjb4WI/1zBGp5qQxh8pK0q+v7c3kbkeNWQEr+YLb3JkwCckd8GHR jmF4kfC1BAB/BVyLz5TtB1q7NKvJYEKLTRwfLm1FO7XOe8I/GShB1dbJjj8HCtBN smxGfC3zt5cT6ZQL3pOZDKxxpt+fe6Ya+GMaofktzNit7AjCv/KWmppKfhv4PFWm oiLG6hTTTtUpLZEtyuCILKupesjeUyUZ9ejssbLLM+6yNZTwrnCbYUd270TJkb4J oKEjwvHBsiCPRXnZO9Fd4NoYxf/Q+DUKDHvF9jw8tRywzq2UJTbdE8lGp3N0pgO2 /ZJMBbBzKHnlRDI60wTcIg7BIkttM3+uOI/zbDUL3RB1mneGbvlHl/Eh8m4zedPy Jc268lsdVTxxK+sYfMnBkm3btcqp5WCMTnpMyi6SKkvanXSy7MAOhAothPfkATL6 +7/Y4Oii2pW+RtOcjh3I =gAp6 -----END PGP SIGNATURE----- --dngyMJhgXGAL5Gb8--