x86-32, NUMA: Make apic->x86_32_numa_cpu_node() optional
authorTejun Heo <tj@kernel.org>
Mon, 2 May 2011 12:18:52 +0000 (14:18 +0200)
committerTejun Heo <tj@kernel.org>
Mon, 2 May 2011 12:18:52 +0000 (14:18 +0200)
NUMAQ is the only meaningful user of this callback and
setup_local_APIC() the only callsite.  Stop torturing everyone else by
making the callback optional and removing all the boilerplate
implementations and assignments.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/apic.c
arch/x86/kernel/apic/apic_noop.c
arch/x86/kernel/apic/bigsmp_32.c
arch/x86/kernel/apic/es7000_32.c
arch/x86/kernel/apic/probe_32.c
arch/x86/kernel/apic/summit_32.c

index 2b7d573be5496863572be6dc724af256e00f4cf7..a0c46f0612106a220cd01f4d6fe81df61eeecb70 100644 (file)
@@ -363,7 +363,12 @@ struct apic {
         */
        int (*x86_32_early_logical_apicid)(int cpu);
 
-       /* determine CPU -> NUMA node mapping */
+       /*
+        * Optional method called from setup_local_APIC() after logical
+        * apicid is guaranteed to be known to initialize apicid -> node
+        * mapping if NUMA initialization hasn't done so already.  Don't
+        * add new users.
+        */
        int (*x86_32_numa_cpu_node)(int cpu);
 #endif
 };
@@ -537,8 +542,6 @@ static inline int default_phys_pkg_id(int cpuid_apic, int index_msb)
        return cpuid_apic >> index_msb;
 }
 
-extern int default_x86_32_numa_cpu_node(int cpu);
-
 #endif
 
 static inline unsigned int
index a6cd02a9268349eaec795596f4734c40b807f88b..0c67b4fc25b13637a62fad9f12b45df2130f3f65 100644 (file)
@@ -1245,8 +1245,9 @@ void __cpuinit setup_local_APIC(void)
         * a bit too late - percpu allocation has already happened without
         * proper NUMA affinity.
         */
-       set_apicid_to_node(early_per_cpu(x86_cpu_to_apicid, cpu),
-                          apic->x86_32_numa_cpu_node(cpu));
+       if (apic->x86_32_numa_cpu_node)
+               set_apicid_to_node(early_per_cpu(x86_cpu_to_apicid, cpu),
+                                  apic->x86_32_numa_cpu_node(cpu));
 #endif
 
        /*
@@ -2013,21 +2014,6 @@ void default_init_apic_ldr(void)
        apic_write(APIC_LDR, val);
 }
 
-#ifdef CONFIG_X86_32
-int default_x86_32_numa_cpu_node(int cpu)
-{
-#ifdef CONFIG_NUMA
-       int apicid = early_per_cpu(x86_cpu_to_apicid, cpu);
-
-       if (apicid != BAD_APICID)
-               return __apicid_to_node[apicid];
-       return NUMA_NO_NODE;
-#else
-       return 0;
-#endif
-}
-#endif
-
 /*
  * Power management
  */
index f1baa2dc087ac1b6b880c60c896fb05fb099be69..775b82bc655cbe49ba16afdc6aa03cdd0395990c 100644 (file)
@@ -119,14 +119,6 @@ static void noop_apic_write(u32 reg, u32 v)
        WARN_ON_ONCE(cpu_has_apic && !disable_apic);
 }
 
-#ifdef CONFIG_X86_32
-static int noop_x86_32_numa_cpu_node(int cpu)
-{
-       /* we're always on node 0 */
-       return 0;
-}
-#endif
-
 struct apic apic_noop = {
        .name                           = "noop",
        .probe                          = noop_probe,
@@ -195,6 +187,5 @@ struct apic apic_noop = {
 
 #ifdef CONFIG_X86_32
        .x86_32_early_logical_apicid    = noop_x86_32_early_logical_apicid,
-       .x86_32_numa_cpu_node           = noop_x86_32_numa_cpu_node,
 #endif
 };
index 541a2e43165942490453aa315eb6bbf9f7accbae..d84ac5a584b511291e7677bca5f11caf457435b7 100644 (file)
@@ -253,5 +253,4 @@ struct apic apic_bigsmp = {
        .safe_wait_icr_idle             = native_safe_apic_wait_icr_idle,
 
        .x86_32_early_logical_apicid    = bigsmp_early_logical_apicid,
-       .x86_32_numa_cpu_node           = default_x86_32_numa_cpu_node,
 };
index 3e9de4854c5b5253bf041ef60dbc3d594b665b80..70533de5bd29741c41b03b1cc8c989740c4ff15c 100644 (file)
@@ -510,11 +510,6 @@ static void es7000_setup_apic_routing(void)
                nr_ioapics, cpumask_bits(es7000_target_cpus())[0]);
 }
 
-static int es7000_numa_cpu_node(int cpu)
-{
-       return 0;
-}
-
 static int es7000_cpu_present_to_apicid(int mps_cpu)
 {
        if (!mps_cpu)
@@ -688,7 +683,6 @@ struct apic __refdata apic_es7000_cluster = {
        .safe_wait_icr_idle             = native_safe_apic_wait_icr_idle,
 
        .x86_32_early_logical_apicid    = es7000_early_logical_apicid,
-       .x86_32_numa_cpu_node           = es7000_numa_cpu_node,
 };
 
 struct apic __refdata apic_es7000 = {
@@ -752,5 +746,4 @@ struct apic __refdata apic_es7000 = {
        .safe_wait_icr_idle             = native_safe_apic_wait_icr_idle,
 
        .x86_32_early_logical_apicid    = es7000_early_logical_apicid,
-       .x86_32_numa_cpu_node           = es7000_numa_cpu_node,
 };
index fc84c7b61108086448295821abfc2daca5d0c391..6541e471fd9195535a6198efa87d738ee25afbba 100644 (file)
@@ -172,7 +172,6 @@ struct apic apic_default = {
        .safe_wait_icr_idle             = native_safe_apic_wait_icr_idle,
 
        .x86_32_early_logical_apicid    = default_x86_32_early_logical_apicid,
-       .x86_32_numa_cpu_node           = default_x86_32_numa_cpu_node,
 };
 
 extern struct apic apic_numaq;
index e4b8059b414a800627c95eb9269d9c7f4fbd1774..35bcd7d995a137ecd98cb30c510418b725bf001c 100644 (file)
@@ -551,5 +551,4 @@ struct apic apic_summit = {
        .safe_wait_icr_idle             = native_safe_apic_wait_icr_idle,
 
        .x86_32_early_logical_apicid    = summit_early_logical_apicid,
-       .x86_32_numa_cpu_node           = default_x86_32_numa_cpu_node,
 };