public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "zhangpengjie (A)" <zhangpengjie2@huawei.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: <will@kernel.org>, <maz@kernel.org>, <timothy.hayes@arm.com>,
	<lpieralisi@kernel.org>, <mrigendra.chaubey@gmail.com>,
	<arnd@arndb.de>, <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <zhanjie9@hisilicon.com>,
	<zhenglifeng1@huawei.com>, <lihuisong@huawei.com>,
	<yubowen8@huawei.com>, <linhongye@h-partners.com>,
	<linuxarm@huawei.com>, <wangzhi12@huawei.com>
Subject: Re: [PATCH v2] arm64: smp: Do not mark secondary CPUs possible under nosmp
Date: Thu, 30 Apr 2026 17:54:35 +0800	[thread overview]
Message-ID: <1b1b1319-2f98-4b5d-85ec-6fc4150b6f85@huawei.com> (raw)
In-Reply-To: <49f96032-6027-4c79-8d08-9545261e553f@huawei.com>


On 4/30/2026 5:34 PM, zhangpengjie (A) wrote:
>
> On 4/27/2026 9:20 PM, Catalin Marinas wrote:
>> On Thu, Apr 23, 2026 at 09:46:54PM +0800, Pengjie Zhang wrote:
>>> Under nosmp (maxcpus=0), arm64 never brings up secondary CPUs.
>>>
>>> However, arm64 still enumerates firmware-described CPUs during SMP
>>> initialization, which can leave secondary CPUs visible to
>>> for_each_possible_cpu() users even though they never reach the
>>> bringup path in this configuration.
>>>
>>> This is not just a cosmetic mask mismatch: code iterating over
>>> possible CPUs may observe secondary CPU per-CPU state that is never
>>> fully initialized under nosmp.
>> I'm fine with the patch in principle but I fail to see why it is not
>> mostly cosmetic. If we have possible & !present CPUs (there's another
>> thread around cpuhp_smt_enable() to allow this combination on arm64),
>> get_cpu_device() would return NULL and the core code is supposed to
>> handle this. What other per-CPU state should be initialised for a
>> possible CPU but it is not without this patch?
> Yes, possible-but-not-present CPUs are valid in the general hotplug 
> model. The nosmp/maxcpus=0 case is different though: on arm64, 
> smp_prepare_cpus() treats this as a UP-mandated boot and returns 
> before marking secondary CPUs present, so these CPUs are deliberately 
> kept out of the bringup path for this boot. The kind of issue I had in 
> mind was subsystem-owned per-CPU state where iteration follows 
> cpu_possible_mask but the state is populated only from CPU 
> online/probe paths. The CPPC nosmp issue fixed by commit 15eece6c5b05 
> ("ACPI: CPPC: Fix NULL pointer dereference when nosmp is used") was 
> the kind of mismatch I was thinking of, although CPPC itself has 
> already been fixed to use online CPUs where appropriate. I agree the 
> changelog overstates this. I can respin with a toned-down changelog if 
> you prefer.

I'm very sorry, there was an issue with the format above.
I'm reattaching the response below.

Yes, possible-but-not-present CPUs are valid in the general hotplug
model. The nosmp/maxcpus=0 case is different though: on arm64,
smp_prepare_cpus() treats this as a UP-mandated boot and returns before
marking secondary CPUs present, so these CPUs are deliberately kept out of
the bringup path for this boot.

The kind of issue I had in mind was subsystem-owned per-CPU state where
iteration follows cpu_possible_mask but the state is populated only from
CPU online/probe paths. The CPPC nosmp issue fixed by commit 15eece6c5b05
("ACPI: CPPC: Fix NULL pointer dereference when nosmp is used") was the
kind of mismatch I was thinking of, although CPPC itself has already been
fixed to use online CPUs where appropriate.

I agree the changelog overstates this. I can respin with a toned-down
changelog if you prefer.




  reply	other threads:[~2026-04-30  9:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 13:46 [PATCH v2] arm64: smp: Do not mark secondary CPUs possible under nosmp Pengjie Zhang
2026-04-27 13:20 ` Catalin Marinas
2026-04-30  9:34   ` zhangpengjie (A)
2026-04-30  9:54     ` zhangpengjie (A) [this message]
2026-05-01 14:16       ` Catalin Marinas

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=1b1b1319-2f98-4b5d-85ec-6fc4150b6f85@huawei.com \
    --to=zhangpengjie2@huawei.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=lihuisong@huawei.com \
    --cc=linhongye@h-partners.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lpieralisi@kernel.org \
    --cc=maz@kernel.org \
    --cc=mrigendra.chaubey@gmail.com \
    --cc=timothy.hayes@arm.com \
    --cc=wangzhi12@huawei.com \
    --cc=will@kernel.org \
    --cc=yubowen8@huawei.com \
    --cc=zhanjie9@hisilicon.com \
    --cc=zhenglifeng1@huawei.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