diff options
author | Alex Chiang <achiang@hp.com> | 2007-10-19 15:20:09 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2007-10-29 14:14:54 -0400 |
commit | 113134fcbca83619be4c68d0ca66db6093777b5d (patch) | |
tree | 82efd2ce1bdd61aa1af2602be9072d1b275cf893 /arch | |
parent | 172c51068499ed4a168a2b94eda9d1f160a396a1 (diff) |
[IA64] /proc/cpuinfo "physical id" field cleanups
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>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/kernel/setup.c | 49 | ||||
-rw-r--r-- | arch/ia64/kernel/smpboot.c | 21 |
2 files changed, 22 insertions, 48 deletions
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index ae6c3c02e11..2b3751eef5c 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c | |||
@@ -417,34 +417,6 @@ mark_bsp_online (void) | |||
417 | #endif | 417 | #endif |
418 | } | 418 | } |
419 | 419 | ||
420 | #ifdef CONFIG_SMP | ||
421 | static void __init | ||
422 | check_for_logical_procs (void) | ||
423 | { | ||
424 | pal_logical_to_physical_t info; | ||
425 | s64 status; | ||
426 | |||
427 | status = ia64_pal_logical_to_phys(0, &info); | ||
428 | if (status == -1) { | ||
429 | printk(KERN_INFO "No logical to physical processor mapping " | ||
430 | "available\n"); | ||
431 | return; | ||
432 | } | ||
433 | if (status) { | ||
434 | printk(KERN_ERR "ia64_pal_logical_to_phys failed with %ld\n", | ||
435 | status); | ||
436 | return; | ||
437 | } | ||
438 | /* | ||
439 | * Total number of siblings that BSP has. Though not all of them | ||
440 | * may have booted successfully. The correct number of siblings | ||
441 | * booted is in info.overview_num_log. | ||
442 | */ | ||
443 | smp_num_siblings = info.overview_tpc; | ||
444 | smp_num_cpucores = info.overview_cpp; | ||
445 | } | ||
446 | #endif | ||
447 | |||
448 | static __initdata int nomca; | 420 | static __initdata int nomca; |
449 | static __init int setup_nomca(char *s) | 421 | static __init int setup_nomca(char *s) |
450 | { | 422 | { |
@@ -540,15 +512,6 @@ setup_arch (char **cmdline_p) | |||
540 | 512 | ||
541 | #ifdef CONFIG_SMP | 513 | #ifdef CONFIG_SMP |
542 | cpu_physical_id(0) = hard_smp_processor_id(); | 514 | cpu_physical_id(0) = hard_smp_processor_id(); |
543 | check_for_logical_procs(); | ||
544 | if (smp_num_cpucores > 1) | ||
545 | printk(KERN_INFO | ||
546 | "cpu package is Multi-Core capable: number of cores=%d\n", | ||
547 | smp_num_cpucores); | ||
548 | if (smp_num_siblings > 1) | ||
549 | printk(KERN_INFO | ||
550 | "cpu package is Multi-Threading capable: number of siblings=%d\n", | ||
551 | smp_num_siblings); | ||
552 | #endif | 515 | #endif |
553 | 516 | ||
554 | cpu_init(); /* initialize the bootstrap CPU */ | 517 | cpu_init(); /* initialize the bootstrap CPU */ |
@@ -661,12 +624,13 @@ show_cpuinfo (struct seq_file *m, void *v) | |||
661 | lpj*HZ/500000, (lpj*HZ/5000) % 100); | 624 | lpj*HZ/500000, (lpj*HZ/5000) % 100); |
662 | #ifdef CONFIG_SMP | 625 | #ifdef CONFIG_SMP |
663 | seq_printf(m, "siblings : %u\n", cpus_weight(cpu_core_map[cpunum])); | 626 | seq_printf(m, "siblings : %u\n", cpus_weight(cpu_core_map[cpunum])); |
627 | if (c->socket_id != -1) | ||
628 | seq_printf(m, "physical id: %u\n", c->socket_id); | ||
664 | if (c->threads_per_core > 1 || c->cores_per_socket > 1) | 629 | if (c->threads_per_core > 1 || c->cores_per_socket > 1) |
665 | seq_printf(m, | 630 | seq_printf(m, |
666 | "physical id: %u\n" | 631 | "core id : %u\n" |
667 | "core id : %u\n" | 632 | "thread id : %u\n", |
668 | "thread id : %u\n", | 633 | c->core_id, c->thread_id); |
669 | c->socket_id, c->core_id, c->thread_id); | ||
670 | #endif | 634 | #endif |
671 | seq_printf(m,"\n"); | 635 | seq_printf(m,"\n"); |
672 | 636 | ||
@@ -778,6 +742,9 @@ identify_cpu (struct cpuinfo_ia64 *c) | |||
778 | c->socket_id = -1; | 742 | c->socket_id = -1; |
779 | 743 | ||
780 | identify_siblings(c); | 744 | identify_siblings(c); |
745 | |||
746 | if (c->threads_per_core > smp_num_siblings) | ||
747 | smp_num_siblings = c->threads_per_core; | ||
781 | #endif | 748 | #endif |
782 | c->ppn = cpuid.field.ppn; | 749 | c->ppn = cpuid.field.ppn; |
783 | c->number = cpuid.field.number; | 750 | c->number = cpuid.field.number; |
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c index c57dbce25c1..f0fc4d8465a 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); | |||
142 | EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); | 142 | EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); |
143 | 143 | ||
144 | int smp_num_siblings = 1; | 144 | int smp_num_siblings = 1; |
145 | int smp_num_cpucores = 1; | ||
146 | 145 | ||
147 | /* which logical CPU number maps to which CPU (physical APIC ID) */ | 146 | /* which logical CPU number maps to which CPU (physical APIC ID) */ |
148 | volatile int ia64_cpu_to_sapicid[NR_CPUS]; | 147 | volatile int ia64_cpu_to_sapicid[NR_CPUS]; |
@@ -886,13 +885,17 @@ identify_siblings(struct cpuinfo_ia64 *c) | |||
886 | u16 pltid; | 885 | u16 pltid; |
887 | pal_logical_to_physical_t info; | 886 | pal_logical_to_physical_t info; |
888 | 887 | ||
889 | if (smp_num_cpucores == 1 && smp_num_siblings == 1) | ||
890 | return; | ||
891 | |||
892 | if ((status = ia64_pal_logical_to_phys(-1, &info)) != PAL_STATUS_SUCCESS) { | 888 | if ((status = ia64_pal_logical_to_phys(-1, &info)) != PAL_STATUS_SUCCESS) { |
893 | printk(KERN_ERR "ia64_pal_logical_to_phys failed with %ld\n", | 889 | if (status != PAL_STATUS_UNIMPLEMENTED) { |
894 | status); | 890 | printk(KERN_ERR |
895 | return; | 891 | "ia64_pal_logical_to_phys failed with %ld\n", |
892 | status); | ||
893 | return; | ||
894 | } | ||
895 | |||
896 | info.overview_ppid = 0; | ||
897 | info.overview_cpp = 1; | ||
898 | info.overview_tpc = 1; | ||
896 | } | 899 | } |
897 | if ((status = ia64_sal_physical_id_info(&pltid)) != PAL_STATUS_SUCCESS) { | 900 | if ((status = ia64_sal_physical_id_info(&pltid)) != PAL_STATUS_SUCCESS) { |
898 | printk(KERN_ERR "ia64_sal_pltid failed with %ld\n", status); | 901 | printk(KERN_ERR "ia64_sal_pltid failed with %ld\n", status); |
@@ -900,6 +903,10 @@ identify_siblings(struct cpuinfo_ia64 *c) | |||
900 | } | 903 | } |
901 | 904 | ||
902 | c->socket_id = (pltid << 8) | info.overview_ppid; | 905 | c->socket_id = (pltid << 8) | info.overview_ppid; |
906 | |||
907 | if (info.overview_cpp == 1 && info.overview_tpc == 1) | ||
908 | return; | ||
909 | |||
903 | c->cores_per_socket = info.overview_cpp; | 910 | c->cores_per_socket = info.overview_cpp; |
904 | c->threads_per_core = info.overview_tpc; | 911 | c->threads_per_core = info.overview_tpc; |
905 | c->num_log = info.overview_num_log; | 912 | c->num_log = info.overview_num_log; |