Commit 2b0ce079 authored by Michael R. Hines's avatar Michael R. Hines Committed by Juan Quintela
Browse files

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: default avatarJuan Quintela <>
Tested-by: default avatarChegu Vinod <>
Tested-by: default avatarMichael R. Hines <>
Signed-off-by: default avatarMichael R. Hines <>
Signed-off-by: default avatarJuan Quintela <>
parent f4abc9d6
......@@ -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;
......@@ -92,6 +92,8 @@ uint64_t ram_bytes_remaining(void);
uint64_t ram_bytes_transferred(void);
uint64_t ram_bytes_total(void);
void acct_update_position(QEMUFile *f, size_t size, bool zero);
extern SaveVMHandlers savevm_ram_handlers;
uint64_t dup_mig_bytes_transferred(void);
......@@ -93,6 +93,7 @@ void qemu_put_be32(QEMUFile *f, unsigned int v);
void qemu_put_be64(QEMUFile *f, uint64_t v);
int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size);
int qemu_get_byte(QEMUFile *f);
void qemu_update_position(QEMUFile *f, size_t size);
static inline unsigned int qemu_get_ubyte(QEMUFile *f)
......@@ -671,6 +671,11 @@ int qemu_get_fd(QEMUFile *f)
return -1;
void qemu_update_position(QEMUFile *f, size_t size)
f->pos += size;
/** Closes the file
* Returns negative error value if any error happened on previous operations or
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment