randprotect: KSM: re-enable mmu_notifier_change_pte during wrprotect
mmu_notifier_invalidate_range_start zaps all shadow pagetables leaving
nothing to do later for mmu_notifier_change_pte.
This hurts KVM+KSM by causing an unnecessary vmexit floods even if the
guest only reads the memory (and KSM does its best effort to only
merge memory that doesn't change frequently and wasn't supposed to
trigger vmexists post merge).
The s/ptep_clear_flush_notify/ptep_clear_flush/ in commit 0f10851ea475
resolved the issue only for mmu notifier users that don't need to
invalidate in mmu_notifier_invalidate_range_start because they share
the same pgtables of the primary MMU as IOMMUs, but it didn't solve
the issue for the KVM shadow secondary MMU.
Reported-by: Jonas Juffinger <jonas.juffinger@lamarr.at>
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
4 files changed