linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: Fix cpu node iterator to not ignore disabled cpu nodes
@ 2018-10-31 14:42 Rob Herring
  2018-10-31 16:40 ` Christian Zigotzky
  2018-11-01 11:08 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Rob Herring @ 2018-10-31 14:42 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: devicetree, linux-kernel, Christian Zigotzky, Frank Rowand

In most cases, nodes with 'status = "disabled";' are treated as if the
node is not present though it is a common bug to forget to check that.
However, cpu nodes are different in that "disabled" simply means offline
and the OS can bring the CPU core online. Commit f1f207e43b8a ("of: Add
cpu node iterator for_each_of_cpu_node()") followed the common behavior
of ignoring disabled cpu nodes. This breaks some powerpc systems (at
least NXP P50XX/e5500). Fix this by dropping the status check.

Fixes: 651d44f9679c ("of: use for_each_of_cpu_node iterator")
Fixes: f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()")
Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christian Zigotzky <chzigotzky@xenosoft.de>
Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/of/base.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index cc62da278663..e47c5ce6cd58 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -776,8 +776,6 @@ struct device_node *of_get_next_cpu_node(struct device_node *prev)
 		if (!(of_node_name_eq(next, "cpu") ||
 		      (next->type && !of_node_cmp(next->type, "cpu"))))
 			continue;
-		if (!__of_device_is_available(next))
-			continue;
 		if (of_node_get(next))
 			break;
 	}
-- 
2.19.1


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

* Re: [PATCH] of: Fix cpu node iterator to not ignore disabled cpu nodes
  2018-10-31 14:42 [PATCH] of: Fix cpu node iterator to not ignore disabled cpu nodes Rob Herring
@ 2018-10-31 16:40 ` Christian Zigotzky
  2018-11-01 11:08 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Zigotzky @ 2018-10-31 16:40 UTC (permalink / raw)
  To: Rob Herring; +Cc: Michael Ellerman, devicetree, linux-kernel, Frank Rowand

Thank you. I will test this patch tomorrow.

— Christian

Sent from my iPhone

> On 31. Oct 2018, at 15:42, Rob Herring <robh@kernel.org> wrote:
> 
> In most cases, nodes with 'status = "disabled";' are treated as if the
> node is not present though it is a common bug to forget to check that.
> However, cpu nodes are different in that "disabled" simply means offline
> and the OS can bring the CPU core online. Commit f1f207e43b8a ("of: Add
> cpu node iterator for_each_of_cpu_node()") followed the common behavior
> of ignoring disabled cpu nodes. This breaks some powerpc systems (at
> least NXP P50XX/e5500). Fix this by dropping the status check.
> 
> Fixes: 651d44f9679c ("of: use for_each_of_cpu_node iterator")
> Fixes: f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()")
> Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Christian Zigotzky <chzigotzky@xenosoft.de>
> Cc: Frank Rowand <frowand.list@gmail.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> drivers/of/base.c | 2 --
> 1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index cc62da278663..e47c5ce6cd58 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -776,8 +776,6 @@ struct device_node *of_get_next_cpu_node(struct device_node *prev)
>        if (!(of_node_name_eq(next, "cpu") ||
>              (next->type && !of_node_cmp(next->type, "cpu"))))
>            continue;
> -        if (!__of_device_is_available(next))
> -            continue;
>        if (of_node_get(next))
>            break;
>    }
> -- 
> 2.19.1
> 

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

* Re: [PATCH] of: Fix cpu node iterator to not ignore disabled cpu nodes
  2018-10-31 14:42 [PATCH] of: Fix cpu node iterator to not ignore disabled cpu nodes Rob Herring
  2018-10-31 16:40 ` Christian Zigotzky
@ 2018-11-01 11:08 ` Michael Ellerman
  2018-11-01 12:45   ` Christian Zigotzky
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2018-11-01 11:08 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree, linux-kernel, Christian Zigotzky, Frank Rowand

Rob Herring <robh@kernel.org> writes:

> In most cases, nodes with 'status = "disabled";' are treated as if the
> node is not present though it is a common bug to forget to check that.
> However, cpu nodes are different in that "disabled" simply means offline
> and the OS can bring the CPU core online. Commit f1f207e43b8a ("of: Add
> cpu node iterator for_each_of_cpu_node()") followed the common behavior
> of ignoring disabled cpu nodes. This breaks some powerpc systems (at
> least NXP P50XX/e5500). Fix this by dropping the status check.
>
> Fixes: 651d44f9679c ("of: use for_each_of_cpu_node iterator")
> Fixes: f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()")
> Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Christian Zigotzky <chzigotzky@xenosoft.de>
> Cc: Frank Rowand <frowand.list@gmail.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/of/base.c | 2 --
>  1 file changed, 2 deletions(-)

This fixes my machine, thanks.

Tested-by: Michael Ellerman <mpe@ellerman.id.au>

It was actually originally reported to me by Christian, so also:

Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>


cheers

> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index cc62da278663..e47c5ce6cd58 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -776,8 +776,6 @@ struct device_node *of_get_next_cpu_node(struct device_node *prev)
>  		if (!(of_node_name_eq(next, "cpu") ||
>  		      (next->type && !of_node_cmp(next->type, "cpu"))))
>  			continue;
> -		if (!__of_device_is_available(next))
> -			continue;
>  		if (of_node_get(next))
>  			break;
>  	}
> -- 
> 2.19.1

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

* Re: [PATCH] of: Fix cpu node iterator to not ignore disabled cpu nodes
  2018-11-01 11:08 ` Michael Ellerman
@ 2018-11-01 12:45   ` Christian Zigotzky
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Zigotzky @ 2018-11-01 12:45 UTC (permalink / raw)
  To: Michael Ellerman, Rob Herring; +Cc: devicetree, linux-kernel, Frank Rowand

On 01 November 2018 at 12:08PM, Michael Ellerman wrote:
> Rob Herring <robh@kernel.org> writes:
>
>> In most cases, nodes with 'status = "disabled";' are treated as if the
>> node is not present though it is a common bug to forget to check that.
>> However, cpu nodes are different in that "disabled" simply means offline
>> and the OS can bring the CPU core online. Commit f1f207e43b8a ("of: Add
>> cpu node iterator for_each_of_cpu_node()") followed the common behavior
>> of ignoring disabled cpu nodes. This breaks some powerpc systems (at
>> least NXP P50XX/e5500). Fix this by dropping the status check.
>>
>> Fixes: 651d44f9679c ("of: use for_each_of_cpu_node iterator")
>> Fixes: f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()")
>> Reported-by: Michael Ellerman <mpe@ellerman.id.au>
>> Cc: Christian Zigotzky <chzigotzky@xenosoft.de>
>> Cc: Frank Rowand <frowand.list@gmail.com>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> ---
>>   drivers/of/base.c | 2 --
>>   1 file changed, 2 deletions(-)
> This fixes my machine, thanks.
>
> Tested-by: Michael Ellerman <mpe@ellerman.id.au>
>
> It was actually originally reported to me by Christian, so also:
>
> Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
>
>
> cheers
>
>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>> index cc62da278663..e47c5ce6cd58 100644
>> --- a/drivers/of/base.c
>> +++ b/drivers/of/base.c
>> @@ -776,8 +776,6 @@ struct device_node *of_get_next_cpu_node(struct device_node *prev)
>>   		if (!(of_node_name_eq(next, "cpu") ||
>>   		      (next->type && !of_node_cmp(next->type, "cpu"))))
>>   			continue;
>> -		if (!__of_device_is_available(next))
>> -			continue;
>>   		if (of_node_get(next))
>>   			break;
>>   	}
>> -- 
>> 2.19.1

Hi All,

Many thanks for your help! This patch fixes my P5020 board (dual core) 
and my virtual QEMU ppce500 machine (quad core).

Have a nice day!

Cheers,
Christian


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

end of thread, other threads:[~2018-11-01 12:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31 14:42 [PATCH] of: Fix cpu node iterator to not ignore disabled cpu nodes Rob Herring
2018-10-31 16:40 ` Christian Zigotzky
2018-11-01 11:08 ` Michael Ellerman
2018-11-01 12:45   ` Christian Zigotzky

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).