[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v10 12/14, resend] rdma: send pc.ram
From: |
mrhines |
Subject: |
[Qemu-devel] [PATCH v10 12/14, resend] rdma: send pc.ram |
Date: |
Mon, 24 Jun 2013 09:46:28 -0400 |
From: "Michael R. Hines" <address@hidden>
This takes advantages of the previous patches:
1. use the new QEMUFileOps hook 'save_page'
2. call out to the right accessor methods to invoke
the iteration hooks defined in QEMUFileOps
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Chegu Vinod <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Tested-by: Chegu Vinod <address@hidden>
Tested-by: Michael R. Hines <address@hidden>
Signed-off-by: Michael R. Hines <address@hidden>
---
arch_init.c | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/arch_init.c b/arch_init.c
index 2f1fdd3..ebb601b 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -115,6 +115,7 @@ const uint32_t arch_type = QEMU_ARCH;
#define RAM_SAVE_FLAG_EOS 0x10
#define RAM_SAVE_FLAG_CONTINUE 0x20
#define RAM_SAVE_FLAG_XBZRLE 0x40
+/* 0x80 is reserved in migration.h start with 0x100 next */
static struct defconfig_file {
@@ -447,6 +448,7 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
ram_bulk_stage = false;
}
} else {
+ int ret;
uint8_t *p;
int cont = (block == last_sent_block) ?
RAM_SAVE_FLAG_CONTINUE : 0;
@@ -455,7 +457,18 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
/* In doubt sent page as normal */
bytes_sent = -1;
- if (is_zero_page(p)) {
+ ret = ram_control_save_page(f, block->offset,
+ offset, TARGET_PAGE_SIZE, &bytes_sent);
+
+ if (ret != RAM_SAVE_CONTROL_NOT_SUPP) {
+ if (ret != RAM_SAVE_CONTROL_DELAYED) {
+ if (bytes_sent > 0) {
+ acct_info.norm_pages++;
+ } else if (bytes_sent == 0) {
+ acct_info.dup_pages++;
+ }
+ }
+ } else if (is_zero_page(p)) {
acct_info.dup_pages++;
if (!ram_bulk_stage) {
bytes_sent = save_block_hdr(f, block, offset, cont,
@@ -610,6 +623,15 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
}
qemu_mutex_unlock_ramlist();
+
+ /*
+ * Please leave in place. These calls generate reserved messages in
+ * the RDMA protocol in order to pre-register RDMA memory in the
+ * future before the bulk round begins.
+ */
+ ram_control_before_iterate(f, RAM_CONTROL_SETUP);
+ ram_control_after_iterate(f, RAM_CONTROL_SETUP);
+
qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
return 0;
@@ -628,6 +650,8 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
reset_ram_globals();
}
+ ram_control_before_iterate(f, RAM_CONTROL_ROUND);
+
t0 = qemu_get_clock_ns(rt_clock);
i = 0;
while ((ret = qemu_file_rate_limit(f)) == 0) {
@@ -658,6 +682,12 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
qemu_mutex_unlock_ramlist();
+ /*
+ * Must occur before EOS (or any QEMUFile operation)
+ * because of RDMA protocol.
+ */
+ ram_control_after_iterate(f, RAM_CONTROL_ROUND);
+
if (ret < 0) {
bytes_transferred += total_sent;
return ret;
@@ -675,6 +705,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
qemu_mutex_lock_ramlist();
migration_bitmap_sync();
+ ram_control_before_iterate(f, RAM_CONTROL_FINISH);
+
/* try transferring iterative blocks of memory */
/* flush all remaining blocks regardless of rate limiting */
@@ -688,6 +720,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
}
bytes_transferred += bytes_sent;
}
+
+ ram_control_after_iterate(f, RAM_CONTROL_FINISH);
migration_end();
qemu_mutex_unlock_ramlist();
@@ -884,6 +918,8 @@ static int ram_load(QEMUFile *f, void *opaque, int
version_id)
ret = -EINVAL;
goto done;
}
+ } else if (flags & RAM_SAVE_FLAG_HOOK) {
+ ram_control_load_hook(f, flags);
}
error = qemu_file_get_error(f);
if (error) {
--
1.7.10.4
- [Qemu-devel] [PATCH v10 00/14, resend] rdma: migration support, mrhines, 2013/06/24
- [Qemu-devel] [PATCH v10 07/14, resend] rdma: introduce ram_handle_compressed(), mrhines, 2013/06/24
- [Qemu-devel] [PATCH v10 01/14, resend] rdma: add documentation, mrhines, 2013/06/24
- [Qemu-devel] [PATCH v10 08/14, resend] rdma: introduce qemu_ram_foreach_block(), mrhines, 2013/06/24
- [Qemu-devel] [PATCH v10 12/14, resend] rdma: send pc.ram,
mrhines <=
- [Qemu-devel] [PATCH v10 14/14, resend] rdma: add setup time accounting to QMP statistics, mrhines, 2013/06/24
[Qemu-devel] [PATCH v10 11/14, resend] rdma: core logic, mrhines, 2013/06/24
[Qemu-devel] [PATCH v10 10/14, resend] rdma: introduce capability x-rdma-pin-all, mrhines, 2013/06/24
[Qemu-devel] [PATCH v10 03/14, resend] rdma: export yield_until_fd_readable(), mrhines, 2013/06/24