Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpuidle, intel_idle: Fix CPUIDLE_FLAG_INIT_XSTATE

Fix instrumentation bugs objtool found:

vmlinux.o: warning: objtool: intel_idle_s2idle+0xd5: call to fpu_idle_fpregs() leaves .noinstr.text section
vmlinux.o: warning: objtool: intel_idle_xstate+0x11: call to fpu_idle_fpregs() leaves .noinstr.text section
vmlinux.o: warning: objtool: fpu_idle_fpregs+0x9: call to xfeatures_in_use() leaves .noinstr.text section

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20230112195540.494977795@infradead.org

authored by

Peter Zijlstra and committed by
Ingo Molnar
821ad23d 6d9c7f51

+5 -5
+2 -2
arch/x86/include/asm/fpu/xcr.h
··· 5 5 #define XCR_XFEATURE_ENABLED_MASK 0x00000000 6 6 #define XCR_XFEATURE_IN_USE_MASK 0x00000001 7 7 8 - static inline u64 xgetbv(u32 index) 8 + static __always_inline u64 xgetbv(u32 index) 9 9 { 10 10 u32 eax, edx; 11 11 ··· 27 27 * 28 28 * Callers should check X86_FEATURE_XGETBV1. 29 29 */ 30 - static inline u64 xfeatures_in_use(void) 30 + static __always_inline u64 xfeatures_in_use(void) 31 31 { 32 32 return xgetbv(XCR_XFEATURE_IN_USE_MASK); 33 33 }
+1 -1
arch/x86/include/asm/special_insns.h
··· 295 295 return 0; 296 296 } 297 297 298 - static inline void tile_release(void) 298 + static __always_inline void tile_release(void) 299 299 { 300 300 /* 301 301 * Instruction opcode for TILERELEASE; supported in binutils
+2 -2
arch/x86/kernel/fpu/core.c
··· 853 853 * Initialize register state that may prevent from entering low-power idle. 854 854 * This function will be invoked from the cpuidle driver only when needed. 855 855 */ 856 - void fpu_idle_fpregs(void) 856 + noinstr void fpu_idle_fpregs(void) 857 857 { 858 858 /* Note: AMX_TILE being enabled implies XGETBV1 support */ 859 859 if (cpu_feature_enabled(X86_FEATURE_AMX_TILE) && 860 860 (xfeatures_in_use() & XFEATURE_MASK_XTILE)) { 861 861 tile_release(); 862 - fpregs_deactivate(&current->thread.fpu); 862 + __this_cpu_write(fpu_fpregs_owner_ctx, NULL); 863 863 } 864 864 }