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

357786
From 3d60cee570db578cc7589cac9844129e9ac9d460 Mon Sep 17 00:00:00 2001
357786
From: "plai@redhat.com" <plai@redhat.com>
357786
Date: Fri, 31 Aug 2018 16:25:59 +0200
357786
Subject: [PATCH 17/29] migration/ram: ensure write persistence on loading all
357786
 data to PMEM.
357786
357786
RH-Author: plai@redhat.com
357786
Message-id: <1535732759-22481-10-git-send-email-plai@redhat.com>
357786
Patchwork-id: 82008
357786
O-Subject: [RHEL7.6 PATCH BZ 1539280 9/9] migration/ram: ensure write persistence on loading all data to PMEM.
357786
Bugzilla: 1539280
357786
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
357786
RH-Acked-by: Pankaj Gupta <pagupta@redhat.com>
357786
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
357786
From: Junyan He <junyan.he@intel.com>
357786
357786
Because we need to make sure the pmem kind memory data is synced
357786
after migration, we choose to call pmem_persist() when the migration
357786
finish. This will make sure the data of pmem is safe and will not
357786
lose if power is off.
357786
357786
Signed-off-by: Junyan He <junyan.he@intel.com>
357786
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
357786
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
357786
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
357786
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
357786
(cherry picked from commit 56eb90af39abf66c0e80588a9f50c31e7df7320b)
357786
Signed-off-by: Paul Lai <plai@redhat.com>
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 include/qemu/pmem.h | 6 ++++++
357786
 migration/ram.c     | 8 ++++++++
357786
 2 files changed, 14 insertions(+)
357786
357786
diff --git a/include/qemu/pmem.h b/include/qemu/pmem.h
357786
index ebdb070..dfb6d0d 100644
357786
--- a/include/qemu/pmem.h
357786
+++ b/include/qemu/pmem.h
357786
@@ -25,6 +25,12 @@ pmem_memcpy_persist(void *pmemdest, const void *src, size_t len)
357786
     return NULL;
357786
 }
357786
 
357786
+static inline void
357786
+pmem_persist(const void *addr, size_t len)
357786
+{
357786
+    g_assert_not_reached();
357786
+}
357786
+
357786
 #endif /* CONFIG_LIBPMEM */
357786
 
357786
 #endif /* !QEMU_PMEM_H */
357786
diff --git a/migration/ram.c b/migration/ram.c
357786
index f850fd0..aba0f70 100644
357786
--- a/migration/ram.c
357786
+++ b/migration/ram.c
357786
@@ -33,6 +33,7 @@
357786
 #include "qemu/bitops.h"
357786
 #include "qemu/bitmap.h"
357786
 #include "qemu/main-loop.h"
357786
+#include "qemu/pmem.h"
357786
 #include "xbzrle.h"
357786
 #include "ram.h"
357786
 #include "migration.h"
357786
@@ -2766,6 +2767,13 @@ static int ram_load_setup(QEMUFile *f, void *opaque)
357786
 static int ram_load_cleanup(void *opaque)
357786
 {
357786
     RAMBlock *rb;
357786
+
357786
+    RAMBLOCK_FOREACH_MIGRATABLE(rb) {
357786
+        if (ramblock_is_pmem(rb)) {
357786
+            pmem_persist(rb->host, rb->used_length);
357786
+        }
357786
+    }
357786
+
357786
     xbzrle_load_cleanup();
357786
     compress_threads_load_cleanup();
357786
 
357786
-- 
357786
1.8.3.1
357786