aboutsummaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorMichael R. Hines <mrhines@us.ibm.com>2013-06-25 21:35:28 -0400
committerJuan Quintela <quintela@redhat.com>2013-06-27 02:38:35 +0200
commit2b0ce0797d6bfb13ebefe010da86abced0b7a9b3 (patch)
treef98468e6dc3457bc43c451b6ce4fc5cabce3c96c /arch_init.c
parentf4abc9d621823b14a6cd508c66c1ecb21f96349e (diff)
rdma: introduce qemu_update_position()
RDMA writes happen asynchronously, and thus the performance accounting also needs to be able to occur asynchronously. This allows anybody to call into savevm.c to update both f->pos as well as into arch_init.c to update the acct_info structure with up-to-date values when the RDMA transfer actually completes. Reviewed-by: Juan Quintela <quintela@redhat.com> Tested-by: Chegu Vinod <chegu_vinod@hp.com> Tested-by: Michael R. Hines <mrhines@us.ibm.com> Signed-off-by: Michael R. Hines <mrhines@us.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch_init.c b/arch_init.c
index 4dd17f4ff3..ea9ddad697 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -493,6 +493,18 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
static uint64_t bytes_transferred;
+void acct_update_position(QEMUFile *f, size_t size, bool zero)
+{
+ uint64_t pages = size / TARGET_PAGE_SIZE;
+ if (zero) {
+ acct_info.dup_pages += pages;
+ } else {
+ acct_info.norm_pages += pages;
+ bytes_transferred += size;
+ qemu_update_position(f, size);
+ }
+}
+
static ram_addr_t ram_save_remaining(void)
{
return migration_dirty_pages;