Skip to contentSkip to conversation

x86/ACPI: Ignore CPUs that are not online capable for x2apic, entries as well

PATCH Superseded James Puthukattukaran 2 participants 3 messages Dec 16, 2022 – Dec 22, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86/ACPI: Ignore CPUs that are not online capable for x2apic, entries as well

Extending commit aa06e20f1be6 ("x86/ACPI: Don't add CPUs that are not online capable") to include acpi_parse_x2apic as well. There is a check for invalid apicid; however, there are BIOS FW with madt version >= 5 support that do not bother setting apic id to an invalid value since they assume the OS will check the enabled and online capable flags.

v2 : use 'enabled' local variable. Also fix checkpatch.pl catches

---
 arch/x86/kernel/acpi/boot.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/x86/kernel/acpi/boot.c +10 -1
index 907cc98b1938..35d8c8654b42 100644
@@ -208,7 +208,16 @@ acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end)
 	apic_id = processor->local_apic_id;
 	enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
 
-	/* Ignore invalid ID */
+
+	/* don't register processors that can not be onlined */
+	if (acpi_support_online_capable &&
+	    !enabled &&
+	    !(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE))
+		return 0;
+
+	/* for systems older than madt version 5 (does not have
+	 * ACPI_MADT_ONLINE_CAPABLE defined), ignore invalid ID
+	 */
 	if (apic_id == 0xffffffff)
 		return 0;
 
Signature · 1 line
2.31.1
#1 lore raw
Quoted 20 lines · James Puthukattukaran

Extending commit aa06e20f1be6 ("x86/ACPI: Don't add CPUs that are not online capable") to include acpi_parse_x2apic as well. There is a check for invalid apicid; however, there are BIOS FW with madt version >= 5 support that do not bother setting apic id to an invalid value since they assume the OS will check the enabled and online capable flags.

v2 : use 'enabled' local variable. Also fix checkpatch.pl catches

---
 arch/x86/kernel/acpi/boot.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/x86/kernel/acpi/boot.c +0 -0
index 907cc98b1938..35d8c8654b42 100644

arch/x86/kernel/acpi/boot.c acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end) · line 214

Quoted 8 lines
arch/x86/kernel/acpi/boot.c +4 -1
@@ -208,7 +208,16 @@ acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end)
        apic_id = processor->local_apic_id;
        enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
 
-       /* Ignore invalid ID */
+
+       /* don't register processors that can not be onlined */
+       if (acpi_support_online_capable &&
+           !enabled &&

Is the line break before the "enabled" check necessary?

I think it would be better to check "enabled" first anyway.

arch/x86/kernel/acpi/boot.c acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end) · line 220

Quoted 6 lines
arch/x86/kernel/acpi/boot.c +6 -0
+           !(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE))
+               return 0;
+
+       /* for systems older than madt version 5 (does not have
+        * ACPI_MADT_ONLINE_CAPABLE defined), ignore invalid ID
+        */

The formatting of the above comment doesn't follow the kernel coding style for multi-line comments.

Quoted 4 lines
arch/x86/kernel/acpi/boot.c +0 -1
        if (apic_id == 0xffffffff)
                return 0;
 
--
#2 lore raw

Re: [External] : Re: [PATCH v2] x86/ACPI: Ignore CPUs that are not online capable for x2apic, entries as well

thanks, Rafael. Accepted all suggestions. Sent out v3 patch regards
James

Quoted 49 lines · Rafael J. Wysocki
Quoted 20 lines · James Puthukattukaran

Extending commit aa06e20f1be6 ("x86/ACPI: Don't add CPUs that are not online capable") to include acpi_parse_x2apic as well. There is a check for invalid apicid; however, there are BIOS FW with madt version >= 5 support that do not bother setting apic id to an invalid value since they assume the OS will check the enabled and online capable flags.

v2 : use 'enabled' local variable. Also fix checkpatch.pl catches

---
 arch/x86/kernel/acpi/boot.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
arch/x86/kernel/acpi/boot.c +0 -0
index 907cc98b1938..35d8c8654b42 100644

arch/x86/kernel/acpi/boot.c acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end) · line 214

Quoted 8 lines
arch/x86/kernel/acpi/boot.c +4 -1
@@ -208,7 +208,16 @@ acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end)
        apic_id = processor->local_apic_id;
        enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
 
-       /* Ignore invalid ID */
+
+       /* don't register processors that can not be onlined */
+       if (acpi_support_online_capable &&
+           !enabled &&

Is the line break before the "enabled" check necessary?

I think it would be better to check "enabled" first anyway.

arch/x86/kernel/acpi/boot.c acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end) · line 220

Quoted 6 lines
arch/x86/kernel/acpi/boot.c +6 -0
+           !(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE))
+               return 0;
+
+       /* for systems older than madt version 5 (does not have
+        * ACPI_MADT_ONLINE_CAPABLE defined), ignore invalid ID
+        */

The formatting of the above comment doesn't follow the kernel coding style for multi-line comments.

Quoted 4 lines
arch/x86/kernel/acpi/boot.c +0 -1
        if (apic_id == 0xffffffff)
                return 0;
 
--