]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Manually flush collapsible SPTEs only when toggling flags
authorSean Christopherson <sean.j.christopherson@intel.com>
Wed, 11 Sep 2019 19:19:52 +0000 (12:19 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 24 Sep 2019 11:37:25 +0000 (13:37 +0200)
commit8e39f2f46abb8dea54aef398db5530742253dc15
tree1af5583196bc8655f33c9d4d37c1f2a9a100e7b6
parent4871f3f0ea8ea5f77b3a4473e8d57c0cc8bd327c
KVM: x86: Manually flush collapsible SPTEs only when toggling flags

Zapping collapsible sptes, a.k.a. 4k sptes that can be promoted into a
large page, is only necessary when changing only the dirty logging flag
of a memory region.  If the memslot is also being moved, then all sptes
for the memslot are zapped when it is invalidated.  When a memslot is
being created, it is impossible for there to be existing dirty mappings,
e.g. KVM can have MMIO sptes, but not present, and thus dirty, sptes.

Note, the comment and logic are shamelessly borrowed from MIPS's version
of kvm_arch_commit_memory_region().

Fixes: a4d5f853f0271 ("kvm: mmu: lazy collapse small sptes into large sptes")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c