x86/acpi/boot: Do not register processors that cannot be onlined for x2APIC
authorKishon Vijay Abraham I <kvijayab@amd.com>
Thu, 5 Jan 2023 04:10:59 +0000 (04:10 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:32:34 +0000 (09:32 +0100)
commitce7d894bed1a539a8d6cff42f6f78f9db0c9c26b
treeea59427ed3d5c781c0f076d0e61e0c104d3027ca
parent681964878331424a2331dd72c6d8dbc5061d5b3e
x86/acpi/boot: Do not register processors that cannot be onlined for x2APIC

[ Upstream commit e2869bd7af608c343988429ceb1c2fe99644a01f ]

Section 5.2.12.12 Processor Local x2APIC Structure in the ACPI v6.5
spec mandates that both "enabled" and "online capable" Local APIC Flags
should be used to determine if the processor is usable or not.

However, Linux doesn't use the "online capable" flag for x2APIC to
determine if the processor is usable. As a result, cpu_possible_mask has
incorrect value and results in more memory getting allocated for per_cpu
variables than it is going to be used.

Make sure Linux parses both "enabled" and "online capable" flags for
x2APIC to correctly determine if the processor is usable.

Fixes: aa06e20f1be6 ("x86/ACPI: Don't add CPUs that are not online capable")
Reported-by: Leo Duran <leo.duran@amd.com>
Signed-off-by: Kishon Vijay Abraham I <kvijayab@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/20230105041059.39366-1-kvijayab@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kernel/acpi/boot.c