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

[Xen-changelog] [xen-unstable] x86: make cpu_2_logical_apicid private to x2apic code


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Thu, 08 Nov 2012 21:44:07 +0000
  • Delivery-date: Thu, 08 Nov 2012 21:44:20 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1352393772 -3600
# Node ID f05a99beba73c30ea5d2439508699cf2fb50f0e5
# Parent  92163b114076029842d0f2d1dbfaa445976c71a3
x86: make cpu_2_logical_apicid private to x2apic code

... as it in fact is only being used there. While moving it, also make
it a per-CPU variable rather than a NR_CPUS-sized array.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c       Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/apic.c       Thu Nov 08 17:56:12 2012 +0100
@@ -1024,7 +1024,6 @@ __next:
     if (boot_cpu_physical_apicid == -1U)
         boot_cpu_physical_apicid = get_apic_id();
     x86_cpu_to_apicid[0] = get_apic_id();
-    cpu_2_logical_apicid[0] = get_logical_apic_id();
 
     init_ioapic_mappings();
 }
diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/genapic/x2apic.c
--- a/xen/arch/x86/genapic/x2apic.c     Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/genapic/x2apic.c     Thu Nov 08 17:56:12 2012 +0100
@@ -32,14 +32,15 @@
 static bool_t __initdata x2apic_phys; /* By default we use logical cluster 
mode. */
 boolean_param("x2apic_phys", x2apic_phys);
 
+static DEFINE_PER_CPU_READ_MOSTLY(u32, cpu_2_logical_apicid);
+
 static void init_apic_ldr_x2apic_phys(void)
 {
 }
 
 static void init_apic_ldr_x2apic_cluster(void)
 {
-    int cpu = smp_processor_id();
-    cpu_2_logical_apicid[cpu] = apic_read(APIC_LDR);
+    this_cpu(cpu_2_logical_apicid) = apic_read(APIC_LDR);
 }
 
 static void __init clustered_apic_check_x2apic(void)
@@ -48,7 +49,7 @@ static void __init clustered_apic_check_
 
 static unsigned int cpu_mask_to_apicid_x2apic_cluster(const cpumask_t *cpumask)
 {
-    return cpu_2_logical_apicid[cpumask_first(cpumask)];
+    return per_cpu(cpu_2_logical_apicid, cpumask_first(cpumask));
 }
 
 static void __send_IPI_mask_x2apic(
@@ -77,7 +78,7 @@ static void __send_IPI_mask_x2apic(
         if ( !cpu_online(cpu) || (cpu == smp_processor_id()) )
             continue;
         msr_content = (dest_mode == APIC_DEST_PHYSICAL)
-            ? cpu_physical_id(cpu) : cpu_2_logical_apicid[cpu];
+            ? cpu_physical_id(cpu) : per_cpu(cpu_2_logical_apicid, cpu);
         msr_content = (msr_content << 32) | APIC_DM_FIXED | dest_mode | vector;
         apic_wrmsr(APIC_ICR, msr_content);
     }
diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c        Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/smp.c        Thu Nov 08 17:56:12 2012 +0100
@@ -28,11 +28,6 @@ int hard_smp_processor_id(void)
     return get_apic_id();
 }
 
-int logical_smp_processor_id(void)
-{
-    return get_logical_apic_id();
-}
-
 /*
  * send_IPI_mask(cpumask, vector): sends @vector IPI to CPUs in @cpumask,
  * excluding the local CPU. @cpumask may be empty.
diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/smpboot.c    Thu Nov 08 17:56:12 2012 +0100
@@ -64,8 +64,6 @@ struct cpuinfo_x86 cpu_data[NR_CPUS];
 u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly =
        { [0 ... NR_CPUS-1] = BAD_APICID };
 
-static void map_cpu_to_logical_apicid(void);
-
 static int cpu_error;
 static enum cpu_state {
     CPU_STATE_DYING,    /* slave -> master: I am dying */
@@ -202,7 +200,6 @@ void smp_callin(void)
     Dprintk("CALLIN, before setup_local_APIC().\n");
     x2apic_ap_setup();
     setup_local_APIC();
-    map_cpu_to_logical_apicid();
 
     /* Save our processor parameters. */
     smp_store_cpu_info(cpu);
@@ -401,22 +398,6 @@ extern struct {
     unsigned short ss;
 } stack_start;
 
-u32 cpu_2_logical_apicid[NR_CPUS] __read_mostly =
-    { [0 ... NR_CPUS-1] = BAD_APICID };
-
-static void map_cpu_to_logical_apicid(void)
-{
-    int cpu = smp_processor_id();
-    int apicid = logical_smp_processor_id();
-
-    cpu_2_logical_apicid[cpu] = apicid;
-}
-
-static void unmap_cpu_to_logical_apicid(int cpu)
-{
-    cpu_2_logical_apicid[cpu] = BAD_APICID;
-}
-
 static int wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
 {
     unsigned long send_status = 0, accept_status = 0;
@@ -646,7 +627,6 @@ static int do_boot_cpu(int apicid, int c
 void cpu_exit_clear(unsigned int cpu)
 {
     cpu_uninit(cpu);
-    unmap_cpu_to_logical_apicid(cpu);
     set_cpu_state(CPU_STATE_DEAD);
 }
 
@@ -775,7 +755,6 @@ void __init smp_prepare_cpus(unsigned in
         if (APIC_init_uniprocessor())
             printk(KERN_NOTICE "Local APIC not detected."
                    " Using dummy APIC emulation.\n");
-        map_cpu_to_logical_apicid();
         return;
     }
 
@@ -804,7 +783,6 @@ void __init smp_prepare_cpus(unsigned in
 
     connect_bsp_APIC();
     setup_local_APIC();
-    map_cpu_to_logical_apicid();
 
     smpboot_setup_io_apic();
 
diff -r 92163b114076 -r f05a99beba73 xen/include/asm-x86/apic.h
--- a/xen/include/asm-x86/apic.h        Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/include/asm-x86/apic.h        Thu Nov 08 17:56:12 2012 +0100
@@ -158,12 +158,6 @@ static __inline u32 get_apic_id(void) /*
     return x2apic_enabled ? id : GET_xAPIC_ID(id);
 }
 
-static __inline u32 get_logical_apic_id(void)
-{
-    u32 logical_id = apic_read(APIC_LDR);
-    return x2apic_enabled ? logical_id : GET_xAPIC_LOGICAL_ID(logical_id);
-}
-
 void apic_wait_icr_idle(void);
 
 int get_physical_broadcast(void);
diff -r 92163b114076 -r f05a99beba73 xen/include/asm-x86/smp.h
--- a/xen/include/asm-x86/smp.h Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/include/asm-x86/smp.h Thu Nov 08 17:56:12 2012 +0100
@@ -37,7 +37,6 @@ extern void zap_low_mappings(void);
 
 #define MAX_APICID 256
 extern u32 x86_cpu_to_apicid[];
-extern u32 cpu_2_logical_apicid[];
 
 #define cpu_physical_id(cpu)   x86_cpu_to_apicid[cpu]
 
@@ -54,7 +53,6 @@ int cpu_add(uint32_t apic_id, uint32_t a
 #define raw_smp_processor_id() (get_processor_id())
 
 int hard_smp_processor_id(void);
-int logical_smp_processor_id(void);
 
 void __stop_this_cpu(void);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.