From: junyan.he@gmx.com
To: qemu-devel@nongnu.org
Cc: ehabkost@redhat.com, imammedo@redhat.com, pbonzini@redhat.com,
crosthwaite.peter@gmail.com, rth@twiddle.net,
xiaoguangrong.eric@gmail.com, mst@redhat.com,
quintela@redhat.com, dgilbert@redhat.com, stefanha@redhat.com,
Junyan He <junyan.he@intel.com>
Subject: [Qemu-devel] [PATCH 7/7 V7] migration/ram: ensure write persistence on loading all data to PMEM.
Date: Tue, 12 Jun 2018 14:28:20 +0800 [thread overview]
Message-ID: <1528784900-7310-8-git-send-email-junyan.he@gmx.com> (raw)
In-Reply-To: <1528784900-7310-1-git-send-email-junyan.he@gmx.com>
From: Junyan He <junyan.he@intel.com>
Because we need to make sure the pmem kind memory data is synced
after migration, we choose to call pmem_persist() when the migration
finish. This will make sure the data of pmem is safe and will not
lose if power is off.
Signed-off-by: Junyan He <junyan.he@intel.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
include/qemu/pmem.h | 1 +
migration/ram.c | 8 ++++++++
stubs/pmem.c | 4 ++++
3 files changed, 13 insertions(+)
diff --git a/include/qemu/pmem.h b/include/qemu/pmem.h
index 00d6680..8f52b08 100644
--- a/include/qemu/pmem.h
+++ b/include/qemu/pmem.h
@@ -17,6 +17,7 @@
#else /* !CONFIG_LIBPMEM */
void *pmem_memcpy_persist(void *pmemdest, const void *src, size_t len);
+void pmem_persist(const void *addr, size_t len);
#endif /* CONFIG_LIBPMEM */
diff --git a/migration/ram.c b/migration/ram.c
index d9093a7..5603505 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -33,6 +33,7 @@
#include "qemu/bitops.h"
#include "qemu/bitmap.h"
#include "qemu/main-loop.h"
+#include "qemu/pmem.h"
#include "xbzrle.h"
#include "ram.h"
#include "migration.h"
@@ -3065,6 +3066,13 @@ static int ram_load_setup(QEMUFile *f, void *opaque)
static int ram_load_cleanup(void *opaque)
{
RAMBlock *rb;
+
+ RAMBLOCK_FOREACH_MIGRATABLE(rb) {
+ if (ramblock_is_pmem(rb)) {
+ pmem_persist(rb->host, rb->used_length);
+ }
+ }
+
xbzrle_load_cleanup();
compress_threads_load_cleanup();
diff --git a/stubs/pmem.c b/stubs/pmem.c
index b4ec72d..f794262 100644
--- a/stubs/pmem.c
+++ b/stubs/pmem.c
@@ -17,3 +17,7 @@ void *pmem_memcpy_persist(void *pmemdest, const void *src, size_t len)
{
return memcpy(pmemdest, src, len);
}
+
+void pmem_persist(const void *addr, size_t len)
+{
+}
--
2.7.4
prev parent reply other threads:[~2018-06-12 6:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 6:28 [Qemu-devel] [PATCH 0/7 V7] nvdimm: guarantee persistence of QEMU writes to persistent memory junyan.he
2018-06-12 6:28 ` [Qemu-devel] [PATCH 1/7 V7] memory, exec: Expose all memory block related flags junyan.he
2018-06-12 6:28 ` [Qemu-devel] [PATCH 2/7 V7] memory, exec: switch file ram allocation functions to 'flags' parameters junyan.he
2018-06-12 6:28 ` [Qemu-devel] [PATCH 3/7 V7] hostmem-file: add the 'pmem' option junyan.he
2018-06-15 9:03 ` Igor Mammedov
2018-06-19 3:29 ` He, Junyan
2018-07-03 8:02 ` junyan.he
2018-06-12 6:28 ` [Qemu-devel] [PATCH 4/7 V7] configure: add libpmem support junyan.he
2018-06-12 6:28 ` [Qemu-devel] [PATCH 5/7 V7] mem/nvdimm: ensure write persistence to PMEM in label emulation junyan.he
2018-06-12 6:28 ` [Qemu-devel] [PATCH 6/7 V7] migration/ram: Add check and info message to nvdimm post copy junyan.he
2018-06-12 6:28 ` junyan.he [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1528784900-7310-8-git-send-email-junyan.he@gmx.com \
--to=junyan.he@gmx.com \
--cc=crosthwaite.peter@gmail.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=junyan.he@intel.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
--cc=xiaoguangrong.eric@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).