From: junyan.he@hotmail.com
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com,
crosthwaite.peter@gmail.com, quintela@redhat.com,
rth@twiddle.net, dgilbert@redhat.com, famz@redhat.com,
Junyan He <junyan.he@intel.com>
Subject: [Qemu-devel] [PATCH 10/10] RFC: Enable nvdimm snapshot functions.
Date: Wed, 14 Mar 2018 09:20:18 +0800 [thread overview]
Message-ID: <1520990418-28258-11-git-send-email-junyan.he@hotmail.com> (raw)
In-Reply-To: <1520990418-28258-1-git-send-email-junyan.he@hotmail.com>
From: Junyan He <junyan.he@intel.com>
In snapshot saving, all nvdimm kind memory will be saved in different way
and we exclude all nvdimm kind memory region in ram.c
Signed-off-by: Junyan He <junyan.he@intel.com>
---
migration/ram.c | 17 +++++++++++++++++
vl.c | 1 +
2 files changed, 18 insertions(+)
diff --git a/migration/ram.c b/migration/ram.c
index d1db422..ad32469 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1219,9 +1219,15 @@ static bool find_dirty_block(RAMState *rs, PageSearchStatus *pss, bool *again)
/* Didn't find anything in this RAM Block */
pss->page = 0;
pss->block = QLIST_NEXT_RCU(pss->block, next);
+ while (ram_block_is_nvdimm_active(pss->block)) {
+ pss->block = QLIST_NEXT_RCU(pss->block, next);
+ }
if (!pss->block) {
/* Hit the end of the list */
pss->block = QLIST_FIRST_RCU(&ram_list.blocks);
+ while (ram_block_is_nvdimm_active(pss->block)) {
+ pss->block = QLIST_NEXT_RCU(pss->block, next);
+ }
/* Flag that we've looped */
pss->complete_round = true;
rs->ram_bulk_stage = false;
@@ -1541,6 +1547,9 @@ static int ram_find_and_save_block(RAMState *rs, bool last_stage)
if (!pss.block) {
pss.block = QLIST_FIRST_RCU(&ram_list.blocks);
+ while (ram_block_is_nvdimm_active(pss.block)) {
+ pss.block = QLIST_NEXT_RCU(pss.block, next);
+ }
}
do {
@@ -1583,6 +1592,10 @@ uint64_t ram_bytes_total(void)
rcu_read_lock();
RAMBLOCK_FOREACH(block) {
+ if (ram_block_is_nvdimm_active(block)) {
+ // If snapshot and the block is nvdimm, let nvdimm do the job
+ continue;
+ }
total += block->used_length;
}
rcu_read_unlock();
@@ -2222,6 +2235,10 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
qemu_put_be64(f, ram_bytes_total() | RAM_SAVE_FLAG_MEM_SIZE);
RAMBLOCK_FOREACH(block) {
+ if (ram_block_is_nvdimm_active(block)) {
+ // If snapshot and the block is nvdimm, let nvdimm do the job
+ continue;
+ }
qemu_put_byte(f, strlen(block->idstr));
qemu_put_buffer(f, (uint8_t *)block->idstr, strlen(block->idstr));
qemu_put_be64(f, block->used_length);
diff --git a/vl.c b/vl.c
index 3ef04ce..1bd5711 100644
--- a/vl.c
+++ b/vl.c
@@ -4502,6 +4502,7 @@ int main(int argc, char **argv, char **envp)
blk_mig_init();
ram_mig_init();
+ nvdimm_snapshot_init();
/* If the currently selected machine wishes to override the units-per-bus
* property of its default HBA interface type, do so now. */
--
2.7.4
next prev parent reply other threads:[~2018-03-14 1:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 1:20 [Qemu-devel] [PATCH 00/10] RFC: Optimize nvdimm kind memory for snapshot junyan.he
2018-03-14 1:20 ` [Qemu-devel] [PATCH 01/10] RFC: Add save and support snapshot dependency function to block driver junyan.he
2018-03-14 1:20 ` [Qemu-devel] [PATCH 02/10] RFC: Implement qcow2's snapshot dependent saving function junyan.he
2018-03-14 1:20 ` [Qemu-devel] [PATCH 03/10] RFC: Implement save and support snapshot dependency in block driver layer junyan.he
2018-03-14 1:20 ` [Qemu-devel] [PATCH 04/10] RFC: Set memory_region_set_log available for more client junyan.he
2018-03-14 1:20 ` [Qemu-devel] [PATCH 05/10] RFC: Add memory region snapshot bitmap get function junyan.he
2018-03-14 1:20 ` [Qemu-devel] [PATCH 06/10] RFC: Add save dependency functions to qemu_file junyan.he
2018-03-14 1:20 ` [Qemu-devel] [PATCH 07/10] RFC: Add get_current_snapshot_info to get the snapshot state junyan.he
2018-03-14 1:20 ` [Qemu-devel] [PATCH 08/10] RFC: Add a section_id parameter to save_live_iterate call junyan.he
2018-03-14 1:20 ` [Qemu-devel] [PATCH 09/10] RFC: Add nvdimm snapshot saving to migration junyan.he
2018-03-14 1:20 ` junyan.he [this message]
2018-03-14 1:31 ` [Qemu-devel] [PATCH 00/10] RFC: Optimize nvdimm kind memory for snapshot no-reply
2018-03-14 1:36 ` no-reply
-- strict thread matches above, loose matches on Subject: below --
2018-03-13 8:33 junyan.he
2018-03-13 8:33 ` [Qemu-devel] [PATCH 10/10] RFC: Enable nvdimm snapshot functions junyan.he
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=1520990418-28258-11-git-send-email-junyan.he@hotmail.com \
--to=junyan.he@hotmail.com \
--cc=crosthwaite.peter@gmail.com \
--cc=dgilbert@redhat.com \
--cc=famz@redhat.com \
--cc=junyan.he@intel.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@twiddle.net \
/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).