mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load
@ 2024-09-23 15:41 John Allen
  2024-09-23 15:56 ` John Allen
  2024-09-23 16:02 ` Borislav Petkov
  0 siblings, 2 replies; 3+ messages in thread
From: John Allen @ 2024-09-23 15:41 UTC (permalink / raw)
  To: bp, x86; +Cc: linux-kernel, John Allen

A problem was introduced with f69759b ("x86/CPU/AMD: Move Zenbleed check to
the Zen2 init function") where a bit in the DE_CFG MSR is getting set after
a microcode late load.

The problem is that the microcode late load path calls into
amd_check_microcode and subsequently zen2_zenbleed_check. Since the patch
removes the cpu_has_amd_erratum check from zen2_zenbleed_check, this will
cause all non-Zen2 cpus to go through the function and set the bit in the
DE_CFG MSR.

Call into the zenbleed fix path on Zen2 cpus only.

Fixes: f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")
Signed-off-by: John Allen <john.allen@amd.com>
---
 arch/x86/kernel/cpu/amd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 015971adadfc..368344e1394b 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -1202,5 +1202,6 @@ void amd_check_microcode(void)
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
 		return;
 
-	on_each_cpu(zenbleed_check_cpu, NULL, 1);
+	if (boot_cpu_has(X86_FEATURE_ZEN2))
+		on_each_cpu(zenbleed_check_cpu, NULL, 1);
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load
  2024-09-23 15:41 [PATCH] x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load John Allen
@ 2024-09-23 15:56 ` John Allen
  2024-09-23 16:02 ` Borislav Petkov
  1 sibling, 0 replies; 3+ messages in thread
From: John Allen @ 2024-09-23 15:56 UTC (permalink / raw)
  To: bp, x86; +Cc: linux-kernel, stable

On Mon, Sep 23, 2024 at 03:41:12PM +0000, John Allen wrote:
> A problem was introduced with f69759b ("x86/CPU/AMD: Move Zenbleed check to
> the Zen2 init function") where a bit in the DE_CFG MSR is getting set after
> a microcode late load.
> 
> The problem is that the microcode late load path calls into
> amd_check_microcode and subsequently zen2_zenbleed_check. Since the patch
> removes the cpu_has_amd_erratum check from zen2_zenbleed_check, this will
> cause all non-Zen2 cpus to go through the function and set the bit in the
> DE_CFG MSR.
> 
> Call into the zenbleed fix path on Zen2 cpus only.
> 
> Fixes: f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")

Should probably go into stable as well.

Cc: <stable@vger.kernel.org>

> Signed-off-by: John Allen <john.allen@amd.com>
> ---
>  arch/x86/kernel/cpu/amd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 015971adadfc..368344e1394b 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -1202,5 +1202,6 @@ void amd_check_microcode(void)
>  	if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
>  		return;
>  
> -	on_each_cpu(zenbleed_check_cpu, NULL, 1);
> +	if (boot_cpu_has(X86_FEATURE_ZEN2))
> +		on_each_cpu(zenbleed_check_cpu, NULL, 1);
>  }
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load
  2024-09-23 15:41 [PATCH] x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load John Allen
  2024-09-23 15:56 ` John Allen
@ 2024-09-23 16:02 ` Borislav Petkov
  1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2024-09-23 16:02 UTC (permalink / raw)
  To: John Allen, x86; +Cc: linux-kernel

On September 23, 2024 5:41:12 PM GMT+02:00, John Allen <john.allen@amd.com> wrote:
>A problem was introduced with f69759b ("x86/CPU/AMD: Move Zenbleed check to

Use 12 chars for the commit id.

>the Zen2 init function") where a bit in the DE_CFG MSR is getting set after
>a microcode late load.
>
>The problem is that the microcode late load path calls into
>amd_check_microcode and subsequently zen2_zenbleed_check. Since the patch
>removes the cpu_has_amd_erratum check from zen2_zenbleed_check, this will

End all function names with "()".

>cause all non-Zen2 cpus to go through the function and set the bit in the
>DE_CFG MSR.
>
>Call into the zenbleed fix path on Zen2 cpus only.

s/cpus/CPUs/g

And yes, it should be cc:stable.

With all that addressed, you can add:

Acked-by: me

to the patch.

Thx.

-- 
Sent from a small device: formatting sucks and brevity is inevitable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-23 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-23 15:41 [PATCH] x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load John Allen
2024-09-23 15:56 ` John Allen
2024-09-23 16:02 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®