KVM: Remove write access permissions when dirty-page-logging is enabled

Enabling dirty page logging is done using KVM_SET_MEMORY_REGION ioctl.
If the memory region already exists, we need to remove write accesses,
so writes will be caught, and dirty pages will be logged.

Signed-off-by: Uri Lublin <uril@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>

authored by Uri Lublin and committed by Avi Kivity ff990d59 02b27c1f

+2
+2
drivers/kvm/kvm_main.c
··· 748 748 vcpu = vcpu_load_slot(kvm, i); 749 749 if (!vcpu) 750 750 continue; 751 + if (new.flags & KVM_MEM_LOG_DIRTY_PAGES) 752 + do_remove_write_access(vcpu, mem->slot); 751 753 kvm_mmu_reset_context(vcpu); 752 754 vcpu_put(vcpu); 753 755 }