Skip to contentSkip to conversation

ACPI: processor: Move arch_init_invariance_cppc() call later

PATCH Superseded Mario Limonciello 2 participants 3 messages Oct 29, 2024 – Oct 31, 2024

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: processor: Move arch_init_invariance_cppc() call later

From: Mario Limonciello <[email protected]>

arch_init_invariance_cppc() is called at the end of acpi_cppc_processor_probe() in order to configure frequency invariance based upon the values from _CPC.

This however doesn't work on AMD CPPC shared memory designs that have AMD preferred cores enabled because _CPC needs to be analyzed from all cores to judge if preferred cores are enabled.

This issue manifests to users as a warning since commit 21fb59ab4b97 ("ACPI: CPPC: Adjust debug messages in amd_set_max_freq_ratio() to warn"):

```
Could not retrieve highest performance (-19)
```

However the warning isn't the cause of this, it was actually commit 279f838a61f9 ("x86/amd: Detect preferred cores in amd_get_boost_ratio_numerator()") which exposed the issue.

To fix this problem, push the call to the arch_init_invariance_cppc() macro to the end of acpi_processor_driver_init().

Fixes 279f838a61f9 ("x86/amd: Detect preferred cores in amd_get_boost_ratio_numerator()")
---
 drivers/acpi/cppc_acpi.c        | 2 --
 drivers/acpi/processor_driver.c | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/acpi/cppc_acpi.c +0 -2
index c3fc2c05d8687..f8614771bf32b 100644
@@ -905,8 +905,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
 		goto out_free;
 	}
 
-	arch_init_invariance_cppc();
-
 	kfree(output.pointer);
 	return 0;
 
drivers/acpi/processor_driver.c +1 -0
index cb52dd000b958..59620e7bc6647 100644
@@ -270,6 +270,7 @@ static int __init acpi_processor_driver_init(void)
 				  NULL, acpi_soft_cpu_dead);
 
 	acpi_processor_throttling_init();
+	arch_init_invariance_cppc();
 	return 0;
 err:
 	driver_unregister(&acpi_processor_driver);
Signature · 1 line
2.43.0
#1 lore raw
kernel test robot noticed the following build errors:

Hi Mario,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge linus/master v6.12-rc5 next-20241031] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/ACPI-processor-Move-arch_init_invariance_cppc-call-later/20241030-015107
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20241029174910.600482-1-superm1%40kernel.org
patch subject: [PATCH] ACPI: processor: Move arch_init_invariance_cppc() call later
config: riscv-randconfig-r071-20241031 (https://download.01.org/0day-ci/archive/20241031/[email protected]/config)
compiler: riscv64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241031/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/acpi/processor_driver.c: In function 'acpi_processor_driver_init':

>> drivers/acpi/processor_driver.c:273:9: error: implicit declaration of function 'arch_init_invariance_cppc' [-Wimplicit-function-declaration]
     273 |         arch_init_invariance_cppc();
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for GET_FREE_REGION Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=y]

vim +/arch_init_invariance_cppc +273 drivers/acpi/processor_driver.c

239
240 /*
241 * We keep the driver loaded even when ACPI is not running.
242 * This is needed for the powernow-k8 driver, that works even without
243 * ACPI, but needs symbols from this driver
244 */
245 static enum cpuhp_state hp_online;
246 static int __init acpi_processor_driver_init(void)
247 {
248 int result = 0;
249
250 if (acpi_disabled)
251 return 0;
252
253 if (!cpufreq_register_notifier(&acpi_processor_notifier_block,
254 CPUFREQ_POLICY_NOTIFIER)) {
255 acpi_processor_cpufreq_init = true;
256 acpi_processor_ignore_ppc_init();
257 }
258
259 result = driver_register(&acpi_processor_driver);
260 if (result < 0)
261 return result;
262
263 result = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
264 "acpi/cpu-drv:online",
265 acpi_soft_cpu_online, NULL);
266 if (result < 0)
267 goto err;
268 hp_online = result;
269 cpuhp_setup_state_nocalls(CPUHP_ACPI_CPUDRV_DEAD, "acpi/cpu-drv:dead",
270 NULL, acpi_soft_cpu_dead);
271
272 acpi_processor_throttling_init();

 > 273		arch_init_invariance_cppc();

274 return 0;
275 err:
276 driver_unregister(&acpi_processor_driver);
277 return result;
278 }
279

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#2 lore raw
In reply to Mario Limonciello
kernel test robot noticed the following build errors:

Hi Mario,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge linus/master v6.12-rc5 next-20241031] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/ACPI-processor-Move-arch_init_invariance_cppc-call-later/20241030-015107
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20241029174910.600482-1-superm1%40kernel.org
patch subject: [PATCH] ACPI: processor: Move arch_init_invariance_cppc() call later
config: i386-randconfig-141-20241031 (https://download.01.org/0day-ci/archive/20241031/[email protected]/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241031/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/acpi/processor_driver.c:273:2: error: call to undeclared function 'arch_init_invariance_cppc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     273 |         arch_init_invariance_cppc();
         |         ^

1 error generated.

vim +/arch_init_invariance_cppc +273 drivers/acpi/processor_driver.c

239
240 /*
241 * We keep the driver loaded even when ACPI is not running.
242 * This is needed for the powernow-k8 driver, that works even without
243 * ACPI, but needs symbols from this driver
244 */
245 static enum cpuhp_state hp_online;
246 static int __init acpi_processor_driver_init(void)
247 {
248 int result = 0;
249
250 if (acpi_disabled)
251 return 0;
252
253 if (!cpufreq_register_notifier(&acpi_processor_notifier_block,
254 CPUFREQ_POLICY_NOTIFIER)) {
255 acpi_processor_cpufreq_init = true;
256 acpi_processor_ignore_ppc_init();
257 }
258
259 result = driver_register(&acpi_processor_driver);
260 if (result < 0)
261 return result;
262
263 result = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
264 "acpi/cpu-drv:online",
265 acpi_soft_cpu_online, NULL);
266 if (result < 0)
267 goto err;
268 hp_online = result;
269 cpuhp_setup_state_nocalls(CPUHP_ACPI_CPUDRV_DEAD, "acpi/cpu-drv:dead",
270 NULL, acpi_soft_cpu_dead);
271
272 acpi_processor_throttling_init();

 > 273		arch_init_invariance_cppc();

274 return 0;
275 err:
276 driver_unregister(&acpi_processor_driver);
277 return result;
278 }
279

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki