x86/ACPI: Ignore CPUs that are not online capable for x2apic, entries as well
PATCH v3 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 v3 : updates as per Rafael's comments
--- arch/x86/kernel/acpi/boot.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/x86/kernel/acpi/boot.c +9 -1
@@ -208,7 +208,15 @@ 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 (!enabled && acpi_support_online_capable && + !(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
Adding others that I missed on my first email.
James
Quoted 36 lines · James Puthukattukaran
Extending commit
aa06e20f1be6("x86/ACPI: Don't add CPUs that are not online capable") to includeacpi_parse_x2apicas 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.Signed-off-by James Puthukattukaran<[email protected]>Reported-by Benjamin Fuller<[email protected]>v2 : use 'enabled' local variable. Also fix checkpatch.pl catches v3 : updates as per Rafael's comments
--- arch/x86/kernel/acpi/boot.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)arch/x86/kernel/acpi/boot.c +9
-1@@ -208,7 +208,15 @@ 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 (!enabled && acpi_support_online_capable && + !(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 ;
Borislav Petkov
maintainerQuoted 7 lines · James Puthukattukaran
Adding others that I missed on my first email.
James
Quoted 2 lines · James Puthukattukaran
Extending commit
aa06e20f1be6("x86/ACPI: Don't add CPUs that are not online capable") to includeacpi_parse_x2apicas well.
This doesn't look like an extension to some existing commit but like a separate fix.
Quoted 3 lines
Quoted 3 lines
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.
Which BIOSes are those?
Also, I'm no BIOS guy but I don't see you checking MADT version anywhere?
Quoted 5 lines
Quoted 5 lines
Signed-off-by James Puthukattukaran<[email protected]>Reported-by Benjamin Fuller<[email protected]>v2 : use 'enabled' local variable. Also fix checkpatch.pl catches v3 : updates as per Rafael's comments
Yah, I'd like for Rafael to decide what to do here...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRafael J. Wysocki
maintainerQuoted 21 lines · Borislav Petkov
Quoted 7 lines · James Puthukattukaran
Adding others that I missed on my first email.
James
Quoted 2 lines · James Puthukattukaran
Extending commit
aa06e20f1be6("x86/ACPI: Don't add CPUs that are not online capable") to includeacpi_parse_x2apicas well.This doesn't look like an extension to some existing commit but like a separate fix.
Quoted 3 lines
Quoted 3 lines
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.
Which BIOSes are those?
Also, I'm no BIOS guy but I don't see you checking MADT version anywhere?
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Signed-off-by James Puthukattukaran<[email protected]>Reported-by Benjamin Fuller<[email protected]>v2 : use 'enabled' local variable. Also fix checkpatch.pl catches v3 : updates as per Rafael's comments
Yah, I'd like for Rafael to decide what to do here...
I've just sent my comments to the patch, but you have not been CCed, sorry.
IMO the MADT version should be checked too and I would like to have at least one example of a platform affected by this problem in the changelog.
Rafael J. Wysocki
maintainerQuoted 4 lines · James Puthukattukaran
Extending commit
aa06e20f1be6("x86/ACPI: Don't add CPUs that are not online capable") to includeacpi_parse_x2apicas well. There is a check for invalid apicid; however, there are BIOS FW with madt version >= 5
It would be good to give at least one example of a platform where this happens.
Quoted 17 lines
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.
Signed-off-by James Puthukattukaran<[email protected]>Reported-by Benjamin Fuller<[email protected]>v2 : use 'enabled' local variable. Also fix checkpatch.pl catches v3 : updates as per Rafael's comments
--- arch/x86/kernel/acpi/boot.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)arch/x86/kernel/acpi/boot.c +0
-0
arch/x86/kernel/acpi/boot.c acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end) · line 213
Quoted 7 lines
arch/x86/kernel/acpi/boot.c +3
-1@@ -208,7 +208,15 @@ 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 (!enabled && acpi_support_online_capable && + !(processor->lapic_flags &ACPI_MADT_ONLINE_CAPABLE ))
I would add a MADT version check to this, because ACPI_MADT_ONLINE_CAPABLE may be set by mistake in an older BIOS too.
arch/x86/kernel/acpi/boot.c acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end) · line 217
Quoted 4 lines
arch/x86/kernel/acpi/boot.c +4
-0+return 0 ; + +/* +* for systems older than madt version 5 (does not have
Also please spell MADT in capitals.
Quoted 6 lines
arch/x86/kernel/acpi/boot.c +2
-1+* ACPI_MADT_ONLINE_CAPABLE defined); ignore invalid ID +*/ if (apic_id ==0xffffffff )return 0 ; --