Date: Thu, 30 Nov 2017 20:21:42 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326407 - head/sys/x86/cpufreq Message-ID: <201711302021.vAUKLgNg016746@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Thu Nov 30 20:21:42 2017 New Revision: 326407 URL: https://svnweb.freebsd.org/changeset/base/326407 Log: 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 Modified: head/sys/x86/cpufreq/hwpstate.c Modified: head/sys/x86/cpufreq/hwpstate.c ============================================================================== --- head/sys/x86/cpufreq/hwpstate.c Thu Nov 30 17:58:48 2017 (r326406) +++ head/sys/x86/cpufreq/hwpstate.c Thu Nov 30 20:21:42 2017 (r326407) @@ -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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711302021.vAUKLgNg016746>