[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/8] qemu-file: new hook in qemu-file
From: |
Denis V. Lunev |
Subject: |
[Qemu-devel] [PATCH 2/8] qemu-file: new hook in qemu-file |
Date: |
Wed, 7 Oct 2015 09:20:40 +0300 |
From: Igor Redko <address@hidden>
This patch adds hook_ram_sync() to QEMUFile abstraction. This hook
can be used for passing information about dirty memory.
An alternative is using existing hook_ram_load(). But this hook is
designed for incoming VM migration, so using it for outcoming VM
migration may complicate understanding of the code. On the other
hand, using existing code decreases volume of the patchset and its
impact.
Signed-off-by: Igor Redko <address@hidden>
Reviewed-by: Anna Melekhova <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
---
include/migration/migration.h | 1 +
include/migration/qemu-file.h | 1 +
migration/qemu-file.c | 12 ++++++++++++
3 files changed, 14 insertions(+)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 8334621..deb0d21 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -182,6 +182,7 @@ bool migrate_use_events(void);
void ram_control_before_iterate(QEMUFile *f, uint64_t flags);
void ram_control_after_iterate(QEMUFile *f, uint64_t flags);
void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data);
+void ram_control_sync_hook(QEMUFile *f, uint64_t flags, void *data);
/* Whenever this is found in the data stream, the flags
* will be passed to ram_control_load_hook in the incoming-migration
diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
index 29a338d..770dd98 100644
--- a/include/migration/qemu-file.h
+++ b/include/migration/qemu-file.h
@@ -105,6 +105,7 @@ typedef struct QEMUFileOps {
QEMURamHookFunc *before_ram_iterate;
QEMURamHookFunc *after_ram_iterate;
QEMURamHookFunc *hook_ram_load;
+ QEMURamHookFunc *hook_ram_sync;
QEMURamSaveFunc *save_page;
QEMUFileShutdownFunc *shut_down;
} QEMUFileOps;
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 49addf6..a05d672 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -168,6 +168,18 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags,
void *data)
}
}
+void ram_control_sync_hook(QEMUFile *f, uint64_t flags, void *data)
+{
+ int ret = 0;
+
+ if (f->ops->hook_ram_sync) {
+ ret = f->ops->hook_ram_sync(f, f->opaque, flags, data);
+ if (ret < 0) {
+ qemu_file_set_error(f, ret);
+ }
+ }
+}
+
size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
ram_addr_t offset, size_t size,
uint64_t *bytes_sent)
--
2.1.4
- Re: [Qemu-devel] [PATCH 3/8] migration: add new capability test-only, (continued)
- Re: [Qemu-devel] [PATCH 3/8] migration: add new capability test-only, Dr. David Alan Gilbert, 2015/10/09
- [Qemu-devel] [PATCH 7/8] migration: new migration test mode, Denis V. Lunev, 2015/10/08
- Re: [Qemu-devel] [PATCH 7/8] migration: new migration test mode, Dr. David Alan Gilbert, 2015/10/08
- Re: [Qemu-devel] [PATCH 7/8] migration: new migration test mode, Eric Blake, 2015/10/08
- Re: [Qemu-devel] [PATCH 7/8] migration: new migration test mode, Denis V. Lunev, 2015/10/09
- Re: [Qemu-devel] [PATCH 7/8] migration: new migration test mode, Dr. David Alan Gilbert, 2015/10/08
- Re: [Qemu-devel] [PATCH 7/8] migration: new migration test mode, Denis V. Lunev, 2015/10/09
- Re: [Qemu-devel] [PATCH 7/8] migration: new migration test mode, Dr. David Alan Gilbert, 2015/10/08
- [Qemu-devel] [PATCH 4/8] migration: add function for reseting migration bitmap, Denis V. Lunev, 2015/10/08
- [Qemu-devel] [PATCH 5/8] migration: add draft of new transport, Denis V. Lunev, 2015/10/08
- [Qemu-devel] [PATCH 2/8] qemu-file: new hook in qemu-file,
Denis V. Lunev <=
- [Qemu-devel] [PATCH 6/8] migration: implementation of hook_ram_sync, Denis V. Lunev, 2015/10/08
- Re: [Qemu-devel] [PATCH 6/8] migration: implementation of hook_ram_sync, Paolo Bonzini, 2015/10/08
- Re: [Qemu-devel] [PATCH 6/8] migration: implementation of hook_ram_sync, Denis V. Lunev, 2015/10/09
- Re: [Qemu-devel] [PATCH 6/8] migration: implementation of hook_ram_sync, Paolo Bonzini, 2015/10/08
- Re: [Qemu-devel] [PATCH 6/8] migration: implementation of hook_ram_sync, Denis V. Lunev, 2015/10/09
- Re: [Qemu-devel] [PATCH 6/8] migration: implementation of hook_ram_sync, Dr. David Alan Gilbert, 2015/10/08
- [Qemu-devel] [PATCH 1/8] migration: fix expected_downtime, Denis V. Lunev, 2015/10/08
- [Qemu-devel] [PATCH 8/8] migration: add output of gathered statistics, Denis V. Lunev, 2015/10/08
- Re: [Qemu-devel] [RFC 0/8] QEMUFile-way to gather VM's memory statistics, Dr. David Alan Gilbert, 2015/10/08