qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: aik@ozlabs.ru, mdroth@linux.vnet.ibm.com
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [RFCv2 1/2] pseries: Fix incorrect calculation of threads per socket for chip-id
Date: Fri, 4 Sep 2015 14:56:41 +1000	[thread overview]
Message-ID: <20150904045641.GS6537@voom.redhat.com> (raw)
In-Reply-To: <1441342300-28318-2-git-send-email-david@gibson.dropbear.id.au>

[-- Attachment #1: Type: text/plain, Size: 2513 bytes --]

On Fri, Sep 04, 2015 at 02:51:39PM +1000, David Gibson wrote:
> The device tree presented to pseries machine type guests includes an
> ibm,chip-id property which gives essentially the socket number of each
> vcpu core (individual vcpu threads don't get a node in the device
> tree).
> 
> To calculate this, it uses a vcpus_per_socket variable computed as
> (smp_cpus / #sockets).  This is correct for the usual case where
> smp_cpus == smp_threads * smp_cores * #sockets.
> 
> However, you can start QEMU with the number of cores and threads
> mismatching the total number of vcpus (whether that _should_ be
> permitted is a topic for another day).  It's a bit hard to say what
> the "real" number of vcpus per socket here is, but for most purposes
> (smp_threads * smp_cores) will more meaningfully match how QEMU
> behaves with respect to socket boundaries.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Gah, sorry, there's a compile error in this.  I got sidetracked
between writing and posting and forgot I hadn't fixed it yet.

> ---
>  hw/ppc/spapr.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 783763f..dbc295b 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -595,8 +595,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
>      uint32_t page_sizes_prop[64];
>      size_t page_sizes_prop_size;
>      QemuOpts *opts = qemu_opts_find(qemu_find_opts("smp-opts"), NULL);
> -    unsigned sockets = opts ? qemu_opt_get_number(opts, "sockets", 0) : 0;
> -    uint32_t cpus_per_socket = sockets ? (smp_cpus / sockets) : 1;
> +    uint32_t vcpus_per_socket = smp_threads * smp_cores;
>      uint32_t pft_size_prop[] = {0, cpu_to_be32(spapr->htab_shift)};
>  
>      _FDT((fdt_setprop_cell(fdt, offset, "reg", index)));
> @@ -665,7 +664,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
>      }
>  
>      _FDT((fdt_setprop_cell(fdt, offset, "ibm,chip-id",
> -                           cs->cpu_index / cpus_per_socket)));
> +                           cs->cpu_index / vcpus_per_socket)));
>  
>      _FDT((fdt_setprop(fdt, offset, "ibm,pft-size",
>                        pft_size_prop, sizeof(pft_size_prop))));

-- 
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

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-09-04  4:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-04  4:51 [Qemu-devel] [RFCv2 0/2] Don't allocate vcpus on the same guest socket to different NUMA nodes David Gibson
2015-09-04  4:51 ` [Qemu-devel] [RFCv2 1/2] pseries: Fix incorrect calculation of threads per socket for chip-id David Gibson
2015-09-04  4:56   ` David Gibson [this message]
2015-09-05 10:12     ` Alexey Kardashevskiy
2015-09-04  4:51 ` [Qemu-devel] [RFCv2 2/2] spapr: Fix default NUMA node allocation for threads David Gibson
2015-09-05 10:12   ` Alexey Kardashevskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150904045641.GS6537@voom.redhat.com \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).