diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2016-08-25 04:35:18 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-09-21 15:18:39 -0400 |
commit | dc6db24d2476cd09c0ecf2b8d80313539f737a89 (patch) | |
tree | a42cb20e94757560eeabaf8ebe800254e166e8b2 /drivers/acpi/processor_core.c | |
parent | 8ad893faf2eaedb710a3073afbb5d569df2c3e41 (diff) |
x86/acpi: Set persistent cpuid <-> nodeid mapping when booting
The whole patch-set aims at making cpuid <-> nodeid mapping persistent. So that,
when node online/offline happens, cache based on cpuid <-> nodeid mapping such as
wq_numa_possible_cpumask will not cause any problem.
It contains 4 steps:
1. Enable apic registeration flow to handle both enabled and disabled cpus.
2. Introduce a new array storing all possible cpuid <-> apicid mapping.
3. Enable _MAT and MADT relative apis to return non-present or disabled cpus' apicid.
4. Establish all possible cpuid <-> nodeid mapping.
This patch finishes step 4.
This patch set the persistent cpuid <-> nodeid mapping for all enabled/disabled
processors at boot time via an additional acpi namespace walk for processors.
[ tglx: Remove the unneeded exports ]
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: mika.j.penttila@gmail.com
Cc: len.brown@intel.com
Cc: rafael@kernel.org
Cc: rjw@rjwysocki.net
Cc: yasu.isimatu@gmail.com
Cc: linux-mm@kvack.org
Cc: linux-acpi@vger.kernel.org
Cc: isimatu.yasuaki@jp.fujitsu.com
Cc: gongzhaogang@inspur.com
Cc: tj@kernel.org
Cc: izumi.taku@jp.fujitsu.com
Cc: cl@linux.com
Cc: chen.tang@easystack.cn
Cc: akpm@linux-foundation.org
Cc: kamezawa.hiroyu@jp.fujitsu.com
Cc: lenb@kernel.org
Link: http://lkml.kernel.org/r/1472114120-3281-6-git-send-email-douly.fnst@cn.fujitsu.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/acpi/processor_core.c')
-rw-r--r-- | drivers/acpi/processor_core.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index fd59ae871db3..88019766a59a 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -280,6 +280,74 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) | |||
280 | } | 280 | } |
281 | EXPORT_SYMBOL_GPL(acpi_get_cpuid); | 281 | EXPORT_SYMBOL_GPL(acpi_get_cpuid); |
282 | 282 | ||
283 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | ||
284 | static bool __init | ||
285 | map_processor(acpi_handle handle, phys_cpuid_t *phys_id, int *cpuid) | ||
286 | { | ||
287 | int type; | ||
288 | u32 acpi_id; | ||
289 | acpi_status status; | ||
290 | acpi_object_type acpi_type; | ||
291 | unsigned long long tmp; | ||
292 | union acpi_object object = { 0 }; | ||
293 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | ||
294 | |||
295 | status = acpi_get_type(handle, &acpi_type); | ||
296 | if (ACPI_FAILURE(status)) | ||
297 | return false; | ||
298 | |||
299 | switch (acpi_type) { | ||
300 | case ACPI_TYPE_PROCESSOR: | ||
301 | status = acpi_evaluate_object(handle, NULL, NULL, &buffer); | ||
302 | if (ACPI_FAILURE(status)) | ||
303 | return false; | ||
304 | acpi_id = object.processor.proc_id; | ||
305 | break; | ||
306 | case ACPI_TYPE_DEVICE: | ||
307 | status = acpi_evaluate_integer(handle, "_UID", NULL, &tmp); | ||
308 | if (ACPI_FAILURE(status)) | ||
309 | return false; | ||
310 | acpi_id = tmp; | ||
311 | break; | ||
312 | default: | ||
313 | return false; | ||
314 | } | ||
315 | |||
316 | type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0; | ||
317 | |||
318 | *phys_id = __acpi_get_phys_id(handle, type, acpi_id, false); | ||
319 | *cpuid = acpi_map_cpuid(*phys_id, acpi_id); | ||
320 | if (*cpuid == -1) | ||
321 | return false; | ||
322 | |||
323 | return true; | ||
324 | } | ||
325 | |||
326 | static acpi_status __init | ||
327 | set_processor_node_mapping(acpi_handle handle, u32 lvl, void *context, | ||
328 | void **rv) | ||
329 | { | ||
330 | phys_cpuid_t phys_id; | ||
331 | int cpu_id; | ||
332 | |||
333 | if (!map_processor(handle, &phys_id, &cpu_id)) | ||
334 | return AE_ERROR; | ||
335 | |||
336 | acpi_map_cpu2node(handle, cpu_id, phys_id); | ||
337 | return AE_OK; | ||
338 | } | ||
339 | |||
340 | void __init acpi_set_processor_mapping(void) | ||
341 | { | ||
342 | /* Set persistent cpu <-> node mapping for all processors. */ | ||
343 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, | ||
344 | ACPI_UINT32_MAX, set_processor_node_mapping, | ||
345 | NULL, NULL, NULL); | ||
346 | } | ||
347 | #else | ||
348 | void __init acpi_set_processor_mapping(void) {} | ||
349 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ | ||
350 | |||
283 | #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC | 351 | #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC |
284 | static int get_ioapic_id(struct acpi_subtable_header *entry, u32 gsi_base, | 352 | static int get_ioapic_id(struct acpi_subtable_header *entry, u32 gsi_base, |
285 | u64 *phys_addr, int *ioapic_id) | 353 | u64 *phys_addr, int *ioapic_id) |