]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: fix nested guest live migration with PML
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 26 Sep 2019 16:47:59 +0000 (18:47 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 27 Sep 2019 11:13:39 +0000 (13:13 +0200)
commitaf84c08f40023d4cf3da393b3ac7ab7999b804a2
tree6cb2512b2573c31d94e5cc2cf2ce62a637c6e533
parentd1563a373db13bc6209512d9857f2caae65710f7
KVM: x86: fix nested guest live migration with PML

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 is relatively easy to add to KVM, because pretty much the only place
that needs changing is spte_clear_dirty.  The first access to the page
already goes through the page fault path and records the correct GPA;
it's only subsequent accesses that are wrong.  Therefore, we can equip
set_spte (where the first access happens) to record that the SPTE will
have to be write protected, and then spte_clear_dirty will use this
information to do the right thing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu.c