diff options
author | Andreas Herrmann <andreas.herrmann3@amd.com> | 2007-11-01 14:32:17 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@apollo.(none)> | 2007-11-17 10:27:00 -0500 |
commit | c0c52d28e05e8bdaa2126570c02ecb1a7358cecc (patch) | |
tree | 70fc7c4a75760d8b7c8d9e2c53cf5f4484017a4c | |
parent | 903675569e278af86aa08c2af238b0ab997065d1 (diff) |
x86: show cpuinfo only for online CPUs
Fix regressions introduced with 92cb7612aee39642d109b8d935ad265e602c0563.
It can happen that cpuinfo is displayed for CPUs that are not online or
even worse for CPUs not present at all. As an example, following was
shown for a "second" CPU of a single core K8 variant:
processor : 0
vendor_id : unknown
cpu family : 0
model : 0
model name : unknown
stepping : 0
cache size : 0 KB
fpu : yes
fpu_exception : yes
cpuid level : 0
wp : yes
flags :
bogomips : 0.00
clflush size : 0
cache_alignment : 0
address sizes : 0 bits physical, 0 bits virtual
power management:
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/kernel/cpu/proc.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/setup_64.c | 8 |
2 files changed, 6 insertions, 10 deletions
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index 066f8c6af4df..3900e46d66db 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c | |||
@@ -89,8 +89,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
89 | int fpu_exception; | 89 | int fpu_exception; |
90 | 90 | ||
91 | #ifdef CONFIG_SMP | 91 | #ifdef CONFIG_SMP |
92 | if (!cpu_online(n)) | ||
93 | return 0; | ||
94 | n = c->cpu_index; | 92 | n = c->cpu_index; |
95 | #endif | 93 | #endif |
96 | seq_printf(m, "processor\t: %d\n" | 94 | seq_printf(m, "processor\t: %d\n" |
@@ -177,14 +175,14 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
177 | static void *c_start(struct seq_file *m, loff_t *pos) | 175 | static void *c_start(struct seq_file *m, loff_t *pos) |
178 | { | 176 | { |
179 | if (*pos == 0) /* just in case, cpu 0 is not the first */ | 177 | if (*pos == 0) /* just in case, cpu 0 is not the first */ |
180 | *pos = first_cpu(cpu_possible_map); | 178 | *pos = first_cpu(cpu_online_map); |
181 | if ((*pos) < NR_CPUS && cpu_possible(*pos)) | 179 | if ((*pos) < NR_CPUS && cpu_online(*pos)) |
182 | return &cpu_data(*pos); | 180 | return &cpu_data(*pos); |
183 | return NULL; | 181 | return NULL; |
184 | } | 182 | } |
185 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | 183 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) |
186 | { | 184 | { |
187 | *pos = next_cpu(*pos, cpu_possible_map); | 185 | *pos = next_cpu(*pos, cpu_online_map); |
188 | return c_start(m, pos); | 186 | return c_start(m, pos); |
189 | } | 187 | } |
190 | static void c_stop(struct seq_file *m, void *v) | 188 | static void c_stop(struct seq_file *m, void *v) |
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 238633d3d09a..3cb3874489be 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
@@ -1078,8 +1078,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1078 | 1078 | ||
1079 | 1079 | ||
1080 | #ifdef CONFIG_SMP | 1080 | #ifdef CONFIG_SMP |
1081 | if (!cpu_online(c->cpu_index)) | ||
1082 | return 0; | ||
1083 | cpu = c->cpu_index; | 1081 | cpu = c->cpu_index; |
1084 | #endif | 1082 | #endif |
1085 | 1083 | ||
@@ -1171,15 +1169,15 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1171 | static void *c_start(struct seq_file *m, loff_t *pos) | 1169 | static void *c_start(struct seq_file *m, loff_t *pos) |
1172 | { | 1170 | { |
1173 | if (*pos == 0) /* just in case, cpu 0 is not the first */ | 1171 | if (*pos == 0) /* just in case, cpu 0 is not the first */ |
1174 | *pos = first_cpu(cpu_possible_map); | 1172 | *pos = first_cpu(cpu_online_map); |
1175 | if ((*pos) < NR_CPUS && cpu_possible(*pos)) | 1173 | if ((*pos) < NR_CPUS && cpu_online(*pos)) |
1176 | return &cpu_data(*pos); | 1174 | return &cpu_data(*pos); |
1177 | return NULL; | 1175 | return NULL; |
1178 | } | 1176 | } |
1179 | 1177 | ||
1180 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | 1178 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) |
1181 | { | 1179 | { |
1182 | *pos = next_cpu(*pos, cpu_possible_map); | 1180 | *pos = next_cpu(*pos, cpu_online_map); |
1183 | return c_start(m, pos); | 1181 | return c_start(m, pos); |
1184 | } | 1182 | } |
1185 | 1183 | ||