Skip to content

Commit 890da9c

Browse files
committed
Revert "x86: do not use cpufreq_quick_get() for /proc/cpuinfo "cpu MHz""
This reverts commit 51204e0. There wasn't really any good reason for it, and people are complaining (rightly) that it broke existing practice. Cc: Len Brown <len.brown@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6daa083 commit 890da9c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

arch/x86/kernel/cpu/proc.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <linux/timex.h>
44
#include <linux/string.h>
55
#include <linux/seq_file.h>
6+
#include <linux/cpufreq.h>
67

78
/*
89
* Get CPU information for use by the procfs.
@@ -76,9 +77,14 @@ static int show_cpuinfo(struct seq_file *m, void *v)
7677
if (c->microcode)
7778
seq_printf(m, "microcode\t: 0x%x\n", c->microcode);
7879

79-
if (cpu_has(c, X86_FEATURE_TSC))
80+
if (cpu_has(c, X86_FEATURE_TSC)) {
81+
unsigned int freq = cpufreq_quick_get(cpu);
82+
83+
if (!freq)
84+
freq = cpu_khz;
8085
seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
81-
cpu_khz / 1000, (cpu_khz % 1000));
86+
freq / 1000, (freq % 1000));
87+
}
8288

8389
/* Cache size */
8490
if (c->x86_cache_size >= 0)

0 commit comments

Comments
 (0)