public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups
@ 2007-09-28  1:08 Alex Chiang
  2007-10-05 21:48 ` Alex Chiang
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Alex Chiang @ 2007-09-28  1:08 UTC (permalink / raw)
  To: linux-ia64

Clean up the process for presenting the "physical id" field in
/proc/cpuinfo.

        - remove global smp_num_cpucores, as it is mostly useless

        - remove check_for_logical_procs(), since we do the same
          functionality in identify_siblings()

        - reflow logic in identify_siblings(). For older CPUs
          that do not support multi-core / thread, we still want
          to call ia64_sal_physical_id_info() and better handle
          ia64_pal_logical_to_phys().

	- remove useless printk's about multi-core / thread
	  capability in identify_siblings(), as that information
	  is readily available in /proc/cpuinfo, and printing for
	  the BSP only adds little value.

	- smp_num_siblings is now meaningful if any CPU in the
	  system supports threads, not just the BSP.

	- expose "physical id" field, even on CPUs that are not
	  multi-core / multi-threaded. Now we know what sockets
	  Madisons live in too.

Signed-off-by: Alex Chiang <achiang@hp.com>
---
 arch/ia64/kernel/setup.c   |   48 ++++++-------------------------------------
 arch/ia64/kernel/smpboot.c |   26 +++++++++++++++--------
 include/asm-ia64/smp.h     |    1 -
 3 files changed, 24 insertions(+), 51 deletions(-)

diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index cd9a37a..5e8e965 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -402,34 +402,6 @@ mark_bsp_online (void)
 #endif
 }
 
-#ifdef CONFIG_SMP
-static void __init
-check_for_logical_procs (void)
-{
-	pal_logical_to_physical_t info;
-	s64 status;
-
-	status = ia64_pal_logical_to_phys(0, &info);
-	if (status = -1) {
-		printk(KERN_INFO "No logical to physical processor mapping "
-		       "available\n");
-		return;
-	}
-	if (status) {
-		printk(KERN_ERR "ia64_pal_logical_to_phys failed with %ld\n",
-		       status);
-		return;
-	}
-	/*
-	 * Total number of siblings that BSP has.  Though not all of them 
-	 * may have booted successfully. The correct number of siblings 
-	 * booted is in info.overview_num_log.
-	 */
-	smp_num_siblings = info.overview_tpc;
-	smp_num_cpucores = info.overview_cpp;
-}
-#endif
-
 static __initdata int nomca;
 static __init int setup_nomca(char *s)
 {
@@ -528,16 +500,6 @@ setup_arch (char **cmdline_p)
 
 	cpu_set(0, cpu_sibling_map[0]);
 	cpu_set(0, cpu_core_map[0]);
-
-	check_for_logical_procs();
-	if (smp_num_cpucores > 1)
-		printk(KERN_INFO
-		       "cpu package is Multi-Core capable: number of cores=%d\n",
-		       smp_num_cpucores);
-	if (smp_num_siblings > 1)
-		printk(KERN_INFO
-		       "cpu package is Multi-Threading capable: number of siblings=%d\n",
-		       smp_num_siblings);
 #endif
 
 	cpu_init();	/* initialize the bootstrap CPU */
@@ -649,13 +611,14 @@ show_cpuinfo (struct seq_file *m, void *v)
 		   c->itc_freq / 1000000, c->itc_freq % 1000000,
 		   lpj*HZ/500000, (lpj*HZ/5000) % 100);
 #ifdef CONFIG_SMP
-	seq_printf(m, "siblings   : %u\n", cpus_weight(cpu_core_map[cpunum]));
+	seq_printf(m, "siblings   : %u\n"
+		      "physical id: %u\n", 
+		      cpus_weight(cpu_core_map[cpunum]), c->socket_id);
 	if (c->threads_per_core > 1 || c->cores_per_socket > 1)
 		seq_printf(m,
-		   	   "physical id: %u\n"
 		   	   "core id    : %u\n"
 		   	   "thread id  : %u\n",
-		   	   c->socket_id, c->core_id, c->thread_id);
+		   	   c->core_id, c->thread_id);
 #endif
 	seq_printf(m,"\n");
 
@@ -767,6 +730,9 @@ identify_cpu (struct cpuinfo_ia64 *c)
 	c->socket_id = -1;
 
 	identify_siblings(c);
+
+	if (c->threads_per_core > smp_num_siblings)
+		smp_num_siblings = c->threads_per_core;
 #endif
 	c->ppn = cpuid.field.ppn;
 	c->number = cpuid.field.number;
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 62209dc..e1a0d7b 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -139,7 +139,6 @@ EXPORT_SYMBOL(cpu_possible_map);
 cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned;
 cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned;
 int smp_num_siblings = 1;
-int smp_num_cpucores = 1;
 
 /* which logical CPU number maps to which CPU (physical APIC ID) */
 volatile int ia64_cpu_to_sapicid[NR_CPUS];
@@ -878,20 +877,29 @@ identify_siblings(struct cpuinfo_ia64 *c)
 	u16 pltid;
 	pal_logical_to_physical_t info;
 
-	if (smp_num_cpucores = 1 && smp_num_siblings = 1)
-		return;
-
-	if ((status = ia64_pal_logical_to_phys(-1, &info)) != PAL_STATUS_SUCCESS) {
-		printk(KERN_ERR "ia64_pal_logical_to_phys failed with %ld\n",
-		       status);
-		return;
-	}
 	if ((status = ia64_sal_physical_id_info(&pltid)) != PAL_STATUS_SUCCESS) {
 		printk(KERN_ERR "ia64_sal_pltid failed with %ld\n", status);
 		return;
 	}
 
+	if ((status = ia64_pal_logical_to_phys(-1, &info)) != PAL_STATUS_SUCCESS) {
+		if (status != PAL_STATUS_UNIMPLEMENTED) {
+			printk(KERN_ERR 
+				"ia64_pal_logical_to_phys failed with %ld\n",
+				status);
+			return;
+		}
+
+		info.overview_ppid = 0;
+		info.overview_cpp  = 1;
+		info.overview_tpc  = 1;
+	}
+
 	c->socket_id =  (pltid << 8) | info.overview_ppid;
+
+	if (info.overview_cpp = 1 && info.overview_tpc = 1)
+		return;
+
 	c->cores_per_socket = info.overview_cpp;
 	c->threads_per_core = info.overview_tpc;
 	c->num_log = info.overview_num_log;
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
index 6314b29..822f0f6 100644
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -60,7 +60,6 @@ extern cpumask_t cpu_online_map;
 extern cpumask_t cpu_core_map[NR_CPUS];
 extern cpumask_t cpu_sibling_map[NR_CPUS];
 extern int smp_num_siblings;
-extern int smp_num_cpucores;
 extern void __iomem *ipi_base_addr;
 extern unsigned char smp_int_redirect;
 
-- 
1.5.3.1.g1e61


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

* Re: [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups
  2007-09-28  1:08 [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups Alex Chiang
@ 2007-10-05 21:48 ` Alex Chiang
  2007-10-08 18:27 ` Luck, Tony
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Chiang @ 2007-10-05 21:48 UTC (permalink / raw)
  To: linux-ia64

Hi Tony,

* Alex Chiang <achiang@hp.com>:
> Clean up the process for presenting the "physical id" field in
> /proc/cpuinfo.

Tagging onto Bjorn's ping ;) I was wondering what you thought of
this patch as well.

I've got the same desire to push my patch into a distro.

Thanks!

/ac


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

* RE: [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups
  2007-09-28  1:08 [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups Alex Chiang
  2007-10-05 21:48 ` Alex Chiang
@ 2007-10-08 18:27 ` Luck, Tony
  2007-10-09 13:25 ` Alex Chiang
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Luck, Tony @ 2007-10-08 18:27 UTC (permalink / raw)
  To: linux-ia64

>	- expose "physical id" field, even on CPUs that are not
>	  multi-core / multi-threaded. Now we know what sockets
>	  Madisons live in too.

This sounds like a good idea.  But this patch didn't work for me
to achieve that on my HP 2620.  /proc/cpuinfo with this patch looks
like this:

processor  : 0
 ...
physical id: 4294967295

processor  : 1
 ...
physical id: 4294967295


So both my Madison cpus are apparently sharing the same socket!  That
big decimal number is just "-1" printed as an unsigned.


-Tony

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

* Re: [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups
  2007-09-28  1:08 [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups Alex Chiang
  2007-10-05 21:48 ` Alex Chiang
  2007-10-08 18:27 ` Luck, Tony
@ 2007-10-09 13:25 ` Alex Chiang
  2007-10-09 16:07 ` Luck, Tony
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Chiang @ 2007-10-09 13:25 UTC (permalink / raw)
  To: linux-ia64

Hi Tony,

Thanks for looking at this.

> >	- expose "physical id" field, even on CPUs that are not
> >	  multi-core / multi-threaded. Now we know what sockets
> >	  Madisons live in too.
> 
> This sounds like a good idea.  But this patch didn't work for me
> to achieve that on my HP 2620.  /proc/cpuinfo with this patch looks
> like this:
> 
> processor  : 0
>  ...
> physical id: 4294967295
> 
> processor  : 1
>  ...
> physical id: 4294967295
> 
> 
> So both my Madison cpus are apparently sharing the same socket!  That
> big decimal number is just "-1" printed as an unsigned.

I spent some time looking at this and also talked with our
low-end firmware guys, and think I understand what's going on
now.

First, on HP low-end platforms, like your rx2620,
SAL_PHYSICAL_ID_INFO is hard coded to return 0. I missed this
because I tested on low-end and high-end with Montes, and on
high-end with Madisons. I must have missed low-end Madison based
platforms. :(

Based on that information, I will have to rethink my approach.

Second, SAL_PHYSICAL_ID_INFO did not show up until SAL 3.2, which
I think is why you got -1. On my rx2620, I have a relatively
modern firmware which does have the SAL call, and I get 0 for
each physical id (with Madisons).

In identify_cpu(), we initialize c->socket_id to -1 because we
expect that value to get overwritten later, in identify_siblings().

If you look at my patch, identify_siblings() calls
ia64_sal_physical_id_info(), and then returns if we get a
failure.

You should have seen this printk:

	printk(KERN_ERR "ia64_sal_pltid failed with %ld\n", status);

Can you verify that you saw that in your dmesg? I think the
status should be -1, due to not-implemented.

Thanks.

/ac


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

* RE: [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups
  2007-09-28  1:08 [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups Alex Chiang
                   ` (2 preceding siblings ...)
  2007-10-09 13:25 ` Alex Chiang
@ 2007-10-09 16:07 ` Luck, Tony
  2007-10-19 17:03 ` Alex Chiang
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Luck, Tony @ 2007-10-09 16:07 UTC (permalink / raw)
  To: linux-ia64

> You should have seen this printk:
>
>	printk(KERN_ERR "ia64_sal_pltid failed with %ld\n", status);
>
> Can you verify that you saw that in your dmesg? I think the
> status should be -1, due to not-implemented.

Yes.  I see this message, and the status is indeed -1.

-Tony

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

* Re: [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups
  2007-09-28  1:08 [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups Alex Chiang
                   ` (3 preceding siblings ...)
  2007-10-09 16:07 ` Luck, Tony
@ 2007-10-19 17:03 ` Alex Chiang
  2007-10-19 18:19 ` Luck, Tony
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Chiang @ 2007-10-19 17:03 UTC (permalink / raw)
  To: linux-ia64

Hi Tony,

After a lot of rethinking (and a little bit of rework), here is
my second shot at this patch.

The only real change from the prior version is that I change the
intialization of socket_id to 0 as default. I think the benefit
of displaying information from PAL/SAL (when available) on older
platforms outweighs the oddity that the user may see physical_id
= 0 for multiple CPUs occasionally.

I've tested on:

  rx1620
  rx2660
  rx6600
  rx8620
  rx8640
  superdome

And it does reasonable things on all of them.

Please consider this for inclusion. Thanks.

/ac

From: Alex Chiang <achiang@hp.com>

Clean up the process for presenting the "physical id" field in
/proc/cpuinfo.

	- remove global smp_num_cpucores, as it is mostly useless

	- remove check_for_logical_procs(), since we do the same
	  functionality in identify_siblings()

	- initialize socket_id to 0 as a default, in case an
	  older CPU implements neither PAL_LOGICAL_TO_PHYSICAL
	  nor SAL_PHYSICAL_ID_INFO. We're presenting this data
	  later in /proc/cpuinfo, so we'd like a reasonable
	  value for older platforms.

	- reflow logic in identify_siblings(). If an older CPU
	  does not implement PAL_LOGICAL_TO_PHYSICAL, we may still
	  be able to get useful information from SAL_PHYSICAL_ID_INFO

	- in identify_siblings(), threads/cores are a property of
	  the CPU, not the platform

	- remove useless printk's about multi-core / thread
	  capability in identify_siblings(), as that information
	  is readily available in /proc/cpuinfo, and printing for
	  the BSP only adds little value

	- smp_num_siblings is now meaningful if any CPU in the
	  system supports threads, not just the BSP

	- expose "physical id" field, even on CPUs that are not
	  multi-core / multi-threaded. Now we know what sockets
	  Madisons live in too

Signed-off-by: Alex Chiang <achiang@hp.com>
---
 arch/ia64/kernel/setup.c   |   49 +++++++------------------------------------
 arch/ia64/kernel/smpboot.c |   21 ++++++++++++------
 include/asm-ia64/smp.h     |    1 -
 3 files changed, 22 insertions(+), 49 deletions(-)

diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index c5cfcfa..3ceca25 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -405,34 +405,6 @@ mark_bsp_online (void)
 #endif
 }
 
-#ifdef CONFIG_SMP
-static void __init
-check_for_logical_procs (void)
-{
-	pal_logical_to_physical_t info;
-	s64 status;
-
-	status = ia64_pal_logical_to_phys(0, &info);
-	if (status = -1) {
-		printk(KERN_INFO "No logical to physical processor mapping "
-		       "available\n");
-		return;
-	}
-	if (status) {
-		printk(KERN_ERR "ia64_pal_logical_to_phys failed with %ld\n",
-		       status);
-		return;
-	}
-	/*
-	 * Total number of siblings that BSP has.  Though not all of them 
-	 * may have booted successfully. The correct number of siblings 
-	 * booted is in info.overview_num_log.
-	 */
-	smp_num_siblings = info.overview_tpc;
-	smp_num_cpucores = info.overview_cpp;
-}
-#endif
-
 static __initdata int nomca;
 static __init int setup_nomca(char *s)
 {
@@ -528,15 +500,6 @@ setup_arch (char **cmdline_p)
 
 #ifdef CONFIG_SMP
 	cpu_physical_id(0) = hard_smp_processor_id();
-	check_for_logical_procs();
-	if (smp_num_cpucores > 1)
-		printk(KERN_INFO
-		       "cpu package is Multi-Core capable: number of cores=%d\n",
-		       smp_num_cpucores);
-	if (smp_num_siblings > 1)
-		printk(KERN_INFO
-		       "cpu package is Multi-Threading capable: number of siblings=%d\n",
-		       smp_num_siblings);
 #endif
 
 	cpu_init();	/* initialize the bootstrap CPU */
@@ -648,13 +611,14 @@ show_cpuinfo (struct seq_file *m, void *v)
 		   c->itc_freq / 1000000, c->itc_freq % 1000000,
 		   lpj*HZ/500000, (lpj*HZ/5000) % 100);
 #ifdef CONFIG_SMP
-	seq_printf(m, "siblings   : %u\n", cpus_weight(cpu_core_map[cpunum]));
+	seq_printf(m, "siblings   : %u\n",
+		      "physical id: %d\n",
+		      cpus_weight(cpu_core_map[cpunum]), c->socket_id);
 	if (c->threads_per_core > 1 || c->cores_per_socket > 1)
 		seq_printf(m,
-		   	   "physical id: %u\n"
 		   	   "core id    : %u\n"
 		   	   "thread id  : %u\n",
-		   	   c->socket_id, c->core_id, c->thread_id);
+		   	   c->core_id, c->thread_id);
 #endif
 	seq_printf(m,"\n");
 
@@ -763,9 +727,12 @@ identify_cpu (struct cpuinfo_ia64 *c)
 	 * for Multi-Threading/Multi-Core capable CPUs
 	 */
 	c->threads_per_core = c->cores_per_socket = c->num_log = 1;
-	c->socket_id = -1;
+	c->socket_id = 0;
 
 	identify_siblings(c);
+
+	if (c->threads_per_core > smp_num_siblings)
+		smp_num_siblings = c->threads_per_core;
 #endif
 	c->ppn = cpuid.field.ppn;
 	c->number = cpuid.field.number;
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index c57dbce..f0fc4d8 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -142,7 +142,6 @@ DEFINE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
 EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
 
 int smp_num_siblings = 1;
-int smp_num_cpucores = 1;
 
 /* which logical CPU number maps to which CPU (physical APIC ID) */
 volatile int ia64_cpu_to_sapicid[NR_CPUS];
@@ -886,13 +885,17 @@ identify_siblings(struct cpuinfo_ia64 *c)
 	u16 pltid;
 	pal_logical_to_physical_t info;
 
-	if (smp_num_cpucores = 1 && smp_num_siblings = 1)
-		return;
-
 	if ((status = ia64_pal_logical_to_phys(-1, &info)) != PAL_STATUS_SUCCESS) {
-		printk(KERN_ERR "ia64_pal_logical_to_phys failed with %ld\n",
-		       status);
-		return;
+		if (status != PAL_STATUS_UNIMPLEMENTED) {
+			printk(KERN_ERR
+				"ia64_pal_logical_to_phys failed with %ld\n",
+				status);
+			return;
+		}
+
+		info.overview_ppid = 0;
+		info.overview_cpp  = 1;
+		info.overview_tpc  = 1;
 	}
 	if ((status = ia64_sal_physical_id_info(&pltid)) != PAL_STATUS_SUCCESS) {
 		printk(KERN_ERR "ia64_sal_pltid failed with %ld\n", status);
@@ -900,6 +903,10 @@ identify_siblings(struct cpuinfo_ia64 *c)
 	}
 
 	c->socket_id =  (pltid << 8) | info.overview_ppid;
+
+	if (info.overview_cpp = 1 && info.overview_tpc = 1)
+		return;
+
 	c->cores_per_socket = info.overview_cpp;
 	c->threads_per_core = info.overview_tpc;
 	c->num_log = info.overview_num_log;
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
index 1703c9d..3d13fea 100644
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -60,7 +60,6 @@ extern cpumask_t cpu_online_map;
 extern cpumask_t cpu_core_map[NR_CPUS];
 DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
 extern int smp_num_siblings;
-extern int smp_num_cpucores;
 extern void __iomem *ipi_base_addr;
 extern unsigned char smp_int_redirect;
 
-- 
1.5.3.1.1.g1e61


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

* RE: [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups
  2007-09-28  1:08 [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups Alex Chiang
                   ` (4 preceding siblings ...)
  2007-10-19 17:03 ` Alex Chiang
@ 2007-10-19 18:19 ` Luck, Tony
  2007-10-19 19:20 ` Alex Chiang
  2007-10-24 17:26 ` Alex Chiang
  7 siblings, 0 replies; 9+ messages in thread
From: Luck, Tony @ 2007-10-19 18:19 UTC (permalink / raw)
  To: linux-ia64

> The only real change from the prior version is that I change the
> intialization of socket_id to 0 as default. I think the benefit
> of displaying information from PAL/SAL (when available) on older
> platforms outweighs the oddity that the user may see physical_id
> = 0 for multiple CPUs occasionally.

Can't we not print the physical_id if we don't know what it is? That
sounds like a better idea than printing wrong information.

-Tony

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

* Re: [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups
  2007-09-28  1:08 [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups Alex Chiang
                   ` (5 preceding siblings ...)
  2007-10-19 18:19 ` Luck, Tony
@ 2007-10-19 19:20 ` Alex Chiang
  2007-10-24 17:26 ` Alex Chiang
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Chiang @ 2007-10-19 19:20 UTC (permalink / raw)
  To: linux-ia64

* Luck, Tony <tony.luck@intel.com>:
> > The only real change from the prior version is that I change the
> > intialization of socket_id to 0 as default. I think the benefit
> > of displaying information from PAL/SAL (when available) on older
> > platforms outweighs the oddity that the user may see physical_id
> > = 0 for multiple CPUs occasionally.
> 
> Can't we not print the physical_id if we don't know what it is? That
> sounds like a better idea than printing wrong information.

Sure, that sounds like a much better idea. Here's try #3 (go back
to old initialization of socket_id = -1, and decide in
show_cpuinfo whether we should print it or not).

Thanks.

/ac

From: Alex Chiang <achiang@hp.com>

Clean up the process for presenting the "physical id" field in
/proc/cpuinfo.

	- remove global smp_num_cpucores, as it is mostly useless

	- remove check_for_logical_procs(), since we do the same
	  functionality in identify_siblings()

	- reflow logic in identify_siblings(). If an older CPU
	  does not implement PAL_LOGICAL_TO_PHYSICAL, we may still
	  be able to get useful information from SAL_PHYSICAL_ID_INFO

	- in identify_siblings(), threads/cores are a property of
	  the CPU, not the platform

	- remove useless printk's about multi-core / thread
	  capability in identify_siblings(), as that information
	  is readily available in /proc/cpuinfo, and printing for
	  the BSP only adds little value

	- smp_num_siblings is now meaningful if any CPU in the
	  system supports threads, not just the BSP

	- expose "physical id" field, even on CPUs that are not
	  multi-core / multi-threaded (as long as we have a valid
	  value). Now we know what sockets Madisons live in too.

Signed-off-by: Alex Chiang <achiang@hp.com>
---
 arch/ia64/kernel/setup.c   |   49 +++++++------------------------------------
 arch/ia64/kernel/smpboot.c |   21 ++++++++++++------
 include/asm-ia64/smp.h     |    1 -
 3 files changed, 22 insertions(+), 49 deletions(-)

diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index c5cfcfa..38ab328 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -405,34 +405,6 @@ mark_bsp_online (void)
 #endif
 }
 
-#ifdef CONFIG_SMP
-static void __init
-check_for_logical_procs (void)
-{
-	pal_logical_to_physical_t info;
-	s64 status;
-
-	status = ia64_pal_logical_to_phys(0, &info);
-	if (status = -1) {
-		printk(KERN_INFO "No logical to physical processor mapping "
-		       "available\n");
-		return;
-	}
-	if (status) {
-		printk(KERN_ERR "ia64_pal_logical_to_phys failed with %ld\n",
-		       status);
-		return;
-	}
-	/*
-	 * Total number of siblings that BSP has.  Though not all of them 
-	 * may have booted successfully. The correct number of siblings 
-	 * booted is in info.overview_num_log.
-	 */
-	smp_num_siblings = info.overview_tpc;
-	smp_num_cpucores = info.overview_cpp;
-}
-#endif
-
 static __initdata int nomca;
 static __init int setup_nomca(char *s)
 {
@@ -528,15 +500,6 @@ setup_arch (char **cmdline_p)
 
 #ifdef CONFIG_SMP
 	cpu_physical_id(0) = hard_smp_processor_id();
-	check_for_logical_procs();
-	if (smp_num_cpucores > 1)
-		printk(KERN_INFO
-		       "cpu package is Multi-Core capable: number of cores=%d\n",
-		       smp_num_cpucores);
-	if (smp_num_siblings > 1)
-		printk(KERN_INFO
-		       "cpu package is Multi-Threading capable: number of siblings=%d\n",
-		       smp_num_siblings);
 #endif
 
 	cpu_init();	/* initialize the bootstrap CPU */
@@ -649,12 +612,13 @@ show_cpuinfo (struct seq_file *m, void *v)
 		   lpj*HZ/500000, (lpj*HZ/5000) % 100);
 #ifdef CONFIG_SMP
 	seq_printf(m, "siblings   : %u\n", cpus_weight(cpu_core_map[cpunum]));
+	if (c->socket_id != -1)
+		seq_printf(m, "physical id: %u\n", c->socket_id);
 	if (c->threads_per_core > 1 || c->cores_per_socket > 1)
 		seq_printf(m,
-		   	   "physical id: %u\n"
-		   	   "core id    : %u\n"
-		   	   "thread id  : %u\n",
-		   	   c->socket_id, c->core_id, c->thread_id);
+			   "core id    : %u\n"
+			   "thread id  : %u\n",
+			   c->core_id, c->thread_id);
 #endif
 	seq_printf(m,"\n");
 
@@ -766,6 +730,9 @@ identify_cpu (struct cpuinfo_ia64 *c)
 	c->socket_id = -1;
 
 	identify_siblings(c);
+
+	if (c->threads_per_core > smp_num_siblings)
+		smp_num_siblings = c->threads_per_core;
 #endif
 	c->ppn = cpuid.field.ppn;
 	c->number = cpuid.field.number;
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index c57dbce..f0fc4d8 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -142,7 +142,6 @@ DEFINE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
 EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
 
 int smp_num_siblings = 1;
-int smp_num_cpucores = 1;
 
 /* which logical CPU number maps to which CPU (physical APIC ID) */
 volatile int ia64_cpu_to_sapicid[NR_CPUS];
@@ -886,13 +885,17 @@ identify_siblings(struct cpuinfo_ia64 *c)
 	u16 pltid;
 	pal_logical_to_physical_t info;
 
-	if (smp_num_cpucores = 1 && smp_num_siblings = 1)
-		return;
-
 	if ((status = ia64_pal_logical_to_phys(-1, &info)) != PAL_STATUS_SUCCESS) {
-		printk(KERN_ERR "ia64_pal_logical_to_phys failed with %ld\n",
-		       status);
-		return;
+		if (status != PAL_STATUS_UNIMPLEMENTED) {
+			printk(KERN_ERR
+				"ia64_pal_logical_to_phys failed with %ld\n",
+				status);
+			return;
+		}
+
+		info.overview_ppid = 0;
+		info.overview_cpp  = 1;
+		info.overview_tpc  = 1;
 	}
 	if ((status = ia64_sal_physical_id_info(&pltid)) != PAL_STATUS_SUCCESS) {
 		printk(KERN_ERR "ia64_sal_pltid failed with %ld\n", status);
@@ -900,6 +903,10 @@ identify_siblings(struct cpuinfo_ia64 *c)
 	}
 
 	c->socket_id =  (pltid << 8) | info.overview_ppid;
+
+	if (info.overview_cpp = 1 && info.overview_tpc = 1)
+		return;
+
 	c->cores_per_socket = info.overview_cpp;
 	c->threads_per_core = info.overview_tpc;
 	c->num_log = info.overview_num_log;
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
index 1703c9d..3d13fea 100644
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -60,7 +60,6 @@ extern cpumask_t cpu_online_map;
 extern cpumask_t cpu_core_map[NR_CPUS];
 DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
 extern int smp_num_siblings;
-extern int smp_num_cpucores;
 extern void __iomem *ipi_base_addr;
 extern unsigned char smp_int_redirect;
 
-- 
1.5.3.1.1.g1e61


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

* Re: [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups
  2007-09-28  1:08 [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups Alex Chiang
                   ` (6 preceding siblings ...)
  2007-10-19 19:20 ` Alex Chiang
@ 2007-10-24 17:26 ` Alex Chiang
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Chiang @ 2007-10-24 17:26 UTC (permalink / raw)
  To: linux-ia64

Hi Tony,

* Alex Chiang <achiang@hp.com>:
> * Luck, Tony <tony.luck@intel.com>:
> > > The only real change from the prior version is that I change the
> > > intialization of socket_id to 0 as default. I think the benefit
> > > of displaying information from PAL/SAL (when available) on older
> > > platforms outweighs the oddity that the user may see physical_id
> > > = 0 for multiple CPUs occasionally.
> > 
> > Can't we not print the physical_id if we don't know what it is? That
> > sounds like a better idea than printing wrong information.
> 
> Sure, that sounds like a much better idea. Here's try #3 (go back
> to old initialization of socket_id = -1, and decide in
> show_cpuinfo whether we should print it or not).

Did this patch work for you?

Thanks.

/ac


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

end of thread, other threads:[~2007-10-24 17:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-28  1:08 [PATCH] ia64: /proc/cpuinfo "physical id" field cleanups Alex Chiang
2007-10-05 21:48 ` Alex Chiang
2007-10-08 18:27 ` Luck, Tony
2007-10-09 13:25 ` Alex Chiang
2007-10-09 16:07 ` Luck, Tony
2007-10-19 17:03 ` Alex Chiang
2007-10-19 18:19 ` Luck, Tony
2007-10-19 19:20 ` Alex Chiang
2007-10-24 17:26 ` Alex Chiang

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