]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/mm: Remove X86_FEATURE_USE_IBPB checks in cond_mitigation()
authorYosry Ahmed <yosry.ahmed@linux.dev>
Thu, 27 Feb 2025 01:27:08 +0000 (01:27 +0000)
committerIngo Molnar <mingo@kernel.org>
Thu, 27 Feb 2025 09:57:20 +0000 (10:57 +0100)
The check is performed when either switch_mm_cond_ibpb or
switch_mm_always_ibpb is set. In both cases, X86_FEATURE_USE_IBPB is
always set. Remove the redundant check.

Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/20250227012712.3193063-3-yosry.ahmed@linux.dev
arch/x86/mm/tlb.c

index 4f61d11de041cc2a4df18f69724a3f7e3d1725b1..30708076abfa6f80ab2bf451b80f5619d935fe13 100644 (file)
@@ -437,8 +437,7 @@ static void cond_mitigation(struct task_struct *next)
                 * both have the IBPB bit set.
                 */
                if (next_mm != prev_mm &&
-                   (next_mm | prev_mm) & LAST_USER_MM_IBPB &&
-                   cpu_feature_enabled(X86_FEATURE_USE_IBPB))
+                   (next_mm | prev_mm) & LAST_USER_MM_IBPB)
                        indirect_branch_prediction_barrier();
        }
 
@@ -448,8 +447,7 @@ static void cond_mitigation(struct task_struct *next)
                 * different context than the user space task which ran
                 * last on this CPU.
                 */
-               if ((prev_mm & ~LAST_USER_MM_SPEC_MASK) != (unsigned long)next->mm &&
-                   cpu_feature_enabled(X86_FEATURE_USE_IBPB))
+               if ((prev_mm & ~LAST_USER_MM_SPEC_MASK) != (unsigned long)next->mm)
                        indirect_branch_prediction_barrier();
        }