From: Dou Liyang <douly.fnst@cn.fujitsu.com>
To: Samuel Neves <sneves@dei.uc.pt>, <tglx@linutronix.de>,
<mingo@redhat.com>, <hpa@zytor.com>, <x86@kernel.org>,
<jgross@suse.com>, <luto@kernel.org>, <prarit@redhat.com>,
<ak@linux.intel.com>, <vkuznets@redhat.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] smpboot: correctly update number of booted cores
Date: Thu, 22 Feb 2018 16:07:24 +0800 [thread overview]
Message-ID: <12fc2cb0-aeb8-a74e-2524-1ca97fa043a8@cn.fujitsu.com> (raw)
In-Reply-To: <20180221205036.5244-1-sneves@dei.uc.pt>
At 02/22/2018 04:50 AM, Samuel Neves wrote:
> Without this fix, /proc/cpuinfo will display an incorrect amount
> of CPU cores, after bringing them offline and online again, as
> exemplified below:
>
> $ cat /proc/cpuinfo | grep cores
> cpu cores : 4
> cpu cores : 8
> cpu cores : 8
> cpu cores : 20
> cpu cores : 4
> cpu cores : 3
> cpu cores : 2
> cpu cores : 2
>
> This patch fixes this by always zeroing the booted_cores variable
> upon turning off a logical CPU.
>
> Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
Yes, tested it in Qemu with 15 hot-pluggable CPUs, like below
...
-smp 1,maxcpus=16,sockets=2,cores=4,threads=2
...
When a new CPU bringups a new core, for each core in package, Linux
increments the booted_cores for this new cpu in set_cpu_sibling_map().
Due to the uncleared booted_cores, this incorrect number of CPU cores
will be shown.
Tested-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
> ---
> arch/x86/kernel/smpboot.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 9eee25d07586..ff99e2b6fc54 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -1437,6 +1437,7 @@ static void remove_siblinginfo(int cpu)
> cpumask_clear(topology_sibling_cpumask(cpu));
> cpumask_clear(topology_core_cpumask(cpu));
> c->cpu_core_id = 0;
> + c->booted_cores = 0;
> cpumask_clear_cpu(cpu, cpu_sibling_setup_mask);
> recompute_smt_state();
> }
>
next prev parent reply other threads:[~2018-02-22 8:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 20:50 Samuel Neves
2018-02-22 8:07 ` Dou Liyang [this message]
2018-02-23 8:29 ` [tip:x86/urgent] x86/topology: Update the 'cpu cores' field in /proc/cpuinfo correctly across CPU hotplug operations tip-bot for Samuel Neves
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=12fc2cb0-aeb8-a74e-2524-1ca97fa043a8@cn.fujitsu.com \
--to=douly.fnst@cn.fujitsu.com \
--cc=ak@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=prarit@redhat.com \
--cc=sneves@dei.uc.pt \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®