From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGeDy-0000di-UZ for qemu-devel@nongnu.org; Wed, 28 Jan 2015 20:48:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGeDu-0000Yt-6t for qemu-devel@nongnu.org; Wed, 28 Jan 2015 20:48:50 -0500 Received: from ozlabs.org ([103.22.144.67]:44136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGeDt-0000YK-Sn for qemu-devel@nongnu.org; Wed, 28 Jan 2015 20:48:46 -0500 Date: Thu, 29 Jan 2015 12:36:55 +1100 From: David Gibson Message-ID: <20150129013655.GR14681@voom> References: <1420697420-16053-1-git-send-email-bharata@linux.vnet.ibm.com> <1420697420-16053-8-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rG09A39trvEtf3rB" Content-Disposition: inline In-Reply-To: <1420697420-16053-8-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v1 07/13] spapr: Start all the threads of CPU core when core is hotplugged List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: imammedo@redhat.com, agraf@suse.de, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com --rG09A39trvEtf3rB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 08, 2015 at 11:40:14AM +0530, Bharata B Rao wrote: > PowerPC kernel adds or removes CPUs in core granularity and hence > onlines/offlines all the SMT threads of a core during hot plug/unplug. > Support this notion by starting all SMT threads of a core when a core > is hotplugged. >=20 > Signed-off-by: Bharata B Rao > --- > hw/ppc/spapr.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index a293a59..4347471 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -1376,6 +1376,8 @@ static void spapr_drc_reset(void *opaque) > } > } > =20 > +static const char *current_cpu_model; More new global variables? Please don't. > /* pSeries LPAR / sPAPR hardware init */ > static void ppc_spapr_init(MachineState *machine) > { > @@ -1473,6 +1475,8 @@ static void ppc_spapr_init(MachineState *machine) > } > } > =20 > + current_cpu_model =3D cpu_model; > + > /* allocate RAM */ > spapr->ram_limit =3D ram_size; > spapr->maxram_limit =3D machine->maxram_size; > @@ -1912,10 +1916,31 @@ static void spapr_cpu_plug(HotplugHandler *hotplu= g_dev, DeviceState *dev, > PowerPCCPU *cpu =3D POWERPC_CPU(cs); > sPAPRDRConnector *drc =3D > spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, cpu->cpu_d= t_id); > + int id =3D ppc_get_vcpu_dt_id(cpu); > + int smt =3D kvmppc_smt_threads(); > + int i; > + > + /* > + * SMT threads return from here, only main thread (core) will > + * continue, create threads and signal hotplug event to the guest. > + */ > + if ((id % smt) !=3D 0) { > + return; > + } > =20 > /* TODO: Check if DR is enabled ? */ > g_assert(drc); > =20 > + /* Start rest of the SMT threads of the hot plugged core */ > + for (i =3D 1; i < smp_threads; i++) { > + cpu =3D cpu_ppc_init(current_cpu_model); > + if (cpu =3D=3D NULL) { > + fprintf(stderr, "Unable to find PowerPC CPU definition\n"); > + exit(1); > + } > + spapr_cpu_reset(cpu); > + } > + > spapr_cpu_reset(POWERPC_CPU(CPU(dev))); > spapr_cpu_hotplug_add(dev, cs); > spapr_hotplug_req_add_event(drc); --=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 --rG09A39trvEtf3rB Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUyY63AAoJEGw4ysog2bOSr2YP/i+tCI9tvJgU/vLI04ymLFqb mn+3ZsLE15vOb8Qx5Z0Yan3lXdtVr2+TxH/vkd3OWAWMM2Je+wo3F3wOExILGCTH RPLieYXSbgm5HIbXDHhyJ4YiEmmylYAzEBbzydoR3r4C6PUQOkoK9rWXLHxfBBKz vUTQjjdMX+JlyIEl02vOg//8SRKvdonl147Zb+UVDCUyEEDQ21pKa/GEb2m2k/hT MIlGRALZLTEyvjnj0ab38Jy/GUJtN1/2/gev0Q1bsP9yGRM0WzaRBAznzWbnQSJn 3vSNTfuDxIcfWp8ngZ5hrddZhK3LgEZWx4cPhflHxcUx/0i9CQsfz3MwKkhZ0avP zE69ZAj+tw/E/xHdm2zKVkoxIw5sEEBS2aIUvVljBfJIoJzlhfUT4iXiHUiIEYSc qaoSl63DPajj4avFwYpNIXqJGUYhSkfGxQ8cliAoWMGIRU/xoUJ1EQuw/0Nm0U+w gYBNvNEon4DwfLG6tsHw1gFBVcM/7mfT3Sd6ik0eY64eR2iG5M5TYfY0PC/cz2zj p6rVcuK/tqWyMqvZeDulCidymfZEb2uCPyUloI5NYe3BQsfERXVX1Ej6l9pnTXLO 4+jO0H/f8s/pjeMkPmyy/iHwYTnDvZ6cpGH7jV0iwGcRDuu+ggLTmRtKFkwN3EUq XqgbJ5zmxCqOc3RcIXHm =msh0 -----END PGP SIGNATURE----- --rG09A39trvEtf3rB--