All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: TPMI: clean up CPU mappings on offline
@ 2026-11-04  3:27 lirongqing
  2026-11-04 15:30 ` Srinivas Pandruvada
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: lirongqing @ 2026-11-04  3:27 UTC (permalink / raw)
  To: Hans de Goede, Ilpo Järvinen, Kristen Carlson Accardi,
	Srinivas Pandruvada, Li RongQing, Tero Kristo, Andy Shevchenko,
	platform-driver-x86

From: Li RongQing <lirongqing@baidu.com>

The TPMI power domain driver adds each online CPU to a hash table and
its power domain mask, but does not remove either entry when the CPU
goes offline. Bringing a CPU back online can therefore insert the same
hlist node again and leave stale CPU mask state.

Register an offline callback that removes the hash entry and clears the
CPU from its power domain mask.

Fixes: 17ca2780458c ("platform/x86/intel: TPMI domain id and CPU mapping")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/platform/x86/intel/tpmi_power_domains.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel/tpmi_power_domains.c b/drivers/platform/x86/intel/tpmi_power_domains.c
index d89b989..c3fd1bd 100644
--- a/drivers/platform/x86/intel/tpmi_power_domains.c
+++ b/drivers/platform/x86/intel/tpmi_power_domains.c
@@ -220,6 +220,23 @@ static int tpmi_cpu_online(unsigned int cpu)
 	return 0;
 }
 
+static int tpmi_cpu_offline(unsigned int cpu)
+{
+	struct tpmi_cpu_info *info = &per_cpu(tpmi_cpu_info, cpu);
+	int index;
+
+	if (hlist_unhashed(&info->hnode) || !tpmi_domain_is_valid(info))
+		return 0;
+
+	index = info->pkg_id * MAX_POWER_DOMAINS + info->punit_domain_id;
+
+	guard(mutex)(&tpmi_lock);
+	cpumask_clear_cpu(cpu, &tpmi_power_domain_mask[index]);
+	hash_del(&info->hnode);
+
+	return 0;
+}
+
 static int __init tpmi_init(void)
 {
 	const struct x86_cpu_id *id;
@@ -249,7 +266,7 @@ static int __init tpmi_init(void)
 
 	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
 				"platform/x86/tpmi_power_domains:online",
-				tpmi_cpu_online, NULL);
+				tpmi_cpu_online, tpmi_cpu_offline);
 	if (ret < 0)
 		goto free_domain_map;
 
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-12 23:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  3:27 [PATCH] platform/x86: TPMI: clean up CPU mappings on offline lirongqing
2026-11-04 15:30 ` Srinivas Pandruvada
2026-11-05  3:09   ` 答复: [外部邮件] " Li,Rongqing
2026-11-05 16:00     ` srinivas pandruvada
2026-11-04 15:39 ` Andy Shevchenko
2026-11-12 23:49 ` srinivas pandruvada

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.