Skip to contentSkip to conversation

ARC: Adjust cpuinfo for non-continuous cpu ids

PATCH In review Noam Camus 2 participants 2 messages Oct 19, 2016 Synopsys ARC architecture

lore
Share & tools
lore

Noam Camus

author
#0 lore raw

PATCH v2 1/1 ARC: Adjust cpuinfo for non-continuous cpu ids

From: Noam Camus <[email protected]>

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 at ezchip.com>
---
 arch/arc/kernel/setup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arc/kernel/setup.c +1 -1
index 64907de..bd2e3a4 100644
@@ -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)
Signature · 1 line
1.7.1
#1 lore raw
Quoted 10 lines · Noam Camus

From: Noam Camus <noamc at 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

Quoted 6 lines

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

Quoted 19 lines
Signed-off-by Noam Camus <noamc at ezchip.com>
---
 arch/arc/kernel/setup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arc/kernel/setup.c +1 -1
index 64907de..bd2e3a4 100644
@@ -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)