This patch series implements a new dirty logging mode utilizing the Dirty bits in the SPTEs, when available, instead of relying on write protection. On hosts that do not support PML, this can result in significant improvement in VM performance for some workloads during the brownout phase of a live migration when compared to write protection based dirty logging, because of the elimination of all the VM exits on memory writes. However, this new mode does incur additional time in the get_dirty_log IOCTL because of having to scan all the SPTEs for dirtiness, which can in some cases, result in slightly elongating the blackout time. Two strategies can be used to mitigate that. The first, included in this series, is to have the ability to dynamically switch between D Bit based and write protection based dirty logging modes. Then the mode could be switched to write protection just before entering blackout, thus incurring less time in the get_dirty_log IOCTL during blackout, while keeping the reduced overhead of the D Bit based mode during brownout. Secondly, the scan in the get_dirty_log IOCTL can be parallelized, which results in that IOCTL becoming faster for all modes. That patch series will be sent out separately a little later. The series also includes a couple of other minor dirty logging related performance improvements, including removal of extra TLB flushes in one instance and more efficient functions for testing/clearing Writable/Dirty bits. Junaid Shahid (10): kvm: mmu: spte_write_protect optimization kvm: mmu: Allow reading hardware dirty state from kvm_get_dirty_log_protect kvm: x86: mmu: Change __rmap_clear_dirty to __rmap_test_and_clear_dirty kvm: mmu: x86: Add dirty bit clearing notification hook kvm: x86: mmu: Remove extra TLB flush from vmx_slot_enable_log_dirty() kvm: x86: mmu: Use D bit for dirty logging kvm: x86: mmu: Per-VM dirty logging mode kvm: x86: mmu: Refactor kvm_mmu_slot_*_remove_write_access kvm: x86: mmu: Ability to switch dirty logging mode dynamically kvm: x86: mmu: Add IOCTLs to allow userspace to switch dirty logging mode Documentation/virtual/kvm/api.txt | 39 +++ arch/mips/kvm/mmu.c | 16 +- arch/x86/include/asm/kvm_host.h | 27 ++- arch/x86/include/uapi/asm/kvm.h | 5 + arch/x86/kvm/mmu.c | 390 +++++++++++++++++++++++++----- arch/x86/kvm/mmu.h | 3 + arch/x86/kvm/vmx.c | 20 +- arch/x86/kvm/x86.c | 54 ++++- include/linux/kvm_host.h | 8 +- include/uapi/linux/kvm.h | 3 + virt/kvm/arm/mmu.c | 9 +- virt/kvm/kvm_main.c | 21 +- 12 files changed, 482 insertions(+), 113 deletions(-) -- 2.19.1.568.g152ad8e336-goog