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

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