* Re: [tip: x86/urgent] x86/cpu/amd: Fix workaround for erratum 1054
[not found] ` <aAJBgCjGpvyI43E3@gmail.com>
@ 2025-04-18 12:37 ` Borislav Petkov
2025-04-18 12:41 ` Ingo Molnar
2025-04-18 12:47 ` Greg KH
0 siblings, 2 replies; 5+ messages in thread
From: Borislav Petkov @ 2025-04-18 12:37 UTC (permalink / raw)
To: Ingo Molnar, Greg KH, stable
Cc: linux-kernel, linux-tip-commits, Sandipan Das, x86
On Fri, Apr 18, 2025 at 02:11:44PM +0200, Ingo Molnar wrote:
> No, it doesn't really 'need' a stable tag, it has a Fixes tag already,
> which gets processed by the -stable team.
Last time I asked Greg, he said they scan for those tags but it doesn't hurt
to Cc stable as it helps.
Greg?
> Also, the bug is old, 1.5 years old:
>
> Date: Sat, 2 Dec 2023 12:50:23 +0100
>
> plus the erratum is a perf-counters information quality bug affecting
> what appears to be a limited number of models, with the workaround
No, the fix is needed because Zen2 and newer won't set
MSR_K7_HWCR_IRPERF_EN_BIT. It needs to go everywhere.
> likely incorporated in BIOS updates as well.
You can very much forget that argument. I have hard BIOS adoption data which
paints an abysmal picture. So NEVER EVER rely on BIOS to do anything.
Especially for Zen1 which is oooold in BIOS time.
> Leave it up to the -stable team whether they think it's severe enough to
> backport it?
No, they leave it to us section maintainers to decide AFAIK.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [tip: x86/urgent] x86/cpu/amd: Fix workaround for erratum 1054
2025-04-18 12:37 ` [tip: x86/urgent] x86/cpu/amd: Fix workaround for erratum 1054 Borislav Petkov
@ 2025-04-18 12:41 ` Ingo Molnar
2025-04-18 12:47 ` Greg KH
1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2025-04-18 12:41 UTC (permalink / raw)
To: Borislav Petkov
Cc: Greg KH, stable, linux-kernel, linux-tip-commits, Sandipan Das,
x86
* Borislav Petkov <bp@alien8.de> wrote:
> > plus the erratum is a perf-counters information quality bug
> > affecting what appears to be a limited number of models, with the
> > workaround
>
> No, the fix is needed because Zen2 and newer won't set
> MSR_K7_HWCR_IRPERF_EN_BIT. It needs to go everywhere.
Fair enough - the current version already has Cc: stable:
263e55949d89 x86/cpu/amd: Fix workaround for erratum 1054
...
Fixes: 232afb557835 ("x86/CPU/AMD: Add X86_FEATURE_ZEN1")
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Borislav Petkov <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/caa057a9d6f8ad579e2f1abaa71efbd5bd4eaf6d.1744956467.git.sandipan.das@amd.com
Thanks,
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [tip: x86/urgent] x86/cpu/amd: Fix workaround for erratum 1054
2025-04-18 12:37 ` [tip: x86/urgent] x86/cpu/amd: Fix workaround for erratum 1054 Borislav Petkov
2025-04-18 12:41 ` Ingo Molnar
@ 2025-04-18 12:47 ` Greg KH
2025-04-18 12:56 ` Ingo Molnar
1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2025-04-18 12:47 UTC (permalink / raw)
To: Borislav Petkov
Cc: Ingo Molnar, stable, linux-kernel, linux-tip-commits,
Sandipan Das, x86
On Fri, Apr 18, 2025 at 02:37:13PM +0200, Borislav Petkov wrote:
> On Fri, Apr 18, 2025 at 02:11:44PM +0200, Ingo Molnar wrote:
> > No, it doesn't really 'need' a stable tag, it has a Fixes tag already,
> > which gets processed by the -stable team.
NOOOOOO!!!!
> Last time I asked Greg, he said they scan for those tags but it doesn't hurt
> to Cc stable as it helps.
>
> Greg?
Fixes: is a "best effort if we get around to it because a maintainer
forgot to put an actual cc: stable tag on it".
As the documentation has stated, since the start of the stable kernel
tree work, use a cc: stable tag if you want it to go to a stable tree.
Fixes came years later and we are forced to dig through them
occasionally because people forget. But you do NOT get a FAILED email
if the commit does not apply to a stable tree, and sometimes we just
ignore them entirely if we are busy with other stuff.
So please ALWAYS use cc: stable@ on patches you know you want to be
applied to stable trees. Use the Fixes: tag to tell us how far back to
backport them. That's it. Use both.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [tip: x86/urgent] x86/cpu/amd: Fix workaround for erratum 1054
2025-04-18 12:47 ` Greg KH
@ 2025-04-18 12:56 ` Ingo Molnar
0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2025-04-18 12:56 UTC (permalink / raw)
To: Greg KH
Cc: Borislav Petkov, stable, linux-kernel, linux-tip-commits,
Sandipan Das, x86
* Greg KH <gregkh@linuxfoundation.org> wrote:
> On Fri, Apr 18, 2025 at 02:37:13PM +0200, Borislav Petkov wrote:
> > On Fri, Apr 18, 2025 at 02:11:44PM +0200, Ingo Molnar wrote:
> > > No, it doesn't really 'need' a stable tag, it has a Fixes tag already,
> > > which gets processed by the -stable team.
>
> NOOOOOO!!!!
Noted!! :-)
> So please ALWAYS use cc: stable@ on patches you know you want to be
> applied to stable trees. Use the Fixes: tag to tell us how far back
> to backport them. That's it. Use both.
Undertood!
Thanks,
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip: x86/urgent] x86/cpu/amd: Fix workaround for erratum 1054
@ 2025-04-18 12:37 tip-bot2 for Sandipan Das
0 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Sandipan Das @ 2025-04-18 12:37 UTC (permalink / raw)
To: linux-tip-commits
Cc: Sandipan Das, Ingo Molnar, Borislav Petkov, stable, x86,
linux-kernel
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 263e55949d8902a6a09bdb92a1ab6a3f67231abe
Gitweb: https://git.kernel.org/tip/263e55949d8902a6a09bdb92a1ab6a3f67231abe
Author: Sandipan Das <sandipan.das@amd.com>
AuthorDate: Fri, 18 Apr 2025 11:49:40 +05:30
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 18 Apr 2025 14:29:47 +02:00
x86/cpu/amd: Fix workaround for erratum 1054
Erratum 1054 affects AMD Zen processors that are a part of Family 17h
Models 00-2Fh and the workaround is to not set HWCR[IRPerfEn]. However,
when X86_FEATURE_ZEN1 was introduced, the condition to detect unaffected
processors was incorrectly changed in a way that the IRPerfEn bit gets
set only for unaffected Zen 1 processors.
Ensure that HWCR[IRPerfEn] is set for all unaffected processors. This
includes a subset of Zen 1 (Family 17h Models 30h and above) and all
later processors. Also clear X86_FEATURE_IRPERF on affected processors
so that the IRPerfCount register is not used by other entities like the
MSR PMU driver.
Fixes: 232afb557835 ("x86/CPU/AMD: Add X86_FEATURE_ZEN1")
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Borislav Petkov <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/caa057a9d6f8ad579e2f1abaa71efbd5bd4eaf6d.1744956467.git.sandipan.das@amd.com
---
arch/x86/kernel/cpu/amd.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index a839ff5..2b36379 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -869,6 +869,16 @@ static void init_amd_zen1(struct cpuinfo_x86 *c)
pr_notice_once("AMD Zen1 DIV0 bug detected. Disable SMT for full protection.\n");
setup_force_cpu_bug(X86_BUG_DIV0);
+
+ /*
+ * Turn off the Instructions Retired free counter on machines that are
+ * susceptible to erratum #1054 "Instructions Retired Performance
+ * Counter May Be Inaccurate".
+ */
+ if (c->x86_model < 0x30) {
+ msr_clear_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT);
+ clear_cpu_cap(c, X86_FEATURE_IRPERF);
+ }
}
static bool cpu_has_zenbleed_microcode(void)
@@ -1052,13 +1062,8 @@ static void init_amd(struct cpuinfo_x86 *c)
if (!cpu_feature_enabled(X86_FEATURE_XENPV))
set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS);
- /*
- * Turn on the Instructions Retired free counter on machines not
- * susceptible to erratum #1054 "Instructions Retired Performance
- * Counter May Be Inaccurate".
- */
- if (cpu_has(c, X86_FEATURE_IRPERF) &&
- (boot_cpu_has(X86_FEATURE_ZEN1) && c->x86_model > 0x2f))
+ /* Enable the Instructions Retired free counter */
+ if (cpu_has(c, X86_FEATURE_IRPERF))
msr_set_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT);
check_null_seg_clears_base(c);
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-18 12:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <174495817953.31282.5641497960291856424.tip-bot2@tip-bot2>
[not found] ` <20250418104013.GAaAIsDW2skB12L-nm@renoirsky.local>
[not found] ` <aAJBgCjGpvyI43E3@gmail.com>
2025-04-18 12:37 ` [tip: x86/urgent] x86/cpu/amd: Fix workaround for erratum 1054 Borislav Petkov
2025-04-18 12:41 ` Ingo Molnar
2025-04-18 12:47 ` Greg KH
2025-04-18 12:56 ` Ingo Molnar
2025-04-18 12:37 tip-bot2 for Sandipan Das
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox