Skip to content

Commit ccb7735

Browse files
ebiggershansendc
authored andcommitted
x86/fpu: Fully optimize out WARN_ON_FPU()
Currently WARN_ON_FPU evaluates its argument even if CONFIG_X86_DEBUG_FPU is disabled, which adds unnecessary instructions to several functions, for example kernel_fpu_begin(). Fix this by using BUILD_BUG_ON_INVALID(x) in the no-debug case rather than (void)(x). Fixes: 83242c5 ("x86/fpu: Make WARN_ON_FPU() more robust in the !CONFIG_X86_DEBUG_FPU case") Suggested-by: Sean Christopherson <[email protected]> Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Link: https://lore.kernel.org/all/20250127224523.94300-1-ebiggers%40kernel.org
1 parent a64dcfb commit ccb7735

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/fpu/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static __always_inline __pure bool use_fxsr(void)
1818
#ifdef CONFIG_X86_DEBUG_FPU
1919
# define WARN_ON_FPU(x) WARN_ON_ONCE(x)
2020
#else
21-
# define WARN_ON_FPU(x) ({ (void)(x); 0; })
21+
# define WARN_ON_FPU(x) ({ BUILD_BUG_ON_INVALID(x); 0; })
2222
#endif
2323

2424
/* Used in init.c */

0 commit comments

Comments
 (0)