s390/cpuinfo: prevent warning when reading /proc/cpuinfo
Alexander Gordeev
maintainerPATCH 1/1 s390/cpuinfo: prevent warning when reading /proc/cpuinfo
Commit 78e5a3399421 ("cpumask: fix checking valid cpu range") has started issuing warnings when reading /proc/cpuinfo and config DEBUG_PER_CPU_MAPS is enabled. Avoid calling cpumask_next() with the cpu index equal to nr_cpu_ids - 1 and ensure no warning is generated.
--- arch/s390/kernel/processor.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kernel/processor.c +2 -0
@@ -334,6 +334,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)static inline void *c_update (loff_t *pos) { +if (*pos >= nr_cpu_ids) +return NULL ;if (*pos) *pos =cpumask_next (*pos -1 , cpu_online_mask);else
Signature · 1 line
2.34.1
Quoted 19 lines · Alexander Gordeev
Commit
78e5a3399421("cpumask: fix checking valid cpu range") has started issuing warnings when reading/proc/cpuinfoand configDEBUG_PER_CPU_MAPSis enabled. Avoid callingcpumask_next()with the cpu index equal tonr_cpu_ids- 1 and ensure no warning is generated.Reported-by Andrew Jones <[email protected]>Signed-off-by Alexander Gordeev <[email protected]>--- arch/s390/kernel/processor.c | 2 ++ 1 file changed, 2 insertions(+)arch/s390/kernel/processor.c +0
-0
arch/s390/kernel/processor.c static int show_cpuinfo(struct seq_file *m, void *v) · line 341
Quoted 8 lines
arch/s390/kernel/processor.c +2
-0@@ -334,6 +334,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)static inline void *c_update (loff_t *pos) { +if (*pos >= nr_cpu_ids) +return NULL ;if (*pos) *pos =cpumask_next (*pos -1 , cpu_online_mask);else
This silences the warning entirely. If you don't need it, I'd suggest using find_next_bit()
instead. But from the discussion to similar patch, I think you need to allow nr_cpu_ids
only:
+ if (*pos == nr_cpu_ids)
+ return NULL;
Quoted 22 lines · Yury Norov
Quoted 20 lines · Alexander Gordeev
Commit
78e5a3399421("cpumask: fix checking valid cpu range") has started issuing warnings when reading/proc/cpuinfoand configDEBUG_PER_CPU_MAPSis enabled. Avoid callingcpumask_next()with the cpu index equal tonr_cpu_ids- 1 and ensure no warning is generated.Reported-by Andrew Jones <[email protected]>Signed-off-by Alexander Gordeev <[email protected]>--- arch/s390/kernel/processor.c | 2 ++ 1 file changed, 2 insertions(+)arch/s390/kernel/processor.c +0
-0@@ -334,6 +334,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
Quoted 15 lines
arch/s390/kernel/processor.c static int show_cpuinfo(struct seq_file *m, void *v) · line 341
Quoted 7 lines
arch/s390/kernel/processor.c +2
-0static inline void *c_update (loff_t *pos) { +if (*pos >= nr_cpu_ids) +return NULL ;if (*pos) *pos =cpumask_next (*pos -1 , cpu_online_mask);else This silences the warning entirely. If you don't need it, I'd suggest using
find_next_bit()
instead. But from the discussion to similar patch, I think you need to allownr_cpu_ids
only:
+ if (*pos ==nr_cpu_ids)
+ return NULL;
Yes, and I'll post my v3's with this change for x86 and riscv now.
Thanks,
drew