On 10/27/22 22:03, David Matlack wrote:
This series turns off the NX Huge Page recovery worker when any memslot has dirty logging enabled. This avoids theoretical performance problems and reduces the CPU usage of NX Huge Pages when a VM is in the pre-copy phase of a Live Migration. Tested manually and ran all selftests. David Matlack (2): KVM: Keep track of the number of memslots with dirty logging enabled KVM: x86/mmu: Do not recover NX Huge Pages when dirty logging is enabled arch/x86/kvm/mmu/mmu.c | 8 ++++++++ include/linux/kvm_host.h | 2 ++ virt/kvm/kvm_main.c | 10 ++++++++++ 3 files changed, 20 insertions(+) base-commit: e18d6152ff0f41b7f01f9817372022df04e0d354
This can be a bit problematic because for example you could have dirty logging enabled only for a framebuffer or similar. In this case the memory being logged will not be the same as the one that is NX-split.
Perhaps we can take advantage of eager page splitting, that is you can add a bool to kvm_mmu_page that is set by shadow_mmu_get_sp_for_split and tdp_mmu_alloc_sp_for_split (or a similar place)?
Paolo