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

* Re: [PATCH] powerpc/powernv: Print helpful message when cores guarded
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2019-08-01  9:33 UTC (permalink / raw)
  To: Joel Stanley, Michael Ellerman, linuxppc-dev

On 01/08/2019 07:16, 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>
> ---
> 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. 

>  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 */
>  }
>  
> 


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

* Re: [PATCH] powerpc/powernv: Print helpful message when cores guarded
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2019-08-10 10:20 UTC (permalink / raw)
  To: Joel Stanley, linuxppc-dev

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

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

* Re: [PATCH] powerpc/powernv: Print helpful message when cores guarded
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2020-09-09 13:27 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman, Joel Stanley

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

^ permalink raw reply	[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).