]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/spectre_v2: Only use IBRS when ibrs_inuse tells us to
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Sat, 10 Feb 2018 04:16:09 +0000 (23:16 -0500)
committerJack Vogel <jack.vogel@oracle.com>
Mon, 12 Feb 2018 21:07:11 +0000 (13:07 -0800)
instead of using it if the CPU has detected that it exists.

This conflicts with retpoline - as when retpoline is enabled
we end up enabling/disabling the IBRS even though we should
not be touching this MSR.

OraBug: 27526563
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
arch/x86/kernel/process.c

index 0d9fa5311f9a2d41024e7897eaf766d6e24f1019..9f60bcbf85caed36469493f0484f9ee07977e2e3 100644 (file)
@@ -463,17 +463,17 @@ static __cpuidle void mwait_idle(void)
                        smp_mb(); /* quirk */
                }
 
-               if (boot_cpu_has(X86_FEATURE_IBRS))
+               if (ibrs_inuse)
                        native_wrmsrl(MSR_IA32_SPEC_CTRL, SPEC_CTRL_FEATURE_DISABLE_IBRS);
 
                __monitor((void *)&current_thread_info()->flags, 0, 0);
                if (!need_resched()) {
                        __sti_mwait(0, 0);
-                       if (boot_cpu_has(X86_FEATURE_IBRS))
+                       if (ibrs_inuse)
                                native_wrmsrl(MSR_IA32_SPEC_CTRL,
                                    SPEC_CTRL_FEATURE_ENABLE_IBRS);
                } else {
-                       if (boot_cpu_has(X86_FEATURE_IBRS))
+                       if (ibrs_inuse)
                                native_wrmsrl(MSR_IA32_SPEC_CTRL, SPEC_CTRL_FEATURE_ENABLE_IBRS);
                        local_irq_enable();
                }