From: sashiko-bot@kernel.org
To: "Mete Durlu" <meted@linux.ibm.com>
Cc: "Alexander Gordeev" <agordeev@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390/smp: Reflect (de)configured CPUs to cpu_enabled_mask
Date: Thu, 23 Jul 2026 13:56:15 +0000 [thread overview]
Message-ID: <20260723135616.491651F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260723-enabled_cpus-v1-1-3a2cbdc374b0@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Logical CPU ID fragmentation causes smp_get_base_cpu() to return incorrect siblings, leading to unsafe core deconfiguration.
--
--- Patch [1]: [PATCH] s390/smp: Reflect (de)configured CPUs to cpu_enabled_mask ---
commit d82385b96c4cbe6b55b4a0446d3eeb4e2c122fa2
Author: Mete Durlu <meted@linux.ibm.com>
s390/smp: Reflect (de)configured CPUs to cpu_enabled_mask
On s390, CPUs can be in a state where it is not possible to hotplug
them online before certain prequisite steps. This commit adds necessary
checks to smp_add_core() and userspace configure attribute handlers to
reflect the configured CPUs to cpu_enabled_mask.
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index 0ba7f89b81611..e0c9480c7bd24 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -1039,6 +1039,7 @@ static ssize_t cpu_configure_store(struct device *dev,
> per_cpu(pcpu_devices, cpu + i).state = CPU_STATE_STANDBY;
> smp_cpu_set_polarization(cpu + i,
> POLARIZATION_UNKNOWN);
> + set_cpu_enabled(cpu + i, false);
[Severity: High]
This isn't a bug introduced by this patch, but does the base CPU calculation
safely handle logical CPU ID fragmentation?
If arch_register_cpu() previously failed (e.g., due to memory allocation)
for a thread during hotplug in smp_add_core(), cpu_present is cleared. Upon
the next CPU rescan, __smp_rescan_cpus() repopulates the avail mask with
this unaligned hole.
When a new core is added, it will consume this hole and subsequent bits for
its threads, resulting in unaligned logical CPU IDs. However,
smp_get_base_cpu() mathematically assumes rigid alignment:
arch/s390/include/asm/smp.h:smp_get_base_cpu() {
return cpu - (cpu % (smp_cpu_mtid + 1));
}
If a fragmented core is configured or deconfigured via sysfs, this
misalignment causes cpu_configure_store() to compute the wrong base CPU.
Could this lead to checking cpu_online() on unrelated CPUs, deconfiguring
the wrong hardware address via sclp_core_deconfigure(), and corrupting the
state and cpu_enabled_mask for unrelated CPUs?
> }
> topology_expect_change();
> break;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260723-enabled_cpus-v1-1-3a2cbdc374b0@linux.ibm.com?part=1
next prev parent reply other threads:[~2026-07-23 13:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 13:36 [PATCH] s390/smp: Reflect (de)configured CPUs to cpu_enabled_mask Mete Durlu
2026-07-23 13:56 ` sashiko-bot [this message]
2026-07-23 14:03 ` Heiko Carstens
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=20260723135616.491651F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=meted@linux.ibm.com \
--cc=sashiko-reviews@lists.linux.dev \
/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.