[PATCH 2/3] Add x86_init platform override to fix up core numbering

From: Daniel J Blueman
Date: Fri Dec 02 2011 - 12:17:48 EST


Add an x86_init vector for handling inconsistent core numbering. This is
useful for multi-fabric platforms, such as NumaScale Numaconnect.

Signed-off-by: Daniel J Blueman <daniel@xxxxxxxxxxxxxxxxxx>
---
arch/x86/include/asm/x86_init.h | 2 ++
arch/x86/kernel/cpu/amd.c | 11 +++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index 1971e65..bb5fedb 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -7,6 +7,7 @@
struct mpc_bus;
struct mpc_cpu;
struct mpc_table;
+struct cpuinfo_x86;

/**
* struct x86_init_mpparse - platform specific mpparse ops
@@ -23,6 +24,7 @@ struct x86_init_mpparse {
void (*mpc_record)(unsigned int mode);
void (*setup_ioapic_ids)(void);
int (*mpc_apic_id)(struct mpc_cpu *m);
+ void (*fixup_cpu_id)(struct cpuinfo_x86 *c, int node);
void (*smp_read_mpc_oem)(struct mpc_table *mpc);
void (*mpc_oem_pci_bus)(struct mpc_bus *m);
void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name);
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index c7e46cb..6fb2345 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -353,6 +353,17 @@ 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) {
+ if (x86_init.mpparse.fixup_cpu_id)
+ x86_init.mpparse.fixup_cpu_id(c, node);
+ else
+ pr_warning("NUMA core number %d differs from HT core number %d\n", node, c->phys_proc_id);
+ }
+
if (!node_online(node)) {
/*
* Two possibilities here:
--
1.7.5.4


--------------010403040301020808040403
Content-Type: text/x-patch;
name="0003-NumaChip-support.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="0003-NumaChip-support.patch"