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

2020-09-09 Thread Michael Ellerman
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


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

2019-08-10 Thread Michael Ellerman
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 

Applied to powerpc next, thanks.

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

cheers


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

2019-08-01 Thread Cédric Le Goater
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 
> ---
> 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 */
>  }
>  
> 



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

2019-07-31 Thread Joel Stanley
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 
---
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