Skip to content

Commit f6f6195

Browse files
Lai Jiangshanbonzini
authored andcommitted
kvm x86/mmu: use KVM_REQ_MMU_SYNC to sync when needed
When kvm_mmu_get_page() gets a page with unsynced children, the spt pagetable is unsynchronized with the guest pagetable. But the guest might not issue a "flush" operation on it when the pagetable entry is changed from zero or other cases. The hypervisor has the responsibility to synchronize the pagetables. KVM behaved as above for many years, But commit 8c8560b ("KVM: x86/mmu: Use KVM_REQ_TLB_FLUSH_CURRENT for MMU specific flushes") inadvertently included a line of code to change it without giving any reason in the changelog. It is clear that the commit's intention was to change KVM_REQ_TLB_FLUSH -> KVM_REQ_TLB_FLUSH_CURRENT, so we don't needlessly flush other contexts; however, one of the hunks changed a nearby KVM_REQ_MMU_SYNC instead. This patch changes it back. Link: https://lore.kernel.org/lkml/[email protected]/ Cc: Sean Christopherson <[email protected]> Cc: Vitaly Kuznetsov <[email protected]> Signed-off-by: Lai Jiangshan <[email protected]> Message-Id: <[email protected]> fixes: 8c8560b ("KVM: x86/mmu: Use KVM_REQ_TLB_FLUSH_CURRENT for MMU specific flushes") Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent c6b177a commit f6f6195

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
24692469
}
24702470

24712471
if (sp->unsync_children)
2472-
kvm_make_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu);
2472+
kvm_make_request(KVM_REQ_MMU_SYNC, vcpu);
24732473

24742474
__clear_sp_write_flooding_count(sp);
24752475

0 commit comments

Comments
 (0)