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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 8 Dec 2020 11:05:32 +0100
From:   Johan Hovold <johan@...nel.org>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
        Rob Herring <robh@...nel.org>, linux-kernel@...r.kernel.org,
        Johan Hovold <johan@...nel.org>
Subject: Re: [PATCH] x86/apic: Fix CPU devicetree-node lookups

On Tue, Nov 24, 2020 at 02:42:47PM +0100, Johan Hovold wrote:
> Fix CPU devicetree-node lookups by implementing
> arch_match_cpu_phys_id().
> 
> This allows using of_get_cpu_node() and of_cpu_device_node_get() to look
> up CPU devicetree nodes and specifically makes sure that CPU struct
> devices are linked to the correct devicetree nodes.
> 
> Note that CPUs are described in devicetree using their APIC ids and
> that those do not generally coincide with the logical ids (e.g. used by
> the default arch_match_cpu_phys_id() implementation).
> 
> Signed-off-by: Johan Hovold <johan@...nel.org>
> ---
>  arch/x86/kernel/apic/apic.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index b3eef1d5c903..19c0119892dd 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -2311,6 +2311,11 @@ static int cpuid_to_apicid[] = {
>  	[0 ... NR_CPUS - 1] = -1,
>  };
>  
> +bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
> +{
> +	return phys_id == cpuid_to_apicid[cpu];
> +}
> +
>  #ifdef CONFIG_SMP
>  /**
>   * apic_id_is_primary_thread - Check whether APIC ID belongs to a primary thread

Any comments to this one? Can it be picked up for 5.11?

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ