From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXlJS-0000Zh-FD for qemu-devel@nongnu.org; Fri, 04 Sep 2015 03:21:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXlJR-0000uc-D0 for qemu-devel@nongnu.org; Fri, 04 Sep 2015 03:21:30 -0400 Date: Fri, 4 Sep 2015 17:01:05 +1000 From: David Gibson Message-ID: <20150904070105.GB6537@voom.redhat.com> References: <1438838837-28504-1-git-send-email-bharata@linux.vnet.ibm.com> <1438838837-28504-10-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UhXv5VeBZ/Y8lRnC" Content-Disposition: inline In-Reply-To: <1438838837-28504-10-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v4 09/11] spapr: Support topologies with unfilled cores List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: mdroth@linux.vnet.ibm.com, aik@ozlabs.ru, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, imammedo@redhat.com, afaerber@suse.de --UhXv5VeBZ/Y8lRnC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 06, 2015 at 10:57:15AM +0530, Bharata B Rao wrote: > QEMU currently supports CPU topologies where there can be cores > which are not completely filled with all the threads as per the > specifed SMT mode. >=20 > Restore support for such topologies (Eg -smp 15,cores=3D4,threads=3D4) > The last core will always have the deficit even when -device options are > used to cold-plug the cores. >=20 > Signed-off-by: Bharata B Rao Is there a reason to support these silly toplogies, or should we just error out if this is specified? > --- > hw/ppc/spapr.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 74637b3..004a8e1 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -94,6 +94,8 @@ > =20 > #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) > =20 > +static int smp_remaining_cpus; > + > static XICSState *try_create_xics(const char *type, int nr_servers, > int nr_irqs, Error **errp) > { > @@ -1700,6 +1702,7 @@ static void ppc_spapr_init(MachineState *machine) > int smp_max_cores =3D DIV_ROUND_UP(max_cpus, smp_threads); > int smp_cores =3D DIV_ROUND_UP(smp_cpus, smp_threads); > =20 > + smp_remaining_cpus =3D smp_cpus; > msi_supported =3D true; > =20 > QLIST_INIT(&spapr->phbs); > @@ -2202,6 +2205,7 @@ static void spapr_cpu_plug(HotplugHandler *hotplug_= dev, DeviceState *dev, > Error *local_err =3D NULL; > void *fdt =3D NULL; > int i, fdt_offset =3D 0; > + int threads_per_core; > =20 > /* Set NUMA node for the added CPUs */ > for (i =3D 0; i < nb_numa_nodes; i++) { > @@ -2224,8 +2228,22 @@ static void spapr_cpu_plug(HotplugHandler *hotplug= _dev, DeviceState *dev, > return; > } > =20 > + /* Create SMT threads of the core. > + * > + * Support topologies like -smp 15,cores=3D4,threads=3D4 where one c= ore > + * will have less than the specified SMT threads. The last core will > + * always have the deficit even when -device options are used to > + * cold-plug the cores. > + */ > + if ((smp_remaining_cpus > 0) && (smp_remaining_cpus < smp_threads)) { > + threads_per_core =3D smp_remaining_cpus; > + } else { > + threads_per_core =3D smp_threads; > + } > + smp_remaining_cpus -=3D threads_per_core; > + > /* Create SMT threads of the core. */ > - for (i =3D 1; i < smp_threads; i++) { > + for (i =3D 1; i < threads_per_core; i++) { > cpu =3D cpu_ppc_init(current_machine->cpu_model); > if (!cpu) { > error_report("Unable to find PowerPC CPU definition: %s", --=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 --UhXv5VeBZ/Y8lRnC Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJV6UGxAAoJEGw4ysog2bOSFswP/iMFjlz7u3iwm12XjOj1efTP dewUmeYfj6Dr2JAAuR1ht+ravQ8G/ZtuTvSuWdXpC5JxEIu/lVKldUyuIgUasUs/ lN1lKqVe1RjGYscB+Qg4uCk8iIorOfVvsHfVZIUKvDEGWc/oLsRkVYikz2g0lLIQ n9Vn2bwsXEwLvMY24+m4KavHsg22a0kSMUN1txLLsRQh720Dki0Hw8qVmlJatJhi /U5/ABM5qD7ABWrMp26dhNjHnDXliPLerTn+NpLBBzAU5p13OOi8beclILnkZvB0 mX5tf6DJg5Rced8BknKiujZjRTG66Y3Uwbr985aZTGUxKHRn6PFnQp8KySyLtccv AMf9tMLbEgbrO79ROVLbNFlDMXbq/SPWLkDBStijMy/sxlbRX7dR1trSC7pzdgQS yVbI2JwFW0CEt664aQwfZaIzyxvcXszeokrJnmDGqOWdkHh40TKQg+sDWMsmZutT TgtlCEc94ysv6N1TOht416sSlSKN1oFzBGfuoVvyrvIYOkbfvyWKXDm6eOEXMcyW /ZahpDZT8GZVGDEzlMybnGe1NF804Me7RPKtpSTg+Nr/3UHs52+AhTmTZPC7jv5l g515hrlROuzPIySreJkQL2zaZCXTuqW78Xcipq6nx0pIkn/96pxtKa7kE/IYsnWG SLQh3Li4EFAiPQ9UhCqN =GKIO -----END PGP SIGNATURE----- --UhXv5VeBZ/Y8lRnC--