[PATCH 6/8] KVM: arm64: flush dirty logging data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make sure we do not miss last dirty pages and flush the data after
disabling dirty logging. Flush only when dirty logging is actually
disabled i.e. when page_tracking_disable returns 0.

Signed-off-by: Lilit Janpoladyan <lilitj@xxxxxxxxxx>
---
 arch/arm64/kvm/arm.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 139d7e929266..5ed049accb3e 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -1877,17 +1877,21 @@ int kvm_arch_disable_dirty_logging(struct kvm *kvm, const struct kvm_memory_slot
 
 	r = page_tracking_disable(kvm->arch.page_tracking_ctx, -1);
 
-	if (r == -EBUSY) {
-		r = 0;
-	} else {
-		page_tracking_release(kvm->arch.page_tracking_ctx);
-		kvm->arch.page_tracking_ctx = NULL;
+	if (r == -EBUSY)
+		return 0;
 
-		if (kvm->arch.page_tracking_pg) {
-			free_page((unsigned long)kvm->arch.page_tracking_pg);
-			kvm->arch.page_tracking_pg = NULL;
-		}
+	/* Flush only when dirty tracking is disabled */
+	if (!r)
+		r = page_tracking_flush(kvm->arch.page_tracking_ctx);
+
+	/* But release resources anyway */
+	page_tracking_release(kvm->arch.page_tracking_ctx);
+	kvm->arch.page_tracking_ctx = NULL;
+	if (kvm->arch.page_tracking_pg) {
+		free_page((unsigned long)kvm->arch.page_tracking_pg);
+		kvm->arch.page_tracking_pg = NULL;
 	}
+
 	return r;
 }
 
-- 
2.40.1





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux