summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Stange <nstange@suse.de>2018-07-21 23:16:56 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-08-15 19:11:06 +0300
commitafb059e688f22d860575cddea281534504397756 (patch)
treecb7e603f736f6d615991a32d3c50cf33dcc291e9
parent63a759508f3ec9af3b5014c371651db91a505f8b (diff)
downloadlinux-afb059e688f22d860575cddea281534504397756.tar.xz
x86/KVM/VMX: Don't set l1tf_flush_l1d to true from vmx_l1d_flush()
commit 379fd0c7e6a391e5565336a646f19f218fb98c6c upstream vmx_l1d_flush() gets invoked only if l1tf_flush_l1d is true. There's no point in setting l1tf_flush_l1d to true from there again. Signed-off-by: Nicolai Stange <nstange@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/x86/kvm/vmx.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 79b32e4e3f6b..60f860b0bb45 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -9461,15 +9461,15 @@ static void vmx_l1d_flush(struct kvm_vcpu *vcpu)
/*
* This code is only executed when the the flush mode is 'cond' or
* 'always'
- *
- * If 'flush always', keep the flush bit set, otherwise clear
- * it. The flush bit gets set again either from vcpu_run() or from
- * one of the unsafe VMEXIT handlers.
*/
- if (static_branch_unlikely(&vmx_l1d_flush_always))
- vcpu->arch.l1tf_flush_l1d = true;
- else
+ if (!static_branch_unlikely(&vmx_l1d_flush_always)) {
+ /*
+ * Clear the flush bit, it gets set again either from
+ * vcpu_run() or from one of the unsafe VMEXIT
+ * handlers.
+ */
vcpu->arch.l1tf_flush_l1d = false;
+ }
vcpu->stat.l1d_flush++;