Commit 095adbb6441172985f5ddc3b9e88cb3191bdeac4
Committed by
Len Brown
1 parent
f3946fb6e5
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
ACPI: Only count valid srat memory structures
Otherwise you could run into: WARN_ON in numa_register_memblks(), because node_possible_map is zero References: https://bugzilla.novell.com/show_bug.cgi?id=757888 On this machine (ProLiant ML570 G3) the SRAT table contains: - No processor affinities - One memory affinity structure (which is set disabled) CC: Per Jessen <per@opensuse.org> CC: Andi Kleen <andi@firstfloor.org> Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Showing 4 changed files with 17 additions and 13 deletions Side-by-side Diff
arch/ia64/kernel/acpi.c
... | ... | @@ -497,7 +497,7 @@ |
497 | 497 | srat_num_cpus++; |
498 | 498 | } |
499 | 499 | |
500 | -void __init | |
500 | +int __init | |
501 | 501 | acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) |
502 | 502 | { |
503 | 503 | unsigned long paddr, size; |
... | ... | @@ -512,7 +512,7 @@ |
512 | 512 | |
513 | 513 | /* Ignore disabled entries */ |
514 | 514 | if (!(ma->flags & ACPI_SRAT_MEM_ENABLED)) |
515 | - return; | |
515 | + return -1; | |
516 | 516 | |
517 | 517 | /* record this node in proximity bitmap */ |
518 | 518 | pxm_bit_set(pxm); |
... | ... | @@ -531,6 +531,7 @@ |
531 | 531 | p->size = size; |
532 | 532 | p->nid = pxm; |
533 | 533 | num_node_memblks++; |
534 | + return 0; | |
534 | 535 | } |
535 | 536 | |
536 | 537 | void __init acpi_numa_arch_fixup(void) |
arch/x86/mm/srat.c
... | ... | @@ -142,23 +142,23 @@ |
142 | 142 | #endif |
143 | 143 | |
144 | 144 | /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ |
145 | -void __init | |
145 | +int __init | |
146 | 146 | acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) |
147 | 147 | { |
148 | 148 | u64 start, end; |
149 | 149 | int node, pxm; |
150 | 150 | |
151 | 151 | if (srat_disabled()) |
152 | - return; | |
152 | + return -1; | |
153 | 153 | if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) { |
154 | 154 | bad_srat(); |
155 | - return; | |
155 | + return -1; | |
156 | 156 | } |
157 | 157 | if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0) |
158 | - return; | |
158 | + return -1; | |
159 | 159 | |
160 | 160 | if ((ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && !save_add_info()) |
161 | - return; | |
161 | + return -1; | |
162 | 162 | start = ma->base_address; |
163 | 163 | end = start + ma->length; |
164 | 164 | pxm = ma->proximity_domain; |
165 | 165 | |
... | ... | @@ -168,12 +168,12 @@ |
168 | 168 | if (node < 0) { |
169 | 169 | printk(KERN_ERR "SRAT: Too many proximity domains.\n"); |
170 | 170 | bad_srat(); |
171 | - return; | |
171 | + return -1; | |
172 | 172 | } |
173 | 173 | |
174 | 174 | if (numa_add_memblk(node, start, end) < 0) { |
175 | 175 | bad_srat(); |
176 | - return; | |
176 | + return -1; | |
177 | 177 | } |
178 | 178 | |
179 | 179 | node_set(node, numa_nodes_parsed); |
... | ... | @@ -181,6 +181,7 @@ |
181 | 181 | printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n", |
182 | 182 | node, pxm, |
183 | 183 | (unsigned long long) start, (unsigned long long) end - 1); |
184 | + return 0; | |
184 | 185 | } |
185 | 186 | |
186 | 187 | void __init acpi_numa_arch_fixup(void) {} |
drivers/acpi/numa.c
... | ... | @@ -237,6 +237,8 @@ |
237 | 237 | return 0; |
238 | 238 | } |
239 | 239 | |
240 | +static int __initdata parsed_numa_memblks; | |
241 | + | |
240 | 242 | static int __init |
241 | 243 | acpi_parse_memory_affinity(struct acpi_subtable_header * header, |
242 | 244 | const unsigned long end) |
... | ... | @@ -250,8 +252,8 @@ |
250 | 252 | acpi_table_print_srat_entry(header); |
251 | 253 | |
252 | 254 | /* let architecture-dependent part to do it */ |
253 | - acpi_numa_memory_affinity_init(memory_affinity); | |
254 | - | |
255 | + if (!acpi_numa_memory_affinity_init(memory_affinity)) | |
256 | + parsed_numa_memblks++; | |
255 | 257 | return 0; |
256 | 258 | } |
257 | 259 | |
... | ... | @@ -306,7 +308,7 @@ |
306 | 308 | |
307 | 309 | if (cnt < 0) |
308 | 310 | return cnt; |
309 | - else if (cnt == 0) | |
311 | + else if (!parsed_numa_memblks) | |
310 | 312 | return -ENOENT; |
311 | 313 | return 0; |
312 | 314 | } |
include/linux/acpi.h
... | ... | @@ -96,7 +96,7 @@ |
96 | 96 | void acpi_numa_slit_init (struct acpi_table_slit *slit); |
97 | 97 | void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); |
98 | 98 | void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa); |
99 | -void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); | |
99 | +int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); | |
100 | 100 | void acpi_numa_arch_fixup(void); |
101 | 101 | |
102 | 102 | #ifdef CONFIG_ACPI_HOTPLUG_CPU |