Blame SOURCES/kvm-migration-ram-ensure-write-persistence-on-loading-al.patch

26ba25
From d06445e16ee0fa7d5ee4637aa686c48e88a9cb30 Mon Sep 17 00:00:00 2001
26ba25
From: "plai@redhat.com" <plai@redhat.com>
26ba25
Date: Mon, 7 Jan 2019 17:02:22 +0000
26ba25
Subject: [PATCH 21/22] migration/ram: ensure write persistence on loading all
26ba25
 data to PMEM.
26ba25
26ba25
RH-Author: plai@redhat.com
26ba25
Message-id: <1546880543-24860-10-git-send-email-plai@redhat.com>
26ba25
Patchwork-id: 83894
26ba25
O-Subject: [RHEL8.0 qemu-kvm PATCH v7 09/10] migration/ram: ensure write persistence on loading all data to PMEM.
26ba25
Bugzilla: 1539285
26ba25
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
26ba25
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
26ba25
26ba25
From: Junyan He <junyan.he@intel.com>
26ba25
26ba25
Because we need to make sure the pmem kind memory data is synced
26ba25
after migration, we choose to call pmem_persist() when the migration
26ba25
finish. This will make sure the data of pmem is safe and will not
26ba25
lose if power is off.
26ba25
26ba25
Signed-off-by: Junyan He <junyan.he@intel.com>
26ba25
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
26ba25
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
26ba25
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
26ba25
(cherry picked from commit 56eb90af39abf66c0e80588a9f50c31e7df7320b)
26ba25
Signed-off-by: Paul Lai <plai@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 include/qemu/pmem.h | 6 ++++++
26ba25
 migration/ram.c     | 8 ++++++++
26ba25
 2 files changed, 14 insertions(+)
26ba25
26ba25
diff --git a/include/qemu/pmem.h b/include/qemu/pmem.h
26ba25
index ebdb070..dfb6d0d 100644
26ba25
--- a/include/qemu/pmem.h
26ba25
+++ b/include/qemu/pmem.h
26ba25
@@ -25,6 +25,12 @@ pmem_memcpy_persist(void *pmemdest, const void *src, size_t len)
26ba25
     return NULL;
26ba25
 }
26ba25
 
26ba25
+static inline void
26ba25
+pmem_persist(const void *addr, size_t len)
26ba25
+{
26ba25
+    g_assert_not_reached();
26ba25
+}
26ba25
+
26ba25
 #endif /* CONFIG_LIBPMEM */
26ba25
 
26ba25
 #endif /* !QEMU_PMEM_H */
26ba25
diff --git a/migration/ram.c b/migration/ram.c
26ba25
index f850fd0..aba0f70 100644
26ba25
--- a/migration/ram.c
26ba25
+++ b/migration/ram.c
26ba25
@@ -33,6 +33,7 @@
26ba25
 #include "qemu/bitops.h"
26ba25
 #include "qemu/bitmap.h"
26ba25
 #include "qemu/main-loop.h"
26ba25
+#include "qemu/pmem.h"
26ba25
 #include "xbzrle.h"
26ba25
 #include "ram.h"
26ba25
 #include "migration.h"
26ba25
@@ -2766,6 +2767,13 @@ static int ram_load_setup(QEMUFile *f, void *opaque)
26ba25
 static int ram_load_cleanup(void *opaque)
26ba25
 {
26ba25
     RAMBlock *rb;
26ba25
+
26ba25
+    RAMBLOCK_FOREACH_MIGRATABLE(rb) {
26ba25
+        if (ramblock_is_pmem(rb)) {
26ba25
+            pmem_persist(rb->host, rb->used_length);
26ba25
+        }
26ba25
+    }
26ba25
+
26ba25
     xbzrle_load_cleanup();
26ba25
     compress_threads_load_cleanup();
26ba25
 
26ba25
-- 
26ba25
1.8.3.1
26ba25