Commit 872f2710 authored by Alexander Gordeev's avatar Alexander Gordeev Committed by Vasily Gorbik

s390/cpuinfo: fix wrong output when CPU0 is offline

/proc/cpuinfo should not print information about CPU 0 when it is offline.

Fixes: 281eaa8c ("s390/cpuinfo: simplify locking and skip offline cpus early")
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
[heiko.carstens@de.ibm.com: shortened commit message]
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 2db52dc3
...@@ -188,8 +188,9 @@ static void show_cpu_mhz(struct seq_file *m, unsigned long n) ...@@ -188,8 +188,9 @@ static void show_cpu_mhz(struct seq_file *m, unsigned long n)
static int show_cpuinfo(struct seq_file *m, void *v) static int show_cpuinfo(struct seq_file *m, void *v)
{ {
unsigned long n = (unsigned long) v - 1; unsigned long n = (unsigned long) v - 1;
unsigned long first = cpumask_first(cpu_online_mask);
if (!n) if (n == first)
show_cpu_summary(m, v); show_cpu_summary(m, v);
if (!machine_has_cpu_mhz) if (!machine_has_cpu_mhz)
return 0; return 0;
...@@ -204,6 +205,8 @@ static inline void *c_update(loff_t *pos) ...@@ -204,6 +205,8 @@ static inline void *c_update(loff_t *pos)
{ {
if (*pos) if (*pos)
*pos = cpumask_next(*pos - 1, cpu_online_mask); *pos = cpumask_next(*pos - 1, cpu_online_mask);
else
*pos = cpumask_first(cpu_online_mask);
return *pos < nr_cpu_ids ? (void *)*pos + 1 : NULL; return *pos < nr_cpu_ids ? (void *)*pos + 1 : NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment