]> Pileus Git - ~andy/linux/commitdiff
x86: Add x86_init platform override to fix up NUMA core numbering
authorDaniel J Blueman <daniel@numascale-asia.com>
Mon, 5 Dec 2011 08:20:37 +0000 (16:20 +0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 5 Dec 2011 16:17:21 +0000 (17:17 +0100)
Add an x86_init vector for handling inconsistent core numbering.
This is useful for multi-fabric platforms, such as Numascale
NumaConnect.

v2:
 - use struct x86_cpuinit_ops
 - provide default fall-back function to warn

Signed-off-by: Daniel J Blueman <daniel@numascale-asia.com>
Cc: Steffen Persvold <sp@numascale.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Link: http://lkml.kernel.org/r/1323073238-32686-2-git-send-email-daniel@numascale-asia.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/x86_init.h
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/common.c
arch/x86/kernel/x86_init.c

index 1971e652d24be5fc0674633c1edb3717645306e7..1ac860a098495e70421563d1bd0d9f2b3b848448 100644 (file)
@@ -7,6 +7,7 @@
 struct mpc_bus;
 struct mpc_cpu;
 struct mpc_table;
+struct cpuinfo_x86;
 
 /**
  * struct x86_init_mpparse - platform specific mpparse ops
@@ -147,6 +148,7 @@ struct x86_init_ops {
  */
 struct x86_cpuinit_ops {
        void (*setup_percpu_clockev)(void);
+       void (*fixup_cpu_id)(struct cpuinfo_x86 *c, int node);
 };
 
 /**
@@ -186,5 +188,6 @@ extern struct x86_msi_ops x86_msi;
 
 extern void x86_init_noop(void);
 extern void x86_init_uint_noop(unsigned int unused);
+extern void x86_default_fixup_cpu_id(struct cpuinfo_x86 *c, int node);
 
 #endif
index 0bab2b18bb2099c4290f046bb210035b05083869..ef21bdccd674db5b333ae90f135de6cd7990c014 100644 (file)
@@ -353,6 +353,13 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
        if (node == NUMA_NO_NODE)
                node = per_cpu(cpu_llc_id, cpu);
 
+       /*
+        * If core numbers are inconsistent, it's likely a multi-fabric platform,
+        * so invoke platform-specific handler
+        */
+       if (c->phys_proc_id != node)
+               x86_cpuinit.fixup_cpu_id(c, node);
+
        if (!node_online(node)) {
                /*
                 * Two possibilities here:
index aa003b13a83131db63e3f594c0cadb34e9f89b93..ad4da45effb91d5dec060142e289ec97ed9a0eee 100644 (file)
@@ -1140,6 +1140,15 @@ static void dbg_restore_debug_regs(void)
 #define dbg_restore_debug_regs()
 #endif /* ! CONFIG_KGDB */
 
+/*
+ * Prints an error where the NUMA and configured core-number mismatch and the
+ * platform didn't override this to fix it up
+ */
+void __cpuinit x86_default_fixup_cpu_id(struct cpuinfo_x86 *c, int node)
+{
+       pr_err("NUMA core number %d differs from configured core number %d\n", node, c->phys_proc_id);
+}
+
 /*
  * cpu_init() initializes state that is per-CPU. Some data is already
  * initialized (naturally) in the bootstrap process, such as the GDT
index c1d6cd549397ad54dbcb32526c9170e1f590a759..91f83e21b989e54147b4e8750a4f2be909a8f78f 100644 (file)
@@ -92,6 +92,7 @@ struct x86_init_ops x86_init __initdata = {
 
 struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = {
        .setup_percpu_clockev           = setup_secondary_APIC_clock,
+       .fixup_cpu_id                   = x86_default_fixup_cpu_id,
 };
 
 static void default_nmi_init(void) { };