]> 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)
commit9567c76b346cbfa76e0dea6a739d690bbe3d092a
tree1af5583196bc8655f33c9d4d37c1f2a9a100e7b6
parent54f835798f53cb603df4f1d0ce48bfafd282580b
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: e5acdd07ae0a1 ("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