mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ARC: Adjust cpuinfo for non-continuous cpu ids
@ 2016-10-19 11:25 Noam Camus
  2016-10-19 17:02 ` Vineet Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Noam Camus @ 2016-10-19 11:25 UTC (permalink / raw)
  To: vgupta; +Cc: linux-snps-arc, linux-kernel, Noam Camus

From: Noam Camus <noamc@ezchip.com>

num_possible_cpus() returns how many CPUs may be present on system.
However we want the highest possible CPU number.
This may be differ in a sparsed possible CPUs map.
Such map achived by OF for plat-eznps.

For example if we have:
possible cpus mask 0,3

Then:
num_possible_cpus() is equal 2
	while
nr_cpu_ids is equal 4.

Only for value 4 c_start() will provide correct cpuinfo at procfs.

Signed-off-by: Noam Camus <noamc@ezchip.com>
---
 arch/arc/kernel/setup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 64907de..bd2e3a4 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -512,7 +512,7 @@ static void *c_start(struct seq_file *m, loff_t *pos)
 	 * way to pass it w/o having to kmalloc/free a 2 byte string.
 	 * Encode cpu-id as 0xFFcccc, which is decoded by show routine.
 	 */
-	return *pos < num_possible_cpus() ? cpu_to_ptr(*pos) : NULL;
+	return *pos < nr_cpu_ids ? cpu_to_ptr(*pos) : NULL;
 }
 
 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
-- 
1.7.1

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

* Re: [PATCH v2] ARC: Adjust cpuinfo for non-continuous cpu ids
  2016-10-19 11:25 [PATCH v2] ARC: Adjust cpuinfo for non-continuous cpu ids Noam Camus
@ 2016-10-19 17:02 ` Vineet Gupta
  0 siblings, 0 replies; 2+ messages in thread
From: Vineet Gupta @ 2016-10-19 17:02 UTC (permalink / raw)
  To: Noam Camus; +Cc: linux-snps-arc, linux-kernel, Noam Camus

On 10/19/2016 04:25 AM, Noam Camus wrote:
> From: Noam Camus <noamc@ezchip.com>
>
> num_possible_cpus() returns how many CPUs may be present on system.
> However we want the highest possible CPU number.
> This may be differ in a sparsed possible CPUs map.
> Such map achived by OF for plat-eznps.
>
> For example if we have:
> possible cpus mask 0,3
>
> Then:
> num_possible_cpus() is equal 2
> 	while
> nr_cpu_ids is equal 4.
>
> Only for value 4 c_start() will provide correct cpuinfo at procfs.

This is much much better. Applied to for-curr !

Thx,
-Vineet

>
> Signed-off-by: Noam Camus <noamc@ezchip.com>
> ---
>  arch/arc/kernel/setup.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
> index 64907de..bd2e3a4 100644
> --- a/arch/arc/kernel/setup.c
> +++ b/arch/arc/kernel/setup.c
> @@ -512,7 +512,7 @@ static void *c_start(struct seq_file *m, loff_t *pos)
>  	 * way to pass it w/o having to kmalloc/free a 2 byte string.
>  	 * Encode cpu-id as 0xFFcccc, which is decoded by show routine.
>  	 */
> -	return *pos < num_possible_cpus() ? cpu_to_ptr(*pos) : NULL;
> +	return *pos < nr_cpu_ids ? cpu_to_ptr(*pos) : NULL;
>  }
>  
>  static void *c_next(struct seq_file *m, void *v, loff_t *pos)

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

end of thread, other threads:[~2016-10-19 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-19 11:25 [PATCH v2] ARC: Adjust cpuinfo for non-continuous cpu ids Noam Camus
2016-10-19 17:02 ` Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome