lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <caffc8e729a4f8240f9d9cd025bbc9f05ca19217.camel@intel.com>
Date:   Fri, 6 Jan 2023 00:57:09 +0000
From:   "Zhang, Rui" <rui.zhang@...el.com>
To:     "kvijayab@....com" <kvijayab@....com>,
        "rafael@...nel.org" <rafael@...nel.org>
CC:     "Brown, Len" <len.brown@...el.com>,
        "leo.duran@....com" <leo.duran@....com>,
        "bpetkov@....com" <bpetkov@....com>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "x86@...nel.org" <x86@...nel.org>,
        "suravee.suthikulpanit@....com" <suravee.suthikulpanit@....com>,
        "hpa@...or.com" <hpa@...or.com>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "pavel@....cz" <pavel@....cz>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        "bp@...en8.de" <bp@...en8.de>,
        "santosh.shukla@....com" <santosh.shukla@....com>
Subject: Re: [PATCH v2] x86/acpi/boot: Do not register processors that cannot
 be onlined for x2apic

On Thu, 2023-01-05 at 18:09 +0100, Rafael J. Wysocki wrote:
> On Thu, Jan 5, 2023 at 5:11 AM Kishon Vijay Abraham I <
> kvijayab@....com> wrote:
> > 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")
> > Reviewed-by: Borislav Petkov (AMD) <bp@...en8.de>
> > Reported-by: Leo Duran <leo.duran@....com>
> > Signed-off-by: Kishon Vijay Abraham I <kvijayab@....com>
> 
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 

Reviewed-by: Zhang Rui <rui.zhang@...el.com>

thanks,
rui
> > ---
> > Changes from v1:
> > 1) Changed the ACPI spec version to 6.5 in the commit log
> > 2) Changed the Fixes tag to point to commit aa06e20f1be6
> > 3) Added "Reported-by: Leo Duran <leo.duran@....com>"
> >  arch/x86/kernel/acpi/boot.c | 19 ++++++++++++++++---
> >  1 file changed, 16 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/acpi/boot.c
> > b/arch/x86/kernel/acpi/boot.c
> > index 907cc98b1938..518bda50068c 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;
> > 
> >         /*
> > --
> > 2.34.1
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ