aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>2005-12-02 13:43:20 -0500
committerDave Jones <davej@redhat.com>2005-12-06 22:35:11 -0500
commit95235ca2c20ac0b31a8eb39e2d599bcc3e9c9a10 (patch)
treecdfbebe72a1563f1bfe16b0335da7f9ecb78a91d /arch
parent9a7d82a89a8bf55b112f2a5c3b3f405eb95a4303 (diff)
[CPUFREQ] CPU frequency display in /proc/cpuinfo
What is the value shown in "cpu MHz" of /proc/cpuinfo when CPUs are capable of changing frequency? Today the answer is: It depends. On i386: SMP kernel - It is always the boot frequency UP kernel - Scales with the frequency change and shows that was last set. On x86_64: There is one single variable cpu_khz that gets written by all the CPUs. So, the frequency set by last CPU will be seen on /proc/cpuinfo of all the CPUs in the system. What you see also depends on whether you have constant_tsc capable CPU or not. On ia64: It is always boot time frequency of a particular CPU that gets displayed. The patch below changes this to: Show the last known frequency of the particular CPU, when cpufreq is present. If cpu doesnot support changing of frequency through cpufreq, then boot frequency will be shown. The patch affects i386, x86_64 and ia64 architectures. Signed-off-by: Venkatesh Pallipadi<venkatesh.pallipadi@intel.com> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/cpu/proc.c6
-rw-r--r--arch/ia64/kernel/setup.c8
-rw-r--r--arch/x86_64/kernel/setup.c6
3 files changed, 17 insertions, 3 deletions
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c
index e7921315ae9d..6d91b274589c 100644
--- a/arch/i386/kernel/cpu/proc.c
+++ b/arch/i386/kernel/cpu/proc.c
@@ -3,6 +3,7 @@
3#include <linux/string.h> 3#include <linux/string.h>
4#include <asm/semaphore.h> 4#include <asm/semaphore.h>
5#include <linux/seq_file.h> 5#include <linux/seq_file.h>
6#include <linux/cpufreq.h>
6 7
7/* 8/*
8 * Get CPU information for use by the procfs. 9 * Get CPU information for use by the procfs.
@@ -86,8 +87,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
86 seq_printf(m, "stepping\t: unknown\n"); 87 seq_printf(m, "stepping\t: unknown\n");
87 88
88 if ( cpu_has(c, X86_FEATURE_TSC) ) { 89 if ( cpu_has(c, X86_FEATURE_TSC) ) {
90 unsigned int freq = cpufreq_quick_get(n);
91 if (!freq)
92 freq = cpu_khz;
89 seq_printf(m, "cpu MHz\t\t: %u.%03u\n", 93 seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
90 cpu_khz / 1000, (cpu_khz % 1000)); 94 freq / 1000, (freq % 1000));
91 } 95 }
92 96
93 /* Cache size */ 97 /* Cache size */
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 5add0bcf87a7..088e5dded8dc 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -43,6 +43,7 @@
43#include <linux/initrd.h> 43#include <linux/initrd.h>
44#include <linux/platform.h> 44#include <linux/platform.h>
45#include <linux/pm.h> 45#include <linux/pm.h>
46#include <linux/cpufreq.h>
46 47
47#include <asm/ia32.h> 48#include <asm/ia32.h>
48#include <asm/machvec.h> 49#include <asm/machvec.h>
@@ -517,6 +518,7 @@ show_cpuinfo (struct seq_file *m, void *v)
517 char family[32], features[128], *cp, sep; 518 char family[32], features[128], *cp, sep;
518 struct cpuinfo_ia64 *c = v; 519 struct cpuinfo_ia64 *c = v;
519 unsigned long mask; 520 unsigned long mask;
521 unsigned int proc_freq;
520 int i; 522 int i;
521 523
522 mask = c->features; 524 mask = c->features;
@@ -549,6 +551,10 @@ show_cpuinfo (struct seq_file *m, void *v)
549 sprintf(cp, " 0x%lx", mask); 551 sprintf(cp, " 0x%lx", mask);
550 } 552 }
551 553
554 proc_freq = cpufreq_quick_get(cpunum);
555 if (!proc_freq)
556 proc_freq = c->proc_freq / 1000;
557
552 seq_printf(m, 558 seq_printf(m,
553 "processor : %d\n" 559 "processor : %d\n"
554 "vendor : %s\n" 560 "vendor : %s\n"
@@ -565,7 +571,7 @@ show_cpuinfo (struct seq_file *m, void *v)
565 "BogoMIPS : %lu.%02lu\n", 571 "BogoMIPS : %lu.%02lu\n",
566 cpunum, c->vendor, family, c->model, c->revision, c->archrev, 572 cpunum, c->vendor, family, c->model, c->revision, c->archrev,
567 features, c->ppn, c->number, 573 features, c->ppn, c->number,
568 c->proc_freq / 1000000, c->proc_freq % 1000000, 574 proc_freq / 1000, proc_freq % 1000,
569 c->itc_freq / 1000000, c->itc_freq % 1000000, 575 c->itc_freq / 1000000, c->itc_freq % 1000000,
570 lpj*HZ/500000, (lpj*HZ/5000) % 100); 576 lpj*HZ/500000, (lpj*HZ/5000) % 100);
571#ifdef CONFIG_SMP 577#ifdef CONFIG_SMP
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 750e01dcbdf4..64c4534b930c 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -42,6 +42,7 @@
42#include <linux/edd.h> 42#include <linux/edd.h>
43#include <linux/mmzone.h> 43#include <linux/mmzone.h>
44#include <linux/kexec.h> 44#include <linux/kexec.h>
45#include <linux/cpufreq.h>
45 46
46#include <asm/mtrr.h> 47#include <asm/mtrr.h>
47#include <asm/uaccess.h> 48#include <asm/uaccess.h>
@@ -1256,8 +1257,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1256 seq_printf(m, "stepping\t: unknown\n"); 1257 seq_printf(m, "stepping\t: unknown\n");
1257 1258
1258 if (cpu_has(c,X86_FEATURE_TSC)) { 1259 if (cpu_has(c,X86_FEATURE_TSC)) {
1260 unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data));
1261 if (!freq)
1262 freq = cpu_khz;
1259 seq_printf(m, "cpu MHz\t\t: %u.%03u\n", 1263 seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
1260 cpu_khz / 1000, (cpu_khz % 1000)); 1264 freq / 1000, (freq % 1000));
1261 } 1265 }
1262 1266
1263 /* Cache size */ 1267 /* Cache size */