public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: processor: Add acpi_processor_start() back to parse _CPC tables before CPU online
@ 2026-01-20 11:32 Lifeng Zheng
  2026-01-27 14:42 ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Lifeng Zheng @ 2026-01-20 11:32 UTC (permalink / raw)
  To: rafael, catalin.marinas, Jonathan.Cameron, lenb
  Cc: linux-acpi, linux-kernel, linuxarm, gshan, miguel.luis, guohanjun,
	zhanjie9, lihuisong, yubowen8, zhangpengjie2, wangzhi12,
	linhongye, zhenglifeng1

Currently, if boot with maxcpus less than NR_CPUS, the cppc_cpufreq driver
will fail to register. Because it requires the domain information of all
possible CPUs to construct shared_cpu_map, which shows the CPUs that share
the same domain.

Commit c1385c1f0ba3 ("ACPI: processor: Simplify initial onlining to use
same path for cold and hotplug") removes probe() of acpi_processor_driver
and makes acpi_cppc_processor_probe() only being called the first time CPU
goes online. This means that CPUs that haven't yet gone online will not
have pre-parsed _CPC objects and causes cppc_cpufreq driver register fail.

Add acpi_processor_start() back as the probe() callback of
acpi_processor_driver and call acpi_cppc_processor_probe() in it to make
sure all _CPC tables will be parsed when acpi_processor_driver registered.

Fixes: c1385c1f0ba3 ("ACPI: processor: Simplify initial onlining to use same path for cold and hotplug")
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
---
 drivers/acpi/processor_driver.c | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 65e779be64ff..c8b4daf580b0 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -33,6 +33,7 @@ MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION("ACPI Processor Driver");
 MODULE_LICENSE("GPL");
 
+static int acpi_processor_start(struct device *dev);
 static int acpi_processor_stop(struct device *dev);
 
 static const struct acpi_device_id processor_device_ids[] = {
@@ -46,6 +47,7 @@ static struct device_driver acpi_processor_driver = {
 	.name = "processor",
 	.bus = &cpu_subsys,
 	.acpi_match_table = processor_device_ids,
+	.probe = acpi_processor_start,
 	.remove = acpi_processor_stop,
 };
 
@@ -162,10 +164,6 @@ static int __acpi_processor_start(struct acpi_device *device)
 	if (!pr)
 		return -ENODEV;
 
-	result = acpi_cppc_processor_probe(pr);
-	if (result && !IS_ENABLED(CONFIG_ACPI_CPU_FREQ_PSS))
-		dev_dbg(&device->dev, "CPPC data invalid or not present\n");
-
 	if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver)
 		acpi_processor_power_init(pr);
 
@@ -192,6 +190,30 @@ static int __acpi_processor_start(struct acpi_device *device)
 	return result;
 }
 
+static int acpi_processor_start(struct device *dev)
+{
+	struct acpi_device *device = ACPI_COMPANION(dev);
+	struct acpi_processor *pr;
+	int result;
+
+	if (!device)
+		return -ENODEV;
+
+	pr = acpi_driver_data(device);
+	if (!pr)
+		return -ENODEV;
+
+	/* Protect against concurrent CPU hotplug operations */
+	cpu_hotplug_disable();
+	result = acpi_cppc_processor_probe(pr);
+	cpu_hotplug_enable();
+
+	if (result && !IS_ENABLED(CONFIG_ACPI_CPU_FREQ_PSS))
+		dev_dbg(&device->dev, "CPPC data invalid or not present\n");
+
+	return 0;
+}
+
 static int acpi_processor_stop(struct device *dev)
 {
 	struct acpi_device *device = ACPI_COMPANION(dev);
-- 
2.33.0


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

end of thread, other threads:[~2026-04-02  8:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-20 11:32 [PATCH] ACPI: processor: Add acpi_processor_start() back to parse _CPC tables before CPU online Lifeng Zheng
2026-01-27 14:42 ` Rafael J. Wysocki
2026-01-27 16:58   ` Jonathan Cameron
2026-01-27 18:00     ` Rafael J. Wysocki
2026-01-29 12:45       ` zhenglifeng (A)
2026-02-06  9:57         ` zhenglifeng (A)
2026-04-02  8:36           ` zhenglifeng (A)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox