[PATCH 0/3] KVM: MMU: fix nested guest live migration with PML

From: Paolo Bonzini
Date: Thu Sep 26 2019 - 13:18:33 EST


Shadow paging is fundamentally incompatible with the page-modification
log, because the GPAs in the log come from the wrong memory map.
In particular, for the EPT page-modification log, the GPAs in the log come
from L2 rather than L1. (If there was a non-EPT page-modification log,
we couldn't use it for shadow paging because it would log GVAs rather
than GPAs).

Therefore, we need to rely on write protection to record dirty pages.
This has the side effect of bypassing PML, since writes now result in an
EPT violation vmexit.

This turns out to be a surprisingly small patch---the testcase is what's
guilty of the scary diffstat. But that is because the KVM MMU code is
absurdly clever, so a very close review is appreciated.

Paolo

Paolo Bonzini (3):
KVM: x86: assign two bits to track SPTE kinds
KVM: x86: fix nested guest live migration with PML
selftests: kvm: add test for dirty logging inside nested guests

arch/x86/include/asm/kvm_host.h | 7 -
arch/x86/kvm/mmu.c | 58 ++++--
tools/testing/selftests/kvm/Makefile | 1 +
.../selftests/kvm/include/x86_64/processor.h | 3 +
tools/testing/selftests/kvm/include/x86_64/vmx.h | 14 ++
tools/testing/selftests/kvm/lib/kvm_util.c | 2 +-
.../testing/selftests/kvm/lib/kvm_util_internal.h | 3 +
tools/testing/selftests/kvm/lib/x86_64/vmx.c | 201 ++++++++++++++++++++-
.../selftests/kvm/x86_64/vmx_dirty_log_test.c | 156 ++++++++++++++++
9 files changed, 424 insertions(+), 21 deletions(-)
create mode 100644 tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c

--
1.8.3.1