KVM: Remove write access permissions when dirty-page-logging is enabled
authorUri Lublin <uril@qumranet.com>
Thu, 22 Feb 2007 15:37:32 +0000 (17:37 +0200)
committerAvi Kivity <avi@qumranet.com>
Sun, 4 Mar 2007 09:12:43 +0000 (11:12 +0200)
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>
drivers/kvm/kvm_main.c

index be7694d..e48b4d7 100644 (file)
@@ -748,6 +748,8 @@ raced:
                vcpu = vcpu_load_slot(kvm, i);
                if (!vcpu)
                        continue;
+               if (new.flags & KVM_MEM_LOG_DIRTY_PAGES)
+                       do_remove_write_access(vcpu, mem->slot);
                kvm_mmu_reset_context(vcpu);
                vcpu_put(vcpu);
        }