From: Thomas Gleixner <tglx@kernel.org>
To: salil.mehta@opnsrc.net, Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
James Morse <james.morse@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Mark Rutland <mark.rutland@arm.com>,
Jinjie Ruan <ruanjinjie@huawei.com>,
Yicong Yang <yangyicong@hisilicon.com>,
Jonathan Corbet <corbet@lwn.net>, Gavin Shan <gshan@redhat.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org,
Salil Mehta <salil.mehta@opnsrc.net>
Subject: Re: [RFC PATCH 1/2] cpu/hotplug: Skip disabled CPUs in cpuhp_smt_enable
Date: Fri, 16 Oct 2026 23:53:12 +0200 [thread overview]
Message-ID: <874ielcnxz.ffs@fw13> (raw)
In-Reply-To: <4ca071f1678acd1d3b8ecc0266938f59b45f629a.1790692295.git.salil.mehta@opnsrc.net>
On Tue, Sep 29 2026 at 19:41, salil.mehta@opnsrc.net wrote:
> From: Salil Mehta <salil.mehta@opnsrc.net>
>
> The CPU enabled mask describes whether a present CPU may currently be
> brought online. cpuhp_smt_enable() is an online operation, but currently
> walks all present CPUs and only filters CPUs that are already online or
> belong to offline NUMA nodes.
>
> This can make it attempt _cpu_up() for a present CPU which firmware has
> not enabled and which has not yet been registered as a CPU device.
>
> Use the enabled mask for the policy decision it was introduced to
> represent. This keeps present-but-disabled CPUs out of the SMT bring-up
> path while still allowing registered offline SMT threads to be brought
> back online.
>
> Present and enabled are separate generic CPU states, so callers which
> intend to bring CPUs online should not assume that every present CPU is
> enabled.
The 'enabled mask' was introduced two years ago to deal with the ARM64
oddity of present, but disabled CPUs, which nobody else needs. So yes,
it's generic in some sense, but that's not the argument to be made here.
The argument is that present CPUs might not be set in the enabled mask
and therefore cannot be brought online.
> Signed-off-by: Salil Mehta <salil.mehta@opnsrc.net>
> ---
> kernel/cpu.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index b3c8553d7bd6..988b7a1e8298 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -2706,8 +2706,9 @@ int cpuhp_smt_enable(void)
> cpu_maps_update_begin();
> cpu_smt_control = CPU_SMT_ENABLED;
> for_each_present_cpu(cpu) {
> - /* Skip online CPUs and CPUs on offline nodes */
> - if (cpu_online(cpu) || !node_online(cpu_to_node(cpu)))
> + /* Skip online/disabled CPUs and CPUs on offline nodes */
> + if (cpu_online(cpu) || !cpu_enabled(cpu) ||
> + !node_online(cpu_to_node(cpu)))
Seriously?
What's wrong with the obvious one-liner:
- for_each_present_cpu(cpu) {
+ for_each_enabled_cpu(cpu) {
That would be too self explaining, right?
But that change is only a small subset of the overall story because now
the hotplug core looks at enabled mask in one place while all the other
places still utilize present mask.
With your second patch, that will then try to bring up present, but
disabled CPUs in bringup_nonboot_cpus(), which might be a silent fail or
not. The other instances which use present mask are probably silently
skipped due to the hotplug state.
Just because you did not observe a warning due to that does not mean
it's correct.
Thanks,
tglx
next prev parent reply other threads:[~2026-10-16 21:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 19:41 [RFC PATCH 0/2] cpu/hotplug: use cpu_enabled_mask for SMT bringup salil.mehta
2026-09-29 19:41 ` [RFC PATCH 1/2] cpu/hotplug: Skip disabled CPUs in cpuhp_smt_enable salil.mehta
2026-09-29 20:16 ` Bradley Morgan
2026-09-30 8:42 ` Salil Mehta
2026-10-16 21:53 ` Thomas Gleixner [this message]
2026-09-29 19:41 ` [RFC PATCH 2/2] Revert "cpu/hotplug: Fix NULL kobject warning in cpuhp_smt_enable()" salil.mehta
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=874ielcnxz.ffs@fw13 \
--to=tglx@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=gshan@redhat.com \
--cc=james.morse@arm.com \
--cc=jic23@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peterz@infradead.org \
--cc=ruanjinjie@huawei.com \
--cc=salil.mehta@opnsrc.net \
--cc=will@kernel.org \
--cc=yangyicong@hisilicon.com \
/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