Skip to content

Commit ef2e18e

Browse files
committed
KVM: x86: Unconditionally set l1tf_flush_l1d during vCPU load
Always set l1tf_flush_l1d during kvm_arch_vcpu_load() instead of setting it only when the vCPU is being scheduled back in. The flag is processed only when VM-Enter is imminent, and KVM obviously needs to load the vCPU before VM-Enter, so attempting to precisely set l1tf_flush_l1d provides no meaningful value. I.e. the flag _will_ be set either way, it's simply a matter of when. Acked-by: Kai Huang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 2a27c43 commit ef2e18e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

arch/x86/kvm/x86.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5006,12 +5006,11 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
50065006
{
50075007
struct kvm_pmu *pmu = vcpu_to_pmu(vcpu);
50085008

5009-
if (vcpu->scheduled_out) {
5010-
vcpu->arch.l1tf_flush_l1d = true;
5011-
if (pmu->version && unlikely(pmu->event_count)) {
5012-
pmu->need_cleanup = true;
5013-
kvm_make_request(KVM_REQ_PMU, vcpu);
5014-
}
5009+
vcpu->arch.l1tf_flush_l1d = true;
5010+
5011+
if (vcpu->scheduled_out && pmu->version && pmu->event_count) {
5012+
pmu->need_cleanup = true;
5013+
kvm_make_request(KVM_REQ_PMU, vcpu);
50155014
}
50165015

50175016
/* Address WBINVD may be executed by guest */

0 commit comments

Comments
 (0)