linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3.1-rc9] ARM: populate processor tag in proc-cpuinfo for Uni-processor.
@ 2011-10-13 15:43 Srinivas KANDAGATLA
  2011-10-13 16:48 ` Russell King - ARM Linux
  0 siblings, 1 reply; 5+ messages in thread
From: Srinivas KANDAGATLA @ 2011-10-13 15:43 UTC (permalink / raw)
  To: linux-arm-kernel

From: Srinivas Kandagatla <srinivas.kandagatla@st.com>

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.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Chris Smith <chris.smith@st.com>
---
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(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 621acad..4364071 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -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);
-- 
1.6.3.3

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

* [PATCH v3.1-rc9] ARM: populate processor tag in proc-cpuinfo for Uni-processor.
  2011-10-13 15:43 [PATCH v3.1-rc9] ARM: populate processor tag in proc-cpuinfo for Uni-processor Srinivas KANDAGATLA
@ 2011-10-13 16:48 ` Russell King - ARM Linux
  2011-10-13 20:52   ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2011-10-13 16:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 13, 2011 at 04:43:10PM +0100, Srinivas KANDAGATLA wrote:
> 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?

>  arch/arm/kernel/setup.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index 621acad..4364071 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -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);
> -- 
> 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

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

* [PATCH v3.1-rc9] ARM: populate processor tag in proc-cpuinfo for Uni-processor.
  2011-10-13 16:48 ` Russell King - ARM Linux
@ 2011-10-13 20:52   ` Andrew Morton
  2011-10-13 21:03     ` Russell King - ARM Linux
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2011-10-13 20:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 13 Oct 2011 17:48:22 +0100
Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:

> On Thu, Oct 13, 2011 at 04:43:10PM +0100, Srinivas KANDAGATLA wrote:
> > 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?

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!

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

* [PATCH v3.1-rc9] ARM: populate processor tag in proc-cpuinfo for Uni-processor.
  2011-10-13 20:52   ` Andrew Morton
@ 2011-10-13 21:03     ` Russell King - ARM Linux
  2011-10-13 21:31       ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2011-10-13 21:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 13, 2011 at 01:52:34PM -0700, Andrew Morton wrote:
> On Thu, 13 Oct 2011 17:48:22 +0100
> Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> 
> > On Thu, Oct 13, 2011 at 04:43:10PM +0100, Srinivas KANDAGATLA wrote:
> > > 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?
> 
> 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.

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

* [PATCH v3.1-rc9] ARM: populate processor tag in proc-cpuinfo for Uni-processor.
  2011-10-13 21:03     ` Russell King - ARM Linux
@ 2011-10-13 21:31       ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2011-10-13 21:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 13 Oct 2011 22:03:36 +0100
Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:

> On Thu, Oct 13, 2011 at 01:52:34PM -0700, Andrew Morton wrote:
> > On Thu, 13 Oct 2011 17:48:22 +0100
> > Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> > 
> > > On Thu, Oct 13, 2011 at 04:43:10PM +0100, Srinivas KANDAGATLA wrote:
> > > > 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?
> > 
> > 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.

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

end of thread, other threads:[~2011-10-13 21:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-13 15:43 [PATCH v3.1-rc9] ARM: populate processor tag in proc-cpuinfo for Uni-processor Srinivas KANDAGATLA
2011-10-13 16:48 ` Russell King - ARM Linux
2011-10-13 20:52   ` Andrew Morton
2011-10-13 21:03     ` Russell King - ARM Linux
2011-10-13 21:31       ` Andrew Morton

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