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:   Sat, 21 Jan 2023 19:36:37 -0800
From:   Ashok Raj <ashok.raj@...el.com>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Borislav Petkov <bp@...en8.de>
CC:     LKML <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Tony Luck <tony.luck@...el.com>,
        Dave Hansen <dave.hansen@...el.com>,
        Alison Schofield <alison.schofield@...el.com>,
        Reinette Chatre <reinette.chatre@...el.com>,
        Tom Lendacky <thomas.lendacky@....com>,
        Stefan Talpalaru <stefantalpalaru@...oo.com>,
        David Woodhouse <dwmw2@...radead.org>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Jonathan Corbet <corbet@....net>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Peter Zilstra <peterz@...radead.org>,
        "Andy Lutomirski" <luto@...nel.org>,
        Andrew Cooper <Andrew.Cooper3@...rix.com>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Martin Pohlack <mpohlack@...zon.de>,
        Ashok Raj <ashok.raj@...el.com>
Subject: Re: [Part 2 v2[cleanup] 4/4] x86/microcode: Do not call
 apply_microde() on sibling threads

On Sat, Jan 21, 2023 at 01:35:12PM -0800, Ashok Raj wrote:

[snip]

> ---
>  arch/x86/kernel/cpu/microcode/core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
> index 6ade3d59c404..089636b1643f 100644
> --- a/arch/x86/kernel/cpu/microcode/core.c
> +++ b/arch/x86/kernel/cpu/microcode/core.c
> @@ -386,6 +386,7 @@ static int __wait_for_cpus(atomic_t *t, long long timeout)
>   */
>  static int __reload_late(void *info)
>  {
> +	struct ucode_cpu_info *uci = ucode_cpu_info + cpu;

In a quest to keep the christmas tree effect, screwed up the ordering. 
I fixed it before i resent the next time. Modified diff below.

>  	int cpu = smp_processor_id();
>  	enum ucode_state err;
>  	int ret = 0;
> @@ -422,12 +423,11 @@ static int __reload_late(void *info)
>  
>  	/*
>  	 * At least one thread has completed update on each core.
> -	 * For others, simply call the update to make sure the
> -	 * per-cpu cpuinfo can be updated with right microcode
> -	 * revision.
> +	 * For siblings, collect the cpuinfo and update the
> +	 * per-cpu cpuinfo with the current microcode revision.
>  	 */
>  	if (cpumask_first(topology_sibling_cpumask(cpu)) != cpu)
> -		err = microcode_ops->apply_microcode(cpu);
> +		microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig);
>  
>  	return ret;
>  }
> -- 
> 2.34.1
> 

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 6ade3d59c404..07764c1a2dd3 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -387,6 +387,7 @@ static int __wait_for_cpus(atomic_t *t, long long timeout)
 static int __reload_late(void *info)
 {
        int cpu = smp_processor_id();
+       struct ucode_cpu_info *uci;
        enum ucode_state err;
        int ret = 0;

@@ -422,12 +423,13 @@ static int __reload_late(void *info)

        /*
         * At least one thread has completed update on each core.
-        * For others, simply call the update to make sure the
-        * per-cpu cpuinfo can be updated with right microcode
-        * revision.
+        * For siblings, collect the cpuinfo and update the
+        * per-cpu cpuinfo with the current microcode revision.
         */
-       if (cpumask_first(topology_sibling_cpumask(cpu)) != cpu)
-               err = microcode_ops->apply_microcode(cpu);
+       if (cpumask_first(topology_sibling_cpumask(cpu)) != cpu) {
+               uci = ucode_cpu_info + cpu;
+               microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig);
+       }

        return ret;
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ