]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - arch/x86/kernel/process.c
x86/idle: Disable IBRS entering idle and enable it on wakeup
[mirror_ubuntu-artful-kernel.git] / arch / x86 / kernel / process.c
index 07e6218ad7d922ab84c709415ee712d0403b50d4..3adb3806a28495fcd5a27fabf52cfae17a8cbaea 100644 (file)
@@ -447,11 +447,19 @@ static __cpuidle void mwait_idle(void)
                        mb(); /* quirk */
                }
 
+               if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
+                        native_wrmsrl(MSR_IA32_SPEC_CTRL, 0);
+
                __monitor((void *)&current_thread_info()->flags, 0, 0);
-               if (!need_resched())
+               if (!need_resched()) {
                        __sti_mwait(0, 0);
-               else
+                       if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
+                               native_wrmsrl(MSR_IA32_SPEC_CTRL, FEATURE_ENABLE_IBRS);
+               } else {
+                       if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
+                               native_wrmsrl(MSR_IA32_SPEC_CTRL, FEATURE_ENABLE_IBRS);
                        local_irq_enable();
+               }
                trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
        } else {
                local_irq_enable();