[PATCH] powerpc/powernv: Print helpful message when cores guarded

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE2171d LANDED

Landed in mainline as 8f55984f530d on 2020-09-08.

4 messages, 3 authors, 2020-09-09 · open the first message on its own page

[PATCH] powerpc/powernv: Print helpful message when cores guarded

From: Joel Stanley <joel@jms.id.au>
Date: 2019-08-01 05:18:26

Often the firmware will guard out cores after a crash. This often
undesirable, and is not immediately noticeable.

This adds an informative message when a CPU device tree nodes are marked
bad in the device tree.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
Tested on qemu 4.1 with this patch applied:

 https://ozlabs.org/~joel/uta2019/0001-TESTING-mark-every-second-core-as-guarded.patch

This will show no cores guarded:

 qemu-system-ppc64 -M powernv8 -nographic -smp 1,cores=1,threads=1 -kernel zImage.epapr

This will show three:

 qemu-system-ppc64 -M powernv8 -nographic -smp 7,cores=7,threads=1 -kernel zImage.epapr

 arch/powerpc/platforms/powernv/setup.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index a5e52f9eed3c..7107583d0c6b 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -129,6 +129,28 @@ static void pnv_setup_rfi_flush(void)
 	setup_count_cache_flush();
 }
 
+static void __init pnv_check_guarded_cores(void)
+{
+	struct device_node *dn;
+	int bad_count = 0;
+
+	for_each_node_by_type(dn, "cpu") {
+		if (of_property_match_string(dn, "status", "bad") >= 0)
+			bad_count++;
+	};
+
+	if (bad_count) {
+		pr_cont("  __                           \n");
+		pr_cont(" /  \\        _______________    \n");
+		pr_cont(" |  |       /               \\  \n");
+		pr_cont(" @  @       |    WARNING!   |  \n");
+		pr_cont(" || ||      | It looks like |  \n");
+		pr_cont(" || ||   <--|  you have %*d |  \n", 3, bad_count);
+		pr_cont(" |\\_/|      | guarded cores |  \n");
+		pr_cont(" \\___/      \\_______________/  \n\n");
+	}
+}
+
 static void __init pnv_setup_arch(void)
 {
 	set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
@@ -149,6 +171,8 @@ static void __init pnv_setup_arch(void)
 	/* Enable NAP mode */
 	powersave_nap = 1;
 
+	pnv_check_guarded_cores();
+
 	/* XXX PMCS */
 }
 
-- 
2.20.1

Re: [PATCH] powerpc/powernv: Print helpful message when cores guarded

From: Cédric Le Goater <clg@kaod.org>
Date: 2019-08-01 10:13:46

On 01/08/2019 07:16, Joel Stanley wrote:
quoted hunk
Often the firmware will guard out cores after a crash. This often
undesirable, and is not immediately noticeable.

This adds an informative message when a CPU device tree nodes are marked
bad in the device tree.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
Tested on qemu 4.1 with this patch applied:

 https://ozlabs.org/~joel/uta2019/0001-TESTING-mark-every-second-core-as-guarded.patch

This will show no cores guarded:

 qemu-system-ppc64 -M powernv8 -nographic -smp 1,cores=1,threads=1 -kernel zImage.epapr

This will show three:

 qemu-system-ppc64 -M powernv8 -nographic -smp 7,cores=7,threads=1 -kernel zImage.epapr

 arch/powerpc/platforms/powernv/setup.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index a5e52f9eed3c..7107583d0c6b 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -129,6 +129,28 @@ static void pnv_setup_rfi_flush(void)
 	setup_count_cache_flush();
 }
 
+static void __init pnv_check_guarded_cores(void)
+{
+	struct device_node *dn;
+	int bad_count = 0;
+
+	for_each_node_by_type(dn, "cpu") {
+		if (of_property_match_string(dn, "status", "bad") >= 0)
+			bad_count++;
+	};
+
+	if (bad_count) {
+		pr_cont("  __                           \n");
+		pr_cont(" /  \\        _______________    \n");
+		pr_cont(" |  |       /               \\  \n");
+		pr_cont(" @  @       |    WARNING!   |  \n");
+		pr_cont(" || ||      | It looks like |  \n");
+		pr_cont(" || ||   <--|  you have %*d |  \n", 3, bad_count);
+		pr_cont(" |\\_/|      | guarded cores |  \n");
+		pr_cont(" \\___/      \\_______________/  \n\n");
+	}
+}
Is that a new animal ? We could use a Cerberus.

Cheers,
C. 
quoted hunk
 static void __init pnv_setup_arch(void)
 {
 	set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
@@ -149,6 +171,8 @@ static void __init pnv_setup_arch(void)
 	/* Enable NAP mode */
 	powersave_nap = 1;
 
+	pnv_check_guarded_cores();
+
 	/* XXX PMCS */
 }
 

Re: [PATCH] powerpc/powernv: Print helpful message when cores guarded

From: Michael Ellerman <hidden>
Date: 2019-08-10 10:24:18

On Thu, 2019-08-01 at 05:16:30 UTC, Joel Stanley wrote:
Often the firmware will guard out cores after a crash. This often
undesirable, and is not immediately noticeable.

This adds an informative message when a CPU device tree nodes are marked
bad in the device tree.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/680d00741838b1c1bd59d5d7ac96791f5558e05d

cheers

Re: [PATCH] powerpc/powernv: Print helpful message when cores guarded

From: Michael Ellerman <hidden>
Date: 2020-09-09 14:12:08

On Thu, 1 Aug 2019 14:46:30 +0930, Joel Stanley wrote:
Often the firmware will guard out cores after a crash. This often
undesirable, and is not immediately noticeable.

This adds an informative message when a CPU device tree nodes are marked
bad in the device tree.
Applied to powerpc/next.

[1/1] powerpc/powernv: Print helpful message when cores guarded
      https://git.kernel.org/powerpc/c/8f55984f530d7275531e17f36ea29229c2c410dd

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help