Skip to contentSkip to conversation

ARM: populate processor tag in proc-cpuinfo for Uni-processor.

PATCH New Srinivas KANDAGATLA 3 participants 5 messages Oct 13, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: populate processor tag in proc-cpuinfo for Uni-processor.

From: Srinivas Kandagatla <[email protected]>

This patch populates processor tag in /proc/cpuinfo for uni-processor too. All the processors in kernel code do that.

Without this patch tools like cyclesoak which use processor tag to determine number of cpus will be broken.

run cyclesoak -C on uniprocessor system to reproduce.

originally detected as part of
https://bugzilla.stlinux.com/show_bug.cgi?id=14674 triage.

---
Hi All,
We recently encountered issue while running cyclesoak on ARM-uniprocessor system,
What we have noticed it that /proc/cpuinfo does not have "processor" tag when its uniprocessor, which looked incorrect. All the processors code in kernel do populate this tag for both uni and multi processor systems.

This patch just add processor tag for cpuinfo for ARM uni-processor systems.

Thanks,
srini

 arch/arm/kernel/setup.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/kernel/setup.c +2 -1
index 621acad..4364071 100644
@@ -807,7 +807,7 @@ static const char *hwcap_str[] = {
 
 static int c_show(struct seq_file *m, void *v)
 {
-	int i;
+	int i = 0;
 
 	seq_printf(m, "Processor\t: %s rev %d (%s)\n",
 		   cpu_name, read_cpuid_id() & 15, elf_platform);
@@ -825,6 +825,7 @@ static int c_show(struct seq_file *m, void *v)
 			   (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100);
 	}
 #else /* CONFIG_SMP */
+	seq_printf(m, "processor\t: %d\n", i);
 	seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
 		   loops_per_jiffy / (500000/HZ),
 		   (loops_per_jiffy / (5000/HZ)) % 100);
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 1/1 ARM: populate processor tag in proc-cpuinfo for Uni-processor.

Quoted 7 lines · Srinivas KANDAGATLA

We recently encountered issue while running cyclesoak on ARM-uniprocessor system, What we have noticed it that /proc/cpuinfo does not have "processor" tag when its uniprocessor, which looked incorrect. All the processors code in kernel do populate this tag for both uni and multi processor systems.

This patch just add processor tag for cpuinfo for ARM uni-processor systems.

I wonder why cyclesoak doesn't use the sysconf(_SC_NPROCESSORS_ONLN) rather than implementing this functionality itself.

akpm?

Quoted 32 lines
 arch/arm/kernel/setup.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/kernel/setup.c +2 -1
index 621acad..4364071 100644
@@ -807,7 +807,7 @@ static const char *hwcap_str[] = {
 
 static int c_show(struct seq_file *m, void *v)
 {
-	int i;
+	int i = 0;
 
 	seq_printf(m, "Processor\t: %s rev %d (%s)\n",
 		   cpu_name, read_cpuid_id() & 15, elf_platform);
@@ -825,6 +825,7 @@ static int c_show(struct seq_file *m, void *v)
 			   (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100);
 	}
 #else /* CONFIG_SMP */
+	seq_printf(m, "processor\t: %d\n", i);
 	seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
 		   loops_per_jiffy / (500000/HZ),
 		   (loops_per_jiffy / (5000/HZ)) % 100);
Signature · 7 lines
1.6.3.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

PATCH 1/1 ARM: populate processor tag in proc-cpuinfo for Uni-processor.

Quoted 7 lines · On Thu, 13 Oct 2011 17:48:22 +0100 Russell King - ARM Linux…
Quoted 6 lines · Srinivas KANDAGATLA

We recently encountered issue while running cyclesoak on ARM-uniprocessor system, What we have noticed it that /proc/cpuinfo does not have "processor" tag when its uniprocessor, which looked incorrect. All the processors code in kernel do populate this tag for both uni and multi processor systems.

Quoted 6 lines
Quoted 1 line

This patch just add processor tag for cpuinfo for ARM uni-processor systems.

I wonder why cyclesoak doesn't use the sysconf(_SC_NPROCESSORS_ONLN) rather than implementing this functionality itself.

akpm?

eep, cyclesoak will soon be celebrating its eleventh birthday. sysconf(_SC_NPROCESSORS_ONLN) might have existed back in those days, but I sure didn't know about it!

#3 lore raw

PATCH 1/1 ARM: populate processor tag in proc-cpuinfo for Uni-processor.

Quoted 12 lines · Andrew Morton
Quoted 9 lines · On Thu, 13 Oct 2011 17:48:22 +0100 Russell King - ARM Linux…
Quoted 7 lines · Srinivas KANDAGATLA

We recently encountered issue while running cyclesoak on ARM-uniprocessor system, What we have noticed it that /proc/cpuinfo does not have "processor" tag when its uniprocessor, which looked incorrect. All the processors code in kernel do populate this tag for both uni and multi processor systems.

This patch just add processor tag for cpuinfo for ARM uni-processor systems.

Quoted 8 lines
Quoted 4 lines

I wonder why cyclesoak doesn't use the sysconf(_SC_NPROCESSORS_ONLN) rather than implementing this functionality itself.

akpm?

eep, cyclesoak will soon be celebrating its eleventh birthday. sysconf(_SC_NPROCESSORS_ONLN) might have existed back in those days, but I sure didn't know about it!

Do you have any opinion on the related issue of whether uniprocessor kernels should include a 'processor: 0' line in their /proc/cpuinfo to satisfy programs such as cyclesoak ?

It's worth noting that glibc's implementation for sysconf(_SC_NPROCESSORS_ONLN) prefers reading /proc/stat and counting the lines matching '^cpu[0-9]' as its more consistent.

#4 lore raw

PATCH 1/1 ARM: populate processor tag in proc-cpuinfo for Uni-processor.

Quoted 18 lines · On Thu, 13 Oct 2011 22:03:36 +0100 Russell King - ARM Linux…
Quoted 17 lines · Andrew Morton
Quoted 13 lines · On Thu, 13 Oct 2011 17:48:22 +0100 Russell King - ARM Linux…
Quoted 7 lines · Srinivas KANDAGATLA

We recently encountered issue while running cyclesoak on ARM-uniprocessor system, What we have noticed it that /proc/cpuinfo does not have "processor" tag when its uniprocessor, which looked incorrect. All the processors code in kernel do populate this tag for both uni and multi processor systems.

This patch just add processor tag for cpuinfo for ARM uni-processor systems.

I wonder why cyclesoak doesn't use the sysconf(_SC_NPROCESSORS_ONLN) rather than implementing this functionality itself.

akpm?

Quoted 7 lines
Quoted 3 lines

eep, cyclesoak will soon be celebrating its eleventh birthday. sysconf(_SC_NPROCESSORS_ONLN) might have existed back in those days, but I sure didn't know about it!

Do you have any opinion on the related issue of whether uniprocessor kernels should include a 'processor: 0' line in their /proc/cpuinfo to satisfy programs such as cyclesoak ?

I think it would be best to do what x86 does, and x86 appears to do "processor\t: %u" even for uniprocessor. Plus that makes UP and SMP more consistent.

But there isn't much consistency here. arch/openrisc/kernel/setup.c:show_cpuinfo() sprays out stuff which is very different from x86.