Commit ab51a434 authored by Uri Lublin's avatar Uri Lublin Committed by Avi Kivity

KVM: Add missing calls to mark_page_dirty()

A few places where we modify guest memory fail to call mark_page_dirty(),
causing live migration to fail.  This adds the missing calls.
Signed-off-by: default avatarUri Lublin <uril@qumranet.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent f7e6a45a
...@@ -228,12 +228,15 @@ int kvm_write_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size, ...@@ -228,12 +228,15 @@ int kvm_write_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size,
unsigned now; unsigned now;
unsigned offset; unsigned offset;
hva_t guest_buf; hva_t guest_buf;
gfn_t gfn;
paddr = gva_to_hpa(vcpu, addr); paddr = gva_to_hpa(vcpu, addr);
if (is_error_hpa(paddr)) if (is_error_hpa(paddr))
break; break;
gfn = vcpu->mmu.gva_to_gpa(vcpu, addr) >> PAGE_SHIFT;
mark_page_dirty(vcpu->kvm, gfn);
guest_buf = (hva_t)kmap_atomic( guest_buf = (hva_t)kmap_atomic(
pfn_to_page(paddr >> PAGE_SHIFT), KM_USER0); pfn_to_page(paddr >> PAGE_SHIFT), KM_USER0);
offset = addr & ~PAGE_MASK; offset = addr & ~PAGE_MASK;
...@@ -953,6 +956,7 @@ static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, ...@@ -953,6 +956,7 @@ static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
return 0; return 0;
page = gfn_to_page(m, gpa >> PAGE_SHIFT); page = gfn_to_page(m, gpa >> PAGE_SHIFT);
kvm_mmu_pre_write(vcpu, gpa, bytes); kvm_mmu_pre_write(vcpu, gpa, bytes);
mark_page_dirty(vcpu->kvm, gpa >> PAGE_SHIFT);
virt = kmap_atomic(page, KM_USER0); virt = kmap_atomic(page, KM_USER0);
memcpy(virt + offset_in_page(gpa), &val, bytes); memcpy(virt + offset_in_page(gpa), &val, bytes);
kunmap_atomic(virt, KM_USER0); kunmap_atomic(virt, KM_USER0);
...@@ -1294,6 +1298,7 @@ static int vcpu_register_para(struct kvm_vcpu *vcpu, gpa_t para_state_gpa) ...@@ -1294,6 +1298,7 @@ static int vcpu_register_para(struct kvm_vcpu *vcpu, gpa_t para_state_gpa)
if (is_error_hpa(para_state_hpa)) if (is_error_hpa(para_state_hpa))
goto err_gp; goto err_gp;
mark_page_dirty(vcpu->kvm, para_state_gpa >> PAGE_SHIFT);
para_state_page = pfn_to_page(para_state_hpa >> PAGE_SHIFT); para_state_page = pfn_to_page(para_state_hpa >> PAGE_SHIFT);
para_state = kmap_atomic(para_state_page, KM_USER0); para_state = kmap_atomic(para_state_page, KM_USER0);
...@@ -1323,6 +1328,7 @@ static int vcpu_register_para(struct kvm_vcpu *vcpu, gpa_t para_state_gpa) ...@@ -1323,6 +1328,7 @@ static int vcpu_register_para(struct kvm_vcpu *vcpu, gpa_t para_state_gpa)
vcpu->para_state_gpa = para_state_gpa; vcpu->para_state_gpa = para_state_gpa;
vcpu->hypercall_gpa = hypercall_gpa; vcpu->hypercall_gpa = hypercall_gpa;
mark_page_dirty(vcpu->kvm, hypercall_gpa >> PAGE_SHIFT);
hypercall = kmap_atomic(pfn_to_page(hypercall_hpa >> PAGE_SHIFT), hypercall = kmap_atomic(pfn_to_page(hypercall_hpa >> PAGE_SHIFT),
KM_USER1) + (hypercall_hpa & ~PAGE_MASK); KM_USER1) + (hypercall_hpa & ~PAGE_MASK);
kvm_arch_ops->patch_hypercall(vcpu, hypercall); kvm_arch_ops->patch_hypercall(vcpu, hypercall);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment