[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Make the num_siblings CPU parameter per-CPU.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1232622354 0
# Node ID a37267e433654441b77ecefb6a68018bbc841bb1
# Parent  af1d9af1a993001bdfdb81d9af1af4fd4a9d3852
x86: Make the num_siblings CPU parameter per-CPU.

While it is unlikely that a system has a different number of siblings
for different physical CPUs,  make this parameter per-CPU for
consistency, and deal with the (so far theoretical) case that this is
different per CPU package.

Signed-off-by: Frank van der Linden <Frank.Vanderlinden@xxxxxxx>
---
 xen/arch/x86/cpu/common.c           |   25 +++++++++++++------------
 xen/arch/x86/cpu/mcheck/mce_intel.c |    3 ++-
 xen/arch/x86/nmi.c                  |    2 +-
 xen/arch/x86/oprofile/nmi_int.c     |    2 +-
 xen/arch/x86/oprofile/op_model_p4.c |    4 ++--
 xen/arch/x86/smpboot.c              |   10 ++--------
 xen/include/asm-x86/processor.h     |    1 +
 xen/include/asm-x86/smp.h           |    1 -
 8 files changed, 22 insertions(+), 26 deletions(-)

diff -r af1d9af1a993 -r a37267e43365 xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c Wed Jan 21 14:44:43 2009 +0000
+++ b/xen/arch/x86/cpu/common.c Thu Jan 22 11:05:54 2009 +0000
@@ -338,6 +338,7 @@ void __cpuinit identify_cpu(struct cpuin
        c->x86_vendor_id[0] = '\0'; /* Unset */
        c->x86_model_id[0] = '\0';  /* Unset */
        c->x86_max_cores = 1;
+       c->x86_num_siblings = 1;
        c->x86_clflush_size = 0;
        memset(&c->x86_capability, 0, sizeof c->x86_capability);
 
@@ -480,27 +481,27 @@ void __cpuinit detect_ht(struct cpuinfo_
        if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY))
                return;
 
-       smp_num_siblings = (ebx & 0xff0000) >> 16;
-
-       if (smp_num_siblings == 1) {
+       c->x86_num_siblings = (ebx & 0xff0000) >> 16;
+
+       if (c->x86_num_siblings == 1) {
                printk(KERN_INFO  "CPU: Hyper-Threading is disabled\n");
-       } else if (smp_num_siblings > 1 ) {
-
-               if (smp_num_siblings > NR_CPUS) {
-                       printk(KERN_WARNING "CPU: Unsupported number of the 
siblings %d", smp_num_siblings);
-                       smp_num_siblings = 1;
+       } else if (c->x86_num_siblings > 1 ) {
+
+               if (c->x86_num_siblings > NR_CPUS) {
+                       printk(KERN_WARNING "CPU: Unsupported number of the 
siblings %d", c->x86_num_siblings);
+                       c->x86_num_siblings = 1;
                        return;
                }
 
-               index_msb = get_count_order(smp_num_siblings);
+               index_msb = get_count_order(c->x86_num_siblings);
                phys_proc_id[cpu] = phys_pkg_id((ebx >> 24) & 0xFF, index_msb);
 
                printk(KERN_INFO  "CPU: Physical Processor ID: %d\n",
                       phys_proc_id[cpu]);
 
-               smp_num_siblings = smp_num_siblings / c->x86_max_cores;
-
-               index_msb = get_count_order(smp_num_siblings) ;
+               c->x86_num_siblings = c->x86_num_siblings / c->x86_max_cores;
+
+               index_msb = get_count_order(c->x86_num_siblings) ;
 
                core_bits = get_count_order(c->x86_max_cores);
 
diff -r af1d9af1a993 -r a37267e43365 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c       Wed Jan 21 14:44:43 2009 +0000
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c       Thu Jan 22 11:05:54 2009 +0000
@@ -186,7 +186,8 @@ static struct mc_info *machine_check_pol
     mcg.mc_socketid = phys_proc_id[cpu];
     mcg.mc_coreid = cpu_core_id[cpu];
     mcg.mc_apicid = cpu_physical_id(cpu);
-    mcg.mc_core_threadid = mcg.mc_apicid & ( 1 << (smp_num_siblings - 1)); 
+    mcg.mc_core_threadid =
+        mcg.mc_apicid & ( 1 << (cpu_data[cpu].x86_num_siblings - 1)); 
     rdmsrl(MSR_IA32_MCG_STATUS, mcg.mc_gstatus);
 
     for ( i = 0; i < nr_mce_banks; i++ ) {
diff -r af1d9af1a993 -r a37267e43365 xen/arch/x86/nmi.c
--- a/xen/arch/x86/nmi.c        Wed Jan 21 14:44:43 2009 +0000
+++ b/xen/arch/x86/nmi.c        Thu Jan 22 11:05:54 2009 +0000
@@ -286,7 +286,7 @@ static int __pminit setup_p4_watchdog(vo
 
     nmi_perfctr_msr = MSR_P4_IQ_PERFCTR0;
     nmi_p4_cccr_val = P4_NMI_IQ_CCCR0;
-    if ( smp_num_siblings == 2 )
+    if ( boot_cpu_data.x86_num_siblings == 2 )
         nmi_p4_cccr_val |= P4_CCCR_OVF_PMI1;
 
     if (!(misc_enable & MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL))
diff -r af1d9af1a993 -r a37267e43365 xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c   Wed Jan 21 14:44:43 2009 +0000
+++ b/xen/arch/x86/oprofile/nmi_int.c   Thu Jan 22 11:05:54 2009 +0000
@@ -326,7 +326,7 @@ static int __init p4_init(char ** cpu_ty
        model = &op_p4_spec;
        return 1;
 #else
-       switch (smp_num_siblings) {
+       switch (current_cpu_data.x86_num_siblings) {
                case 1:
                        *cpu_type = "i386/p4";
                        model = &op_p4_spec;
diff -r af1d9af1a993 -r a37267e43365 xen/arch/x86/oprofile/op_model_p4.c
--- a/xen/arch/x86/oprofile/op_model_p4.c       Wed Jan 21 14:44:43 2009 +0000
+++ b/xen/arch/x86/oprofile/op_model_p4.c       Thu Jan 22 11:05:54 2009 +0000
@@ -41,7 +41,7 @@ static inline void setup_num_counters(vo
 static inline void setup_num_counters(void)
 {
 #ifdef CONFIG_SMP
-       if (smp_num_siblings == 2)
+       if (boot_cpu_data.x86_num_siblings == 2)        /* XXX */
                num_counters = NUM_COUNTERS_HT2;
 #endif
 }
@@ -49,7 +49,7 @@ static int inline addr_increment(void)
 static int inline addr_increment(void)
 {
 #ifdef CONFIG_SMP
-       return smp_num_siblings == 2 ? 2 : 1;
+       return boot_cpu_data.x86_num_siblings == 2 ? 2 : 1;
 #else
        return 1;
 #endif
diff -r af1d9af1a993 -r a37267e43365 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Wed Jan 21 14:44:43 2009 +0000
+++ b/xen/arch/x86/smpboot.c    Thu Jan 22 11:05:54 2009 +0000
@@ -63,12 +63,6 @@
 /* Set if we find a B stepping CPU */
 static int __devinitdata smp_b_stepping;
 
-/* Number of siblings per CPU package */
-int smp_num_siblings = 1;
-#ifdef CONFIG_X86_HT
-EXPORT_SYMBOL(smp_num_siblings);
-#endif
-
 /* Package ID of each logical CPU */
 int phys_proc_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID};
 
@@ -423,7 +417,7 @@ set_cpu_sibling_map(int cpu)
 
        cpu_set(cpu, cpu_sibling_setup_map);
 
-       if (smp_num_siblings > 1) {
+       if (c[cpu].x86_num_siblings > 1) {
                for_each_cpu_mask(i, cpu_sibling_setup_map) {
                        if (phys_proc_id[cpu] == phys_proc_id[i] &&
                            cpu_core_id[cpu] == cpu_core_id[i]) {
@@ -437,7 +431,7 @@ set_cpu_sibling_map(int cpu)
                cpu_set(cpu, cpu_sibling_map[cpu]);
        }
 
-       if (current_cpu_data.x86_max_cores == 1) {
+       if (c[cpu].x86_max_cores == 1) {
                cpu_core_map[cpu] = cpu_sibling_map[cpu];
                c[cpu].booted_cores = 1;
                return;
diff -r af1d9af1a993 -r a37267e43365 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h   Wed Jan 21 14:44:43 2009 +0000
+++ b/xen/include/asm-x86/processor.h   Thu Jan 22 11:05:54 2009 +0000
@@ -169,6 +169,7 @@ struct cpuinfo_x86 {
     int  x86_power;
     __u32 x86_max_cores; /* cpuid returned max cores value */
     __u32 booted_cores;  /* number of cores as seen by OS */
+    __u32 x86_num_siblings; /* cpuid logical cpus per chip value */
     __u32 apicid;
     unsigned short x86_clflush_size;
 } __cacheline_aligned;
diff -r af1d9af1a993 -r a37267e43365 xen/include/asm-x86/smp.h
--- a/xen/include/asm-x86/smp.h Wed Jan 21 14:44:43 2009 +0000
+++ b/xen/include/asm-x86/smp.h Thu Jan 22 11:05:54 2009 +0000
@@ -32,7 +32,6 @@
  
 extern void smp_alloc_memory(void);
 extern int pic_mode;
-extern int smp_num_siblings;
 extern cpumask_t cpu_sibling_map[];
 extern cpumask_t cpu_core_map[];
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.