Patch "x86/acpi/boot: Do not register processors that cannot be onlined for x2APIC" has been added to the 6.2-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/acpi/boot: Do not register processors that cannot be onlined for x2APIC

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-acpi-boot-do-not-register-processors-that-cannot.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8b83281a8f69cc1699340bca4c0e1bb8f27d0e49
Author: Kishon Vijay Abraham I <kvijayab@xxxxxxx>
Date:   Thu Jan 5 04:10:59 2023 +0000

    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@xxxxxxx>
    Signed-off-by: Kishon Vijay Abraham I <kvijayab@xxxxxxx>
    Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
    Reviewed-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
    Reviewed-by: Zhang Rui <rui.zhang@xxxxxxxxx>
    Acked-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230105041059.39366-1-kvijayab@xxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 907cc98b19380..518bda50068cb 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -188,6 +188,17 @@ static int acpi_register_lapic(int id, u32 acpiid, u8 enabled)
 	return cpu;
 }
 
+static bool __init acpi_is_processor_usable(u32 lapic_flags)
+{
+	if (lapic_flags & ACPI_MADT_ENABLED)
+		return true;
+
+	if (acpi_support_online_capable && (lapic_flags & ACPI_MADT_ONLINE_CAPABLE))
+		return true;
+
+	return false;
+}
+
 static int __init
 acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end)
 {
@@ -212,6 +223,10 @@ acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end)
 	if (apic_id == 0xffffffff)
 		return 0;
 
+	/* don't register processors that cannot be onlined */
+	if (!acpi_is_processor_usable(processor->lapic_flags))
+		return 0;
+
 	/*
 	 * We need to register disabled CPU as well to permit
 	 * counting disabled CPUs. This allows us to size
@@ -250,9 +265,7 @@ acpi_parse_lapic(union acpi_subtable_headers * header, const unsigned long end)
 		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))
+	if (!acpi_is_processor_usable(processor->lapic_flags))
 		return 0;
 
 	/*



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux