From: Sudeep Holla <sudeep.holla@kernel.org>
To: driver-core@lists.linux.dev
Cc: Sudeep Holla <sudeep.holla@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH v3 3/4] arch_topology: Reset SMT state when topology is unavailable
Date: Mon, 9 Nov 2026 17:31:24 +0000 [thread overview]
Message-ID: <20261109173125.1734847-4-sudeep.holla@kernel.org> (raw)
In-Reply-To: <20261109173125.1734847-1-sudeep.holla@kernel.org>
If DT has no CPU information or cpu-map, parsing succeeds without
notifying the SMT framework. A later topology validation failure can
discard parsed data while leaving the SMT thread count set by
parse_socket().
Reset the count to one on these paths so the SMT framework matches
the topology that remains available.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-486a8656-d962-4966-8d90-bbb2ce276147
Fixes: 5deb9c789ae4 ("arch_topology: Support SMT control for OF based system")
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
---
drivers/base/arch_topology.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index eea4c4257d08..c439fc91270d 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -662,6 +662,7 @@ static int __init parse_dt_topology(void)
if (!cn) {
pr_err("No CPU information found in DT\n");
+ cpu_smt_set_num_threads(1, 1);
return 0;
}
@@ -672,8 +673,10 @@ static int __init parse_dt_topology(void)
struct device_node *map __free(device_node) =
of_get_child_by_name(cn, "cpu-map");
- if (!map)
+ if (!map) {
+ cpu_smt_set_num_threads(1, 1);
return ret;
+ }
ret = parse_socket(map);
if (ret != 0)
@@ -951,6 +954,7 @@ void __init init_cpu_topology(void)
* arch-specific early cache level detection a chance to run.
*/
reset_cpu_topology();
+ cpu_smt_set_num_threads(1, 1);
}
for_each_possible_cpu(cpu) {
--
2.43.0
next prev parent reply other threads:[~2026-11-09 17:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 17:31 [PATCH v3 0/4] arch_topology: Bunch of error patch related fixes Sudeep Holla
2026-11-09 17:31 ` [PATCH v3 1/4] arch_topology: Reset SMT state when socket parsing fails Sudeep Holla
2026-11-09 17:31 ` [PATCH v3 2/4] arch_topology: Free ACPI SMT entries on lookup failure Sudeep Holla
2026-11-09 17:31 ` Sudeep Holla [this message]
2026-11-09 17:31 ` [PATCH v3 4/4] arch_topology: Free raw_capacity when topology parsing fails Sudeep Holla
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=20261109173125.1734847-4-sudeep.holla@kernel.org \
--to=sudeep.holla@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=sashiko-bot@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