Commit 8c56ac3f authored by Ravikiran G Thirumalai's avatar Ravikiran G Thirumalai Committed by Linus Torvalds

[PATCH] x86_64: fix cpu_to_node setup for sparse apic_ids

While booting with SMT disabled in bios, when using acpi srat to setup
cpu_to_node[], sparse apic_ids create problems.

Without this patch, intel x86_64 boxes with hyperthreading disabled in the
bios (and which rely on srat for numa setup) endup having incorrect values in
cpu_to_node[] arrays, causing sched domains to be built incorrectly etc.
Signed-off-by: default avatarRavikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: default avatarShai Fultheim <shai@scalex86.org>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5a7b9013
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
static struct acpi_table_slit *acpi_slit; static struct acpi_table_slit *acpi_slit;
/* Internal processor count */
static unsigned int __initdata num_processors = 0;
static nodemask_t nodes_parsed __initdata; static nodemask_t nodes_parsed __initdata;
static nodemask_t nodes_found __initdata; static nodemask_t nodes_found __initdata;
static struct node nodes[MAX_NUMNODES] __initdata; static struct node nodes[MAX_NUMNODES] __initdata;
...@@ -101,16 +104,18 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) ...@@ -101,16 +104,18 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
bad_srat(); bad_srat();
return; return;
} }
if (pa->apic_id >= NR_CPUS) { if (num_processors >= NR_CPUS) {
printk(KERN_ERR "SRAT: lapic %u too large.\n", printk(KERN_ERR "SRAT: Processor #%d (lapic %u) INVALID. (Max ID: %d).\n",
pa->apic_id); num_processors, pa->apic_id, NR_CPUS);
bad_srat(); bad_srat();
return; return;
} }
cpu_to_node[pa->apic_id] = node; cpu_to_node[num_processors] = node;
acpi_numa = 1; acpi_numa = 1;
printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n", printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> CPU %u -> Node %u\n",
pxm, pa->apic_id, node); pxm, pa->apic_id, num_processors, node);
num_processors++;
} }
/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment