diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2017-11-30 20:21:42 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2017-11-30 20:21:42 +0000 |
commit | 82f08449567f0aab34e6d47294f968f2d50f62a8 (patch) | |
tree | 283148fd63c36175c3046cd8164365053af56e68 | |
parent | aea6d042a9e9631e21fd070134f2f2298a8e0a01 (diff) |
Properly skip the first CPU. It only accidentally worked because the
CPU_FOREACH() loop always starts from BSP (cpu0) and the if condition
is always false for APs.
Reported by: cem
Notes
Notes:
svn path=/head/; revision=326407
-rw-r--r-- | sys/x86/cpufreq/hwpstate.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/x86/cpufreq/hwpstate.c b/sys/x86/cpufreq/hwpstate.c index 74e72948c522..ab90ac2b3277 100644 --- a/sys/x86/cpufreq/hwpstate.c +++ b/sys/x86/cpufreq/hwpstate.c @@ -167,10 +167,8 @@ static int hwpstate_goto_pstate(device_t dev, int id) { sbintime_t sbt; - int i; uint64_t msr; - int j; - int limit; + int cpu, i, j, limit; /* get the current pstate limit */ msr = rdmsr(MSR_AMD_10H_11H_LIMIT); @@ -178,8 +176,8 @@ hwpstate_goto_pstate(device_t dev, int id) if (limit > id) id = limit; - HWPSTATE_DEBUG(dev, "setting P%d-state on cpu%d\n", id, - PCPU_GET(cpuid)); + cpu = curcpu; + HWPSTATE_DEBUG(dev, "setting P%d-state on cpu%d\n", id, cpu); /* Go To Px-state */ wrmsr(MSR_AMD_10H_11H_CONTROL, id); @@ -188,7 +186,7 @@ hwpstate_goto_pstate(device_t dev, int id) * Probably should take _PSD into account. */ CPU_FOREACH(i) { - if (i == PCPU_GET(cpuid)) + if (i == cpu) continue; /* Bind to each cpu. */ |