浏览代码

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>
Uri Lublin 18 年之前
父节点
当前提交
ff990d5952
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/kvm/kvm_main.c

+ 2 - 0
drivers/kvm/kvm_main.c

@@ -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);
 	}