All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] x86: Fix a F00F bug warning and cleanup surrounding code
@ 2026-05-15  0:24 Sohil Mehta
  2026-05-15  0:24 ` [PATCH v2 1/3] x86/cpu/intel: Don't clear X86_BUG_F00F before setting it Sohil Mehta
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sohil Mehta @ 2026-05-15  0:24 UTC (permalink / raw)
  To: Dave Hansen, Borislav Petkov, x86
  Cc: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Josh Poimboeuf,
	Richard Weinberger, Andrew Cooper, Tony Luck, Sohil Mehta,
	Ahmed S . Darwish, linux-kernel

This is an iteration of the series posted earlier by Richard Weinberger.
https://lore.kernel.org/lkml/20260216104343.3625292-1-richard@nod.at/

The patches primarily fix a harmless "alternatives_patched" warning that
affects the original Pentium (Family 5) processors with SMP. In this
revision, I reworded the commit messages and added a patch to simplify
the warning logic for the F00F bug. The patches seemed worth reposting
because the scope of the change is limited and it reduces lines of code.

The series is split into three patches for easier review. Let me know if
it would be preferable to merge them. Also, I wasn't sure whether the Fixes
tag in patch 1 is 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: Simplify F00F bug notice using pr_notice_once()

 arch/x86/include/asm/cpufeature.h | 1 -
 arch/x86/kernel/cpu/intel.c       | 8 +-------
 2 files changed, 1 insertion(+), 8 deletions(-)

-- 
2.43.0


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

* [PATCH v2 1/3] x86/cpu/intel: Don't clear X86_BUG_F00F before setting it
  2026-05-15  0:24 [PATCH v2 0/3] x86: Fix a F00F bug warning and cleanup surrounding code Sohil Mehta
@ 2026-05-15  0:24 ` Sohil Mehta
  2026-05-15  0:24 ` [PATCH v2 2/3] x86/cpu/intel: Simplify F00F bug notice using pr_notice_once() Sohil Mehta
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sohil Mehta @ 2026-05-15  0:24 UTC (permalink / raw)
  To: Dave Hansen, Borislav Petkov, x86
  Cc: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Josh Poimboeuf,
	Richard Weinberger, Andrew Cooper, Tony Luck, Sohil Mehta,
	Ahmed S . Darwish, linux-kernel

From: Richard Weinberger <richard@nod.at>

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 CPU feature 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().

Fixes: ee8962082a44 ("x86/alternatives: Catch late X86_FEATURE modifiers")
Signed-off-by: Richard Weinberger <richard@nod.at>
[sohil: reworded commit message]
Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
---
v2:
 - Reworded commit message to clarify the issue.
---
 arch/x86/kernel/cpu/intel.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index f28c0efb7c8f..e957c5a1501c 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -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;
 
-- 
2.43.0


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

* [PATCH v2 2/3] x86/cpu/intel: Simplify F00F bug notice using pr_notice_once()
  2026-05-15  0:24 [PATCH v2 0/3] x86: Fix a F00F bug warning and cleanup surrounding code Sohil Mehta
  2026-05-15  0:24 ` [PATCH v2 1/3] x86/cpu/intel: Don't clear X86_BUG_F00F before setting it Sohil Mehta
@ 2026-05-15  0:24 ` Sohil Mehta
  2026-05-15  0:25 ` [PATCH v2 3/3] x86/cpufeature: Remove clear_cpu_bug() Sohil Mehta
  2026-05-15  6:18 ` [PATCH v2 0/3] x86: Fix a F00F bug warning and cleanup surrounding code Richard Weinberger
  3 siblings, 0 replies; 5+ messages in thread
From: Sohil Mehta @ 2026-05-15  0:24 UTC (permalink / raw)
  To: Dave Hansen, Borislav Petkov, x86
  Cc: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Josh Poimboeuf,
	Richard Weinberger, Andrew Cooper, Tony Luck, Sohil Mehta,
	Ahmed S . Darwish, linux-kernel

The F00F bug workaround goes through a lot of effort to print the kernel
notice exactly once. Replace it with pr_notice_once(), which precisely
does that.

Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
---
v2:
 - New patch
---
 arch/x86/kernel/cpu/intel.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index e957c5a1501c..84a652a7dd41 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -396,13 +396,8 @@ static void intel_workarounds(struct cpuinfo_x86 *c)
 	 * 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;
-
 		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;
-		}
+		pr_notice_once("Intel Pentium with F0 0F bug - workaround enabled.\n");
 	}
 #endif
 
-- 
2.43.0


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

* [PATCH v2 3/3] x86/cpufeature: Remove clear_cpu_bug()
  2026-05-15  0:24 [PATCH v2 0/3] x86: Fix a F00F bug warning and cleanup surrounding code Sohil Mehta
  2026-05-15  0:24 ` [PATCH v2 1/3] x86/cpu/intel: Don't clear X86_BUG_F00F before setting it Sohil Mehta
  2026-05-15  0:24 ` [PATCH v2 2/3] x86/cpu/intel: Simplify F00F bug notice using pr_notice_once() Sohil Mehta
@ 2026-05-15  0:25 ` Sohil Mehta
  2026-05-15  6:18 ` [PATCH v2 0/3] x86: Fix a F00F bug warning and cleanup surrounding code Richard Weinberger
  3 siblings, 0 replies; 5+ messages in thread
From: Sohil Mehta @ 2026-05-15  0:25 UTC (permalink / raw)
  To: Dave Hansen, Borislav Petkov, x86
  Cc: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Josh Poimboeuf,
	Richard Weinberger, Andrew Cooper, Tony Luck, Sohil Mehta,
	Ahmed S . Darwish, linux-kernel

From: Richard Weinberger <richard@nod.at>

X86_BUG_F00F was the last remaining user of clear_cpu_bug(). With no
users left, remove this helper.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
---
v2:
 - Improve commit message
---
 arch/x86/include/asm/cpufeature.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 3ddc1d33399b..90680f978d43 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -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))
-- 
2.43.0


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

* Re: [PATCH v2 0/3] x86: Fix a F00F bug warning and cleanup surrounding code
  2026-05-15  0:24 [PATCH v2 0/3] x86: Fix a F00F bug warning and cleanup surrounding code Sohil Mehta
                   ` (2 preceding siblings ...)
  2026-05-15  0:25 ` [PATCH v2 3/3] x86/cpufeature: Remove clear_cpu_bug() Sohil Mehta
@ 2026-05-15  6:18 ` Richard Weinberger
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Weinberger @ 2026-05-15  6:18 UTC (permalink / raw)
  To: Sohil Mehta
  Cc: dave hansen, bp, x86, Thomas Gleixner, mingo, hpa, Josh Poimboeuf,
	andrew cooper3, Tony Luck, Ahmed S. Darwish, linux-kernel

----- Ursprüngliche Mail -----
> Von: "Sohil Mehta" <sohil.mehta@intel.com>
> This is an iteration of the series posted earlier by Richard Weinberger.
> https://lore.kernel.org/lkml/20260216104343.3625292-1-richard@nod.at/
> 
> The patches primarily fix a harmless "alternatives_patched" warning that
> affects the original Pentium (Family 5) processors with SMP. In this
> revision, I reworded the commit messages and added a patch to simplify
> the warning logic for the F00F bug. The patches seemed worth reposting
> because the scope of the change is limited and it reduces lines of code.
> 
> The series is split into three patches for easier review. Let me know if
> it would be preferable to merge them. Also, I wasn't sure whether the Fixes
> tag in patch 1 is 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: Simplify F00F bug notice using pr_notice_once()

Thanks for reviving these patches!
//richard

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

end of thread, other threads:[~2026-05-15  6:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-15  0:24 [PATCH v2 0/3] x86: Fix a F00F bug warning and cleanup surrounding code Sohil Mehta
2026-05-15  0:24 ` [PATCH v2 1/3] x86/cpu/intel: Don't clear X86_BUG_F00F before setting it Sohil Mehta
2026-05-15  0:24 ` [PATCH v2 2/3] x86/cpu/intel: Simplify F00F bug notice using pr_notice_once() Sohil Mehta
2026-05-15  0:25 ` [PATCH v2 3/3] x86/cpufeature: Remove clear_cpu_bug() Sohil Mehta
2026-05-15  6:18 ` [PATCH v2 0/3] x86: Fix a F00F bug warning and cleanup surrounding code Richard Weinberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.