x86: Fix a F00F bug warning and cleanup surrounding code
v3 cover x86: Fix a F00F bug warning and cleanup surrounding code
Changes in v3:
- Remove the notice announcing the F00F bug workaround instead of simplifying it.
- Pick up review tags from Ahmed.
v2: https://lore.kernel.org/all/[email protected]/
Summary:
The series fixes a harmless "alternatives_patched" warning that affects the original Pentium (Family 5) processors with SMP. It also removes the kernel announcement that the F00F bug workaround is in place. Mainly, the patches simplify and reduce lines of code.
Original v1 post by Richard Weinberger:
https://lore.kernel.org/lkml/[email protected]/
The Fixes tag in patch 1 isn't strictly necessary. I left it inplace as Richard had it in his original series, but it can be removed to avoid backporting hassles.
Richard Weinberger (2):
x86/cpu/intel: Don't clear X86_BUG_F00F before setting it x86/cpufeature: Remove clear_cpu_bug()
Sohil Mehta (1):
x86/cpu/intel: Remove the F00F bug workaround notice
arch/x86/include/asm/cpufeature.h | 1 - arch/x86/kernel/cpu/intel.c | 15 +++------------ 2 files changed, 3 insertions(+), 13 deletions(-)
Signature · 1 line
2.43.0
PATCH v3 1/3 x86/cpu/intel: Don't clear X86_BUG_F00F before setting it
From: Richard Weinberger <[email protected]>
On x86 SMP systems with the F00F bug present, the following warning occurs for each AP:
WARNING: arch/x86/kernel/cpu/cpuid-deps.c:126 at do_clear_cpu_cap+0xb4/0x110 Call Trace: clear_cpu_cap+0x8/0x10 init_intel+0x1b/0x4b0 identify_cpu+0x154/0x750 identify_secondary_cpu+0x3d/0x90 start_secondary+0x6b/0xf0 startup_32_smp+0x151/0x160
The X86_BUG_F00F flag is first cleared in intel_workarounds() and then set for the affected models. This sequence works fine on the BSP but on AP bringup, where alternatives have already been patched, clearing the flag triggers the warning.
There is no technical reason for clearing the flag before setting it. It is mainly an artifact of the introduction of X86_BUG_F00F in commit e2604b49e8a8 ("x86, cpu: Convert F00F bug detection"). Remove the unnecessary clearing of the flag.
Note that the fixes tag references a recent commit that introduced the warning rather than the old commit that converted F00F bug detection to use clear_cpu_bug().
---
v3:
- Picked up Ahmed's review tag.
v2:
- Reworded commit message to clarify the issue.
--- arch/x86/kernel/cpu/intel.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/kernel/cpu/intel.c +0 -1
@@ -395,7 +395,6 @@ static void intel_workarounds(struct cpuinfo_x86 *c)* system. Announce that the fault handler will be checking for it. * The Quark is also family 5, but does not have the same bug. */ -clear_cpu_bug (c,X86_BUG_F00F );if (c->x86_vfm >=INTEL_FAM5_START && c->x86_vfm <INTEL_QUARK_X1000 ) {static int f00f_workaround_enabled;
Signature · 1 line
2.43.0
PATCH v3 2/3 x86/cpu/intel: Remove the F00F bug workaround notice
In reply to Sohil MehtaThe F00F bug workaround announcement goes through a lot of effort to print the kernel notice exactly once. CPU bugs with workarounds typically don't require user notifications. If needed, the presence of the F00F bug can be determined through /proc/cpuinfo.
Remove the notice and the surrounding logic to print it once.
---
v3:
- Get rid of the notice instead of simplifying it. (Ahmed)
v2:
- New patch
--- arch/x86/kernel/cpu/intel.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
arch/x86/kernel/cpu/intel.c +3 -11
@@ -388,23 +388,15 @@ __setup("forcepae", forcepae_setup);static void intel_workarounds (struct cpuinfo_x86 *c) { -#ifdef CONFIG_X86_F00F_BUG /* * All models of Pentium and Pentium with MMX technology CPUs * have the F0 0F bug, which lets nonprivileged users lock up the -* system. Announce that the fault handler will be checking for it. +* system. The fault handler always checks for it. * The Quark is also family 5, but does not have the same bug. */ -if (c->x86_vfm >=INTEL_FAM5_START && c->x86_vfm <INTEL_QUARK_X1000 ) { -static int f00f_workaround_enabled; - +if ((IS_ENABLED (CONFIG_X86_F00F_BUG )) && + (c->x86_vfm >=INTEL_FAM5_START && c->x86_vfm <INTEL_QUARK_X1000 ))set_cpu_bug (c,X86_BUG_F00F ); -if (!f00f_workaround_enabled) { -pr_notice ("Intel Pentium with F0 0F bug - workaround enabled.\n" ); - f00f_workaround_enabled =1 ; - } - } -#endif /* * SEP CPUID bug: Pentium Pro reports SEP but doesn't have it until
Signature · 1 line
2.43.0
Re: [PATCH v3 2/3] x86/cpu/intel: Remove the F00F bug workaround notice
Quoted 10 lines · Sohil Mehta
The F00F bug workaround announcement goes through a lot of effort to print the kernel notice exactly once. CPU bugs with workarounds typically don't require user notifications. If needed, the presence of the F00F bug can be determined through
/proc/cpuinfo.Remove the notice and the surrounding logic to print it once.
Signed-off-by Sohil Mehta <[email protected]>---
Thanks for removing it.
PATCH v3 3/3 x86/cpufeature: Remove clear_cpu_bug()
In reply to Sohil MehtaFrom: Richard Weinberger <[email protected]>
X86_BUG_F00F was the last remaining user of clear_cpu_bug(). With no users left, remove this helper.
---
v3:
- Picked up Ahmed's review tag.
v2:
- Improve commit message
--- arch/x86/include/asm/cpufeature.h | 1 - 1 file changed, 1 deletion(-)
arch/x86/include/asm/cpufeature.h +0 -1
@@ -125,7 +125,6 @@ static __always_inline bool _static_cpu_has(u16 bit)#define cpu_has_bug (c, bit) cpu_has(c, (bit))#define set_cpu_bug (c, bit) set_cpu_cap(c, (bit)) -#define clear_cpu_bug (c, bit) clear_cpu_cap(c, (bit))#define static_cpu_has_bug (bit) static_cpu_has((bit))#define boot_cpu_has_bug (bit) cpu_has_bug(&boot_cpu_data, (bit))
Signature · 1 line
2.43.0
Borislav Petkov
maintainerQuoted 24 lines · Sohil Mehta
Changes in v3:
- Remove the notice announcing the F00F bug workaround instead of simplifying it.
- Pick up review tags from Ahmed.v2: https://lore.kernel.org/all/[email protected]/
Summary:
The series fixes a harmless "alternatives_patched" warning that affects the original Pentium (Family 5) processors with SMP. It also removes the kernel announcement that the F00F bug workaround is in place. Mainly, the patches simplify and reduce lines of code.Original v1 post by Richard Weinberger:
https://lore.kernel.org/lkml/[email protected]/The Fixes tag in patch 1 isn't strictly necessary. I left it inplace as Richard had it in his original series, but it can be removed to avoid backporting hassles.
Richard Weinberger (2):
x86/cpu/intel: Don't clearX86_BUG_F00Fbefore setting it x86/cpufeature: Removeclear_cpu_bug()
Quoted 6 lines
Sohil Mehta (1):
x86/cpu/intel: Remove the F00F bug workaround noticearch/x86/include/asm/cpufeature.h | 1 - arch/x86/kernel/cpu/intel.c | 15 +++------------ 2 files changed, 3 insertions(+), 13 deletions(-)
Why are there three patches doing one logical thing?
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 8 lines · Borislav Petkov
Quoted 8 lines
The Fixes tag in patch 1 isn't strictly necessary. I left it inplace as Richard had it in his original series, but it can be removed to avoid backporting hassles.
Richard Weinberger (2):
x86/cpu/intel: Don't clearX86_BUG_F00Fbefore setting it x86/cpufeature: Removeclear_cpu_bug()
Quoted 9 lines
Quoted 6 lines
Sohil Mehta (1):
x86/cpu/intel: Remove the F00F bug workaround noticearch/x86/include/asm/cpufeature.h | 1 - arch/x86/kernel/cpu/intel.c | 15 +++------------ 2 files changed, 3 insertions(+), 13 deletions(-)Why are there three patches doing one logical thing?
It's mainly because of the Fixes tag in patch 1. I didn't want to club removing clear_cpu_bug() and removing the kernel notice with the fixup patch. I wasn't sure if some stable kernel used clear_cpu_bug().
Would you prefer that I merge all three into a single one? Do you want me to keep the Fixes tag in patch 1?
Borislav Petkov
maintainerQuoted 6 lines · Sohil Mehta
It's mainly because of the Fixes tag in patch 1. I didn't want to club removing
clear_cpu_bug()and removing the kernel notice with the fixup patch. I wasn't sure if some stable kernel usedclear_cpu_bug().Would you prefer that I merge all three into a single one? Do you want me to keep the Fixes tag in patch 1?
Why would you even want to backport this to stable? Which of the stable rules apply here and why are we making too much noise again about obsolete hw?
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 3 lines · Borislav Petkov
Why would you even want to backport this to stable? Which of the stable rules apply here and why are we making too much noise again about obsolete hw?
That's completely fine with me. My primary goal with this posting is to simplify that section of code.
(I pressed send too soon)
Quoted 8 lines · Sohil Mehta
Quoted 3 lines · Borislav Petkov
Why would you even want to backport this to stable? Which of the stable rules apply here and why are we making too much noise again about obsolete hw?
That's completely fine with me. My primary goal with this posting is to simplify that section of code.
I'll combine the patches into a single one and remove the fixes tag.
----- Ursprüngliche Mail -----
Quoted 6 lines
Von: "Sohil Mehta" <[email protected]>
(I pressed send too soon)Quoted 2 lines · Sohil Mehta
On 5/27/2026 11:06 AM, Borislav Petkov wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Why would you even want to backport this to stable? Which of the stable rules apply here and why are we making too much noise again about obsolete hw?
That's completely fine with me. My primary goal with this posting is to simplify that section of code.
I'll combine the patches into a single one and remove the fixes tag.
Thanks for taking care of it!