Skip to content

Commit

Permalink
x86/ACPI: Don't add CPUs that are not online capable
Browse files Browse the repository at this point in the history
A number of systems are showing "hotplug capable" CPUs when they
are not really hotpluggable.  This is because the MADT has extra
CPU entries to support different CPUs that may be inserted into
the socket with different numbers of cores.

Starting with ACPI 6.3 the spec has an Online Capable bit in the
MADT used to determine whether or not a CPU is hotplug capable
when the enabled bit is not set.

Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html?#local-apic-flags
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Mario Limonciello authored and Rafael J. Wysocki committed Sep 13, 2021
1 parent 435a8dc commit aa06e20
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/x86/kernel/acpi/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ int acpi_fix_pin2_polarity __initdata;

#ifdef CONFIG_X86_LOCAL_APIC
static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
static bool acpi_support_online_capable;
#endif

#ifdef CONFIG_X86_IO_APIC
Expand Down Expand Up @@ -138,6 +139,8 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)

pr_debug("Local APIC address 0x%08x\n", madt->address);
}
if (madt->header.revision >= 5)
acpi_support_online_capable = true;

default_acpi_madt_oem_check(madt->header.oem_id,
madt->header.oem_table_id);
Expand Down Expand Up @@ -239,6 +242,12 @@ acpi_parse_lapic(union acpi_subtable_headers * header, const unsigned long end)
if (processor->id == 0xff)
return 0;

/* don't register processors that can not be onlined */
if (acpi_support_online_capable &&
!(processor->lapic_flags & ACPI_MADT_ENABLED) &&
!(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE))
return 0;

/*
* We need to register disabled CPU as well to permit
* counting disabled CPUs. This allows us to size
Expand Down

0 comments on commit aa06e20

Please sign in to comment.