[PATCH] cpufreq: intel_pstate: Use raw_smp_processor_id() in hwp_get_cpu_scaling()
From: Xi Ruoyao
Date: Sat Apr 12 2025 - 06:35:32 EST
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@xxxxxxxxxxx>
---
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