]> git.baikalelectronics.ru Git - kernel.git/commit
x86: CPU: Fix up "cpu MHz" in /proc/cpuinfo
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 3 Nov 2017 15:35:49 +0000 (16:35 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 3 Nov 2017 15:50:13 +0000 (08:50 -0700)
commit196c485c4d860757b3d27675326067db333af508
treeb5bfebf297b5213cb5ef96af994c5cc84b64e9bb
parentad0e25716e5a909aebc23c3bbd2bb38a4571c8e9
x86: CPU: Fix up "cpu MHz" in /proc/cpuinfo

Commit f92ede7a7a01 (Revert "x86: do not use cpufreq_quick_get() for
/proc/cpuinfo "cpu MHz"") is not sufficient to restore the previous
behavior of "cpu MHz" in /proc/cpuinfo on x86 due to some changes
made after the commit it has reverted.

To address this, make the code in question use arch_freq_get_on_cpu()
which also is used by cpufreq for reporting the current frequency of
CPUs and since that function doesn't really depend on cpufreq in any
way, drop the CONFIG_CPU_FREQ dependency for the object file
containing it.

Also refactor arch_freq_get_on_cpu() somewhat to avoid IPIs and
return cached values right away if it is called very often over a
short time (to prevent user space from triggering IPI storms through
it).

Fixes: f92ede7a7a01 (Revert "x86: do not use cpufreq_quick_get() for /proc/cpuinfo "cpu MHz"")
Cc: stable@kernel.org # 4.13 - together with f92ede7a7a01
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86/kernel/cpu/Makefile
arch/x86/kernel/cpu/aperfmperf.c
arch/x86/kernel/cpu/proc.c