linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/powernv: Print helpful message when cores guarded
@ 2019-08-01  5:16 Joel Stanley
  2019-08-01  9:33 ` Cédric Le Goater
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Joel Stanley @ 2019-08-01  5:16 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-09 14:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-01  5:16 [PATCH] powerpc/powernv: Print helpful message when cores guarded Joel Stanley
2019-08-01  9:33 ` Cédric Le Goater
2019-08-10 10:20 ` Michael Ellerman
2020-09-09 13:27 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).