Skip to content

Commit 3dee3b1

Browse files
committed
KVM: x86: Drop now-superflous setting of l1tf_flush_l1d in vcpu_run()
Now that KVM unconditionally sets l1tf_flush_l1d in kvm_arch_vcpu_load(), drop the redundant store from vcpu_run(). The flag is cleared only when VM-Enter is imminent, deep below vcpu_run(), i.e. barring a KVM bug, it's impossible for l1tf_flush_l1d to be cleared between loading the vCPU and calling vcpu_run(). Acked-by: Kai Huang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent ef2e18e commit 3dee3b1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6673,9 +6673,10 @@ static noinstr void vmx_l1d_flush(struct kvm_vcpu *vcpu)
66736673
bool flush_l1d;
66746674

66756675
/*
6676-
* Clear the per-vcpu flush bit, it gets set again
6677-
* either from vcpu_run() or from one of the unsafe
6678-
* VMEXIT handlers.
6676+
* Clear the per-vcpu flush bit, it gets set again if the vCPU
6677+
* is reloaded, i.e. if the vCPU is scheduled out or if KVM
6678+
* exits to userspace, or if KVM reaches one of the unsafe
6679+
* VMEXIT handlers, e.g. if KVM calls into the emulator.
66796680
*/
66806681
flush_l1d = vcpu->arch.l1tf_flush_l1d;
66816682
vcpu->arch.l1tf_flush_l1d = false;

arch/x86/kvm/x86.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11253,7 +11253,6 @@ static int vcpu_run(struct kvm_vcpu *vcpu)
1125311253
int r;
1125411254

1125511255
vcpu->run->exit_reason = KVM_EXIT_UNKNOWN;
11256-
vcpu->arch.l1tf_flush_l1d = true;
1125711256

1125811257
for (;;) {
1125911258
/*

0 commit comments

Comments
 (0)