Skip to content

Commit 702b07f

Browse files
lukaszanrafaeljw
authored andcommitted
ACPI / SRAT: fix SRAT parsing order with both LAPIC and X2APIC present
SRAT maps APIC ID to proximity domains ids (PXM). Mapping from PXM to NUMA node ids is based on order of entries in SRAT table. SRAT table has just LAPIC entires or mix of LAPIC and X2APIC entries. As long as there are only LAPIC entires, mapping from proximity domain id to NUMA node id is as assumed by BIOS. However, once APIC entries are mixed, X2APIC entries would be first mapped which causes unexpected NUMA node mapping. To fix that, change parsing to check each entry against both LAPIC and X2APIC so mapping is in the SRAT/PXM order. This is supplemental change to the fix made by commit d81056b (Handle apic/x2apic entries in MADT in correct order) and using the mechanism introduced by 9b3fedd (ACPI / tables: Add acpi_subtable_proc to ACPI table parsers). Fixes: d81056b (Handle apic/x2apic entries in MADT in correct order) Signed-off-by: Lukasz Anaczkowski <[email protected]> [ rjw : Subject & changelog ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent c3b46c7 commit 702b07f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/acpi/numa.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,18 @@ int __init acpi_numa_init(void)
327327

328328
/* SRAT: Static Resource Affinity Table */
329329
if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
330-
acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY,
331-
acpi_parse_x2apic_affinity, 0);
332-
acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
333-
acpi_parse_processor_affinity, 0);
330+
struct acpi_subtable_proc srat_proc[2];
331+
332+
memset(srat_proc, 0, sizeof(srat_proc));
333+
srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY;
334+
srat_proc[0].handler = acpi_parse_processor_affinity;
335+
srat_proc[1].id = ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY;
336+
srat_proc[1].handler = acpi_parse_x2apic_affinity;
337+
338+
acpi_table_parse_entries_array(ACPI_SIG_SRAT,
339+
sizeof(struct acpi_table_srat),
340+
srat_proc, ARRAY_SIZE(srat_proc), 0);
341+
334342
cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
335343
acpi_parse_memory_affinity,
336344
NR_NODE_MEMBLKS);

0 commit comments

Comments
 (0)