From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCejg-0003Tv-RU for qemu-devel@nongnu.org; Mon, 13 Jun 2016 23:09:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCeje-0008S3-Gw for qemu-devel@nongnu.org; Mon, 13 Jun 2016 23:09:51 -0400 Date: Tue, 14 Jun 2016 13:03:41 +1000 From: David Gibson Message-ID: <20160614030341.GJ4882@voom.fritz.box> References: <1465580427-13596-1-git-send-email-drjones@redhat.com> <1465580427-13596-11-git-send-email-drjones@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yr/DzoowOgTDcSCF" Content-Disposition: inline In-Reply-To: <1465580427-13596-11-git-send-email-drjones@redhat.com> Subject: Re: [Qemu-devel] [PATCH RFC 10/16] hw/ppc/spapr: don't use smp_cores, smp_threads List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Jones Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, imammedo@redhat.com, ehabkost@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, dgibson@redhat.com, agraf@suse.de --yr/DzoowOgTDcSCF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 10, 2016 at 07:40:21PM +0200, Andrew Jones wrote: > Use CPUState nr_cores,nr_threads and MachineState > cores,threads instead. >=20 > Signed-off-by: Andrew Jones > --- > hw/ppc/spapr.c | 9 +++++---- > hw/ppc/spapr_rtas.c | 2 +- > 2 files changed, 6 insertions(+), 5 deletions(-) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 063664234106e..f78276bb4b164 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -35,7 +35,6 @@ > #include "net/net.h" > #include "sysemu/device_tree.h" > #include "sysemu/block-backend.h" > -#include "sysemu/cpus.h" > #include "sysemu/kvm.h" > #include "sysemu/device_tree.h" > #include "kvm_ppc.h" > @@ -603,7 +602,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void = *fdt, int offset, > uint32_t cpufreq =3D kvm_enabled() ? kvmppc_get_clockfreq() : 100000= 0000; > uint32_t page_sizes_prop[64]; > size_t page_sizes_prop_size; > - uint32_t vcpus_per_socket =3D smp_threads * smp_cores; > + uint32_t vcpus_per_socket =3D cs->nr_cores * cs->nr_threads; > uint32_t pft_size_prop[] =3D {0, cpu_to_be32(spapr->htab_shift)}; > =20 > /* Note: we keep CI large pages off for now because a 64K capable gu= est > @@ -1774,7 +1773,7 @@ static void ppc_spapr_init(MachineState *machine) > /* Set up Interrupt Controller before we create the VCPUs */ > spapr->icp =3D xics_system_init(machine, > DIV_ROUND_UP(max_cpus * kvmppc_smt_thr= eads(), > - smp_threads), > + machine->threads), > XICS_IRQS, &error_fatal); > =20 > if (smc->dr_lmb_enabled) { > @@ -2268,9 +2267,11 @@ static HotplugHandler *spapr_get_hotpug_handler(Ma= chineState *machine, > =20 > static unsigned spapr_cpu_index_to_socket_id(unsigned cpu_index) > { > + CPUState *cs =3D first_cpu; > + > /* Allocate to NUMA nodes on a "socket" basis (not that concept of > * socket means much for the paravirtualized PAPR platform) */ > - return cpu_index / smp_threads / smp_cores; > + return cpu_index / cs->nr_cores / cs->nr_threads; > } > =20 > static void spapr_machine_class_init(ObjectClass *oc, void *data) > diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c > index 43e2c684fda8d..3fdfbb01a20dd 100644 > --- a/hw/ppc/spapr_rtas.c > +++ b/hw/ppc/spapr_rtas.c > @@ -742,7 +742,7 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rt= as_addr, > lrdr_capacity[1] =3D cpu_to_be32(max_hotplug_addr & 0xffffffff); > lrdr_capacity[2] =3D 0; > lrdr_capacity[3] =3D cpu_to_be32(SPAPR_MEMORY_BLOCK_SIZE); > - lrdr_capacity[4] =3D cpu_to_be32(max_cpus/smp_threads); > + lrdr_capacity[4] =3D cpu_to_be32(max_cpus / machine->threads); > ret =3D qemu_fdt_setprop(fdt, "/rtas", "ibm,lrdr-capacity", lrdr_cap= acity, > sizeof(lrdr_capacity)); > if (ret < 0) { I think all the places that use cs->nr_* here it actually makes more sense to use the value in the machine state. --=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 --yr/DzoowOgTDcSCF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXX3QNAAoJEGw4ysog2bOSgtsQAOLuQPBzbDU4BGtowsGHTLl3 KvjHZv0J+fNOFwexC8sPFC8Zva/+51R9a4h8bmIGGdTByqXMsIN3ipr5JeeFUhNC jBLJ9EcVPtWw+Eonh78kW4J6NINEU38/zoCi3Fz1zzxMIp4MWobzuj/N5cGQiUun W5HRonBFXaPT9+Hlem6fTFoNYS1FVCinvtt5blwyBkBkZFbJrbcSIoSN6sEJ3UCz oODmus66V/WZQ3CmGwRU61SmS4KP9zF7lXDy9S3+ALd9sZewhpTjm7MMEy2d3pcd 5UsdPw41mryUg5Vy2yCe1wEcY10RcNCiy0qGi9WlSj1H0kOtn5qrwGJ6RDUD4kF/ nlh3eDEW0E0tAHy2DF+Mqnr6cur4yRpswp/DHVFFqKDYMrfL7S1e4NwbyKPBkd41 TNoKNx7wvgo+VasdoYyOghQpraXkncEnXYTIBprpwidrD9t6ZNWp/z/4SKJd/jlt TJv/JqeCKRX1V9Bre3u1uVinSAMXZRu6+fEC0cjkExWJde44yhuTpj75kV6Z7hXH nZ4psH/9ubyvsaHW/UPaQMdLJwV+GUJDf3e13s/CDOv/i8HDL15bS1yowxEsefaQ 3z/5IJcRULagKmpeUPOe2xUC6xKmGekoQJB2CD+/xU4B9+SdRRhqbz7l4keqrZRJ nL++7dkpzes1XpfqWgRm =WjpQ -----END PGP SIGNATURE----- --yr/DzoowOgTDcSCF--