[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RESEND v7 02/12] rdma: introduce qemu_update_positio
From: |
mrhines |
Subject: |
[Qemu-devel] [PATCH RESEND v7 02/12] rdma: introduce qemu_update_position() |
Date: |
Mon, 10 Jun 2013 13:16:04 -0400 |
From: "Michael R. Hines" <address@hidden>
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.
Signed-off-by: Michael R. Hines <address@hidden>
---
arch_init.c | 12 ++++++++++++
include/migration/migration.h | 2 ++
include/migration/qemu-file.h | 1 +
savevm.c | 5 +++++
4 files changed, 20 insertions(+)
diff --git a/arch_init.c b/arch_init.c
index 5d32ecf..819ca5a 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -498,6 +498,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;
diff --git a/include/migration/migration.h b/include/migration/migration.h
index e2acec6..0be28a2 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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);
diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
index 7519464..8fab0dd 100644
--- a/include/migration/qemu-file.h
+++ b/include/migration/qemu-file.h
@@ -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)
{
diff --git a/savevm.c b/savevm.c
index 2ce439f..2983905 100644
--- a/savevm.c
+++ b/savevm.c
@@ -670,6 +670,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
--
1.7.10.4
- [Qemu-devel] [PATCH RESEND v7 00/12] rdma: migration support, mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 06/12] rdma: export qemu_fflush(), mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 05/12] rdma: introduce qemu_file_mode_is_not_valid(), mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 02/12] rdma: introduce qemu_update_position(),
mrhines <=
- [Qemu-devel] [PATCH RESEND v7 07/12] rdma: introduce ram_handle_compressed(), mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 03/12] rdma: export yield_until_fd_readable(), mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 01/12] rdma: add documentation, mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 09/12] rdma: new QEMUFileOps hooks, mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 04/12] rdma: export throughput w/ MigrationStats QMP, mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 10/12] rdma: introduce capability x-rdma-pin-all, mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 08/12] rdma: introduce qemu_ram_foreach_block(), mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 12/12] rdma: send pc.ram, mrhines, 2013/06/10
- [Qemu-devel] [PATCH RESEND v7 11/12] rdma: core logic, mrhines, 2013/06/10