Date: Sun, 11 May 2014 10:32:58 +0000 (UTC) From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265876 - head/sys/kern Message-ID: <201405111032.s4BAWwBI002438@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cperciva Date: Sun May 11 10:32:58 2014 New Revision: 265876 URL: http://svnweb.freebsd.org/changeset/base/265876 Log: In cf_get_method, when we don't already know what clock speed the CPU is running at, guess the nearest value instead of looking for a value within 25 MHz of the observed frequency. Prior to this change, if a system booted with Intel Turbo Boost enabled, the dev.cpu.0.freq sysctl is nonfunctional, since the ACPI-reported frequency for Turbo Boost states does not match the actual clock frequency (and thus no levels are within 25 MHz of the observed frequency) and the current performance level is read before a new level is set. MFC after: 3 days Relnotes: Bug fix in power management on CPUs with Intel Turbo Boost Modified: head/sys/kern/kern_cpu.c Modified: head/sys/kern/kern_cpu.c ============================================================================== --- head/sys/kern/kern_cpu.c Sun May 11 10:06:27 2014 (r265875) +++ head/sys/kern/kern_cpu.c Sun May 11 10:32:58 2014 (r265876) @@ -418,7 +418,7 @@ cf_get_method(device_t dev, struct cf_le struct cf_setting *curr_set, set; struct pcpu *pc; device_t *devs; - int count, error, i, n, numdevs; + int bdiff, count, diff, error, i, n, numdevs; uint64_t rate; sc = device_get_softc(dev); @@ -494,14 +494,15 @@ cf_get_method(device_t dev, struct cf_le } cpu_est_clockrate(pc->pc_cpuid, &rate); rate /= 1000000; + bdiff = 1 << 30; for (i = 0; i < count; i++) { - if (CPUFREQ_CMP(rate, levels[i].total_set.freq)) { + diff = abs(levels[i].total_set.freq - rate); + if (diff < bdiff) { + bdiff = diff; sc->curr_level = levels[i]; - CF_DEBUG("get estimated freq %d\n", curr_set->freq); - goto out; } } - error = ENXIO; + CF_DEBUG("get estimated freq %d\n", curr_set->freq); out: if (error == 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405111032.s4BAWwBI002438>