Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] cpufreq: intel_pstate: Use raw_smp_processor_id() in hwp_get_cpu_scaling()
@ 2025-04-12 10:34 Xi Ruoyao
  2025-04-13 14:44 ` srinivas pandruvada
  0 siblings, 1 reply; 6+ messages in thread
From: Xi Ruoyao @ 2025-04-12 10:34 UTC (permalink / raw)
  To: Srinivas Pandruvada, Rafael J. Wysocki, Pawan Gupta, Dave Hansen
  Cc: linux-pm, linux-kernel, Xi Ruoyao

Use raw_smp_processor_id() instead of plain smp_processor_id() in
hwp_get_cpu_scaling(), otherwise we get some errors on a Lenovo Thinkpad
T14P Gen 2:

    BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
    caller is hwp_get_cpu_scaling+0x7f/0xc0

Fixes: b52aaeeadfac ("cpufreq: intel_pstate: Avoid SMP calls to get cpu-type")
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 drivers/cpufreq/intel_pstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 4aad79d26c64..bfc20b978240 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2209,7 +2209,7 @@ static int knl_get_turbo_pstate(int cpu)
 static int hwp_get_cpu_scaling(int cpu)
 {
 	if (hybrid_scaling_factor) {
-		struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());
+		struct cpuinfo_x86 *c = &cpu_data(raw_smp_processor_id());
 		u8 cpu_type = c->topo.intel_type;
 
 		/*
-- 
2.49.0


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

end of thread, other threads:[~2025-04-14 16:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-12 10:34 [PATCH] cpufreq: intel_pstate: Use raw_smp_processor_id() in hwp_get_cpu_scaling() Xi Ruoyao
2025-04-13 14:44 ` srinivas pandruvada
2025-04-14 15:19   ` Rafael J. Wysocki
2025-04-14 15:26     ` srinivas pandruvada
2025-04-14 15:27       ` Rafael J. Wysocki
2025-04-14 16:41     ` Pawan Gupta

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