All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Neves <sneves@dei.uc.pt>
To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, jgross@suse.com, douly.fnst@cn.fujitsu.com,
	luto@kernel.org, prarit@redhat.com, ak@linux.intel.com,
	vkuznets@redhat.com, linux-kernel@vger.kernel.org
Cc: Samuel Neves <sneves@dei.uc.pt>
Subject: [PATCH] smpboot: correctly update number of booted cores
Date: Wed, 21 Feb 2018 20:50:36 +0000	[thread overview]
Message-ID: <20180221205036.5244-1-sneves@dei.uc.pt> (raw)

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>
---
 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();
 }
-- 
2.14.3

             reply	other threads:[~2018-02-21 20:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 20:50 Samuel Neves [this message]
2018-02-22  8:07 ` [PATCH] smpboot: correctly update number of booted cores Dou Liyang
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=20180221205036.5244-1-sneves@dei.uc.pt \
    --to=sneves@dei.uc.pt \
    --cc=ak@linux.intel.com \
    --cc=douly.fnst@cn.fujitsu.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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.