History

Revert "x86: CPU: Fix up "cpu MHz" in /proc/cpuinfo"

This reverts commit 941f5f0f6ef5338814145cf2b813cf1f98873e2f. Sadly, it turns out that we really can't just do the cross-CPU IPI to all CPU's to get their proper frequencies, because it's much too expensive on systems with lots of cores. So we'll have to revert this for now, and revisit it using a smarter model (probably doing one system-wide IPI at open time, and doing all the frequency calculations in parallel).

Linus Torvalds committed 9 years ago

Commit ea0ee331 parent 3e812773 files · +6 −11Browse files

Unified · Split

3 files
  1. arch/x86/kernel/cpu/Makefile +1 −1
  2. arch/x86/kernel/cpu/aperfmperf.c +4 −7
  3. arch/x86/kernel/cpu/proc.c +1 −3
arch/x86/kernel/cpu/Makefile+1−1
@@ -22,7 +22,7 @@ obj-y += common.o · 21 unmodified lines
22obj-y += rdrand.o22obj-y += rdrand.o
23obj-y += match.o23obj-y += match.o
24obj-y += bugs.o24obj-y += bugs.o
25obj-y += aperfmperf.o25obj-$(CONFIG_CPU_FREQ) += aperfmperf.o
26 26
27obj-$(CONFIG_PROC_FS) += proc.o27obj-$(CONFIG_PROC_FS) += proc.o
28obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o28obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
arch/x86/kernel/cpu/aperfmperf.c+4−7
@@ -42,6 +42,10 @@ static void aperfmperf_snapshot_khz(void *dummy) · 41 unmodified lines
42 s64 time_delta = ktime_ms_delta(now, s->time);42 s64 time_delta = ktime_ms_delta(now, s->time);
43 unsigned long flags;43 unsigned long flags;
44 44
45 /* Don't bother re-computing within the cache threshold time. */
46 if (time_delta < APERFMPERF_CACHE_THRESHOLD_MS)
47 return;
48
45 local_irq_save(flags);49 local_irq_save(flags);
46 rdmsrl(MSR_IA32_APERF, aperf);50 rdmsrl(MSR_IA32_APERF, aperf);
47 rdmsrl(MSR_IA32_MPERF, mperf);51 rdmsrl(MSR_IA32_MPERF, mperf);
@@ -70,7 +74,6 @@ static void aperfmperf_snapshot_khz(void *dummy) · 22 unmodified lines
70 74
71unsigned int arch_freq_get_on_cpu(int cpu)75unsigned int arch_freq_get_on_cpu(int cpu)
72{76{
73 s64 time_delta;
74 unsigned int khz;77 unsigned int khz;
75 78
76 if (!cpu_khz)79 if (!cpu_khz)
@@ -79,12 +82,6 @@ unsigned int arch_freq_get_on_cpu(int cpu) · 2 unmodified lines
79 if (!static_cpu_has(X86_FEATURE_APERFMPERF))82 if (!static_cpu_has(X86_FEATURE_APERFMPERF))
80 return 0;83 return 0;
81 84
82 /* Don't bother re-computing within the cache threshold time. */
83 time_delta = ktime_ms_delta(ktime_get(), per_cpu(samples.time, cpu));
84 khz = per_cpu(samples.khz, cpu);
85 if (khz && time_delta < APERFMPERF_CACHE_THRESHOLD_MS)
86 return khz;
87
88 smp_call_function_single(cpu, aperfmperf_snapshot_khz, NULL, 1);85 smp_call_function_single(cpu, aperfmperf_snapshot_khz, NULL, 1);
89 khz = per_cpu(samples.khz, cpu);86 khz = per_cpu(samples.khz, cpu);
90 if (khz)87 if (khz)
arch/x86/kernel/cpu/proc.c+1−3
@@ -78,10 +78,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) · 77 unmodified lines
78 seq_printf(m, "microcode\t: 0x%x\n", c->microcode);78 seq_printf(m, "microcode\t: 0x%x\n", c->microcode);
79 79
80 if (cpu_has(c, X86_FEATURE_TSC)) {80 if (cpu_has(c, X86_FEATURE_TSC)) {
81 unsigned int freq = arch_freq_get_on_cpu(cpu);81 unsigned int freq = cpufreq_quick_get(cpu);
82 82
83 if (!freq)
84 freq = cpufreq_quick_get(cpu);
85 if (!freq)83 if (!freq)
86 freq = cpu_khz;84 freq = cpu_khz;
87 seq_printf(m, "cpu MHz\t\t: %u.%03u\n",85 seq_printf(m, "cpu MHz\t\t: %u.%03u\n",