From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Sasha Levin Subject: [PATCH AUTOSEL 4.19 08/40] s390/cpuinfo: fix wrong output when CPU0 is offline Date: Wed, 15 Apr 2020 07:45:51 -0400 Message-Id: <20200415114623.14972-8-sashal@kernel.org> In-Reply-To: <20200415114623.14972-1-sashal@kernel.org> References: <20200415114623.14972-1-sashal@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexander Gordeev , Heiko Carstens , Vasily Gorbik , Sasha Levin , linux-s390@vger.kernel.org From: Alexander Gordeev [ Upstream commit 872f27103874a73783aeff2aac2b41a489f67d7c ] /proc/cpuinfo should not print information about CPU 0 when it is offline. Fixes: 281eaa8cb67c ("s390/cpuinfo: simplify locking and skip offline cpus early") Signed-off-by: Alexander Gordeev Reviewed-by: Heiko Carstens [heiko.carstens@de.ibm.com: shortened commit message] Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- arch/s390/kernel/processor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c index 6fe2e1875058b..675d4be0c2b77 100644 --- a/arch/s390/kernel/processor.c +++ b/arch/s390/kernel/processor.c @@ -157,8 +157,9 @@ static void show_cpu_mhz(struct seq_file *m, unsigned long n) static int show_cpuinfo(struct seq_file *m, void *v) { 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); if (!machine_has_cpu_mhz) return 0; @@ -171,6 +172,8 @@ static inline void *c_update(loff_t *pos) { if (*pos) *pos = cpumask_next(*pos - 1, cpu_online_mask); + else + *pos = cpumask_first(cpu_online_mask); return *pos < nr_cpu_ids ? (void *)*pos + 1 : NULL; } -- 2.20.1