migration queue
cover migration queue
Hi
This is the intersect of the paolo & me patches for migration thread, please consided for inclusion.
The following changes since commit cf7c3f0cb5a7129f57fa9e69d410d6a05031988c:
virtio-9p: fix compilation error. (2013-01-14 18:52:39 -0600)
are available in the git repository at:
git://repo.or.cz/qemu/quintela.git thread.next
for you to fetch changes up to 869342e49d89763f7590ebc52eaecd9ce9f7baa1:
Rename buffered_ to migration_ (2013-01-15 12:14:40 +0100)
----------------------------------------------------------------
Juan Quintela (8):
qemu-file: Only set last_error if it is not already set
migration: move begining stage to the migration thread
migration: Add buffered_flush error handling
migration: move exit condition to migration thread
migration: unfold rest of migrate_fd_put_ready() into thread
migration: Only go to the iterate stage if there is anything to send
migration: remove argument to qemu_savevm_state_cancel Rename buffered_ to migration_
Paolo Bonzini (6):
Unlock ramlist lock also in error case Protect migration_bitmap_sync() with the ramlist lock use XFER_LIMIT_RATIO consistently
migration: make function static
migration: remove double call to migrate_fd_close
migration: fix off-by-one in buffered_rate_limit
arch_init.c | 6 +- include/migration/migration.h | 3 - include/sysemu/sysemu.h | 2 +- migration.c | 183 ++++++++++++++++++++---------------------- savevm.c | 12 +-- 5 files changed, 98 insertions(+), 108 deletions(-)
PATCH 1/14 Unlock ramlist lock also in error case
From: Paolo Bonzini <[email protected]>
--- arch_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch_init.c +2 -1
@@ -642,12 +642,13 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) i++; } +qemu_mutex_unlock_ramlist (); +if (ret <0 ) { bytes_transferred += total_sent;return ret; } -qemu_mutex_unlock_ramlist ();qemu_put_be64 (f,RAM_SAVE_FLAG_EOS ); total_sent +=8 ; bytes_transferred += total_sent;
Signature · 1 line
1.8.1
PATCH 2/14 Protect migration_bitmap_sync() with the ramlist lock
In reply to Juan QuintelaFrom: Paolo Bonzini <[email protected]>
--- arch_init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch_init.c +1 -2
@@ -658,9 +658,8 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)static int ram_save_complete (QEMUFile *f,void *opaque) { -migration_bitmap_sync (); -qemu_mutex_lock_ramlist (); +migration_bitmap_sync ();/* try transferring iterative blocks of memory */
Signature · 1 line
1.8.1
PATCH 3/14 use XFER_LIMIT_RATIO consistently
In reply to Juan QuintelaFrom: Paolo Bonzini <[email protected]>
Previous patch missed this case
--- migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration.c +1 -1
@@ -650,7 +650,7 @@ static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate) new_rate =SIZE_MAX ; } - s->xfer_limit = new_rate /10 ; + s->xfer_limit = new_rate /XFER_LIMIT_RATIO ; out:return s->xfer_limit;
Signature · 1 line
1.8.1
Re: [Qemu-devel] [PATCH 03/14] use XFER_LIMIT_RATIO consistently
Quoted 3 lines · Juan Quintela
From: Paolo Bonzini <[email protected]>
Previous patch missed this case
Might be worth mentioning _which_ previous patch, now that there is quite a gap in the git history.
Quoted 21 lines
Signed-off-by Paolo Bonzini <[email protected]>Signed-off-by Juan Quintela <[email protected]>--- migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration.c +1
-1@@ -650,7 +650,7 @@ static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate) new_rate =SIZE_MAX ; } - s->xfer_limit = new_rate /10 ; + s->xfer_limit = new_rate /XFER_LIMIT_RATIO ; out:return s->xfer_limit;
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
PATCH 4/14 migration: make function static
In reply to Juan QuintelaFrom: Paolo Bonzini <[email protected]>
--- include/migration/migration.h | 2 -- migration.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)
include/migration/migration.h +0 -2
@@ -87,8 +87,6 @@ void migrate_fd_error(MigrationState *s);void migrate_fd_connect (MigrationState *s); -ssize_t migrate_fd_put_buffer (MigrationState *s,const void *data, -size_t size);int migrate_fd_close (MigrationState *s);void add_migration_state_change_notifier (Notifier *notify);
migration.c +2 -2
@@ -302,8 +302,8 @@ static void migrate_fd_completed(MigrationState *s)notifier_list_notify (&migration_state_notifiers, s); } -ssize_t migrate_fd_put_buffer (MigrationState *s,const void *data, -size_t size) +static ssize_t migrate_fd_put_buffer (MigrationState *s,const void *data, +size_t size) {ssize_t ret;
Signature · 1 line
1.8.1
PATCH 5/14 migration: remove double call to migrate_fd_close
In reply to Juan QuintelaFrom: Paolo Bonzini <[email protected]>
The call in buffered_close is enough, because buffered_close is called already by migrate_fd_cleanup.
--- migration.c | 1 - 1 file changed, 1 deletion(-)
migration.c +0 -1
@@ -605,7 +605,6 @@ static int buffered_close(void *opaque)if (ret >=0 ) { ret = ret2; } - ret =migrate_fd_close (s); s->complete = true;return ret; }
Signature · 1 line
1.8.1
PATCH 6/14 migration: fix off-by-one in buffered_rate_limit
In reply to Juan QuintelaFrom: Paolo Bonzini <[email protected]>
--- migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration.c +1 -1
@@ -632,7 +632,7 @@ static int buffered_rate_limit(void *opaque)return ret; } -if (s->bytes_xfer > s->xfer_limit) { +if (s->bytes_xfer >= s->xfer_limit) {return 1 ; }
Signature · 1 line
1.8.1
PATCH 7/14 qemu-file: Only set last_error if it is not already set
In reply to Juan Quintela--- savevm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
savevm.c +3 -1
@@ -419,7 +419,9 @@ int qemu_file_get_error(QEMUFile *f)static void qemu_file_set_error (QEMUFile *f,int ret) { - f->last_error = ret; +if (f->last_error ==0 ) { + f->last_error = ret; + } }/** Flushes QEMUFile buffer
Signature · 1 line
1.8.1
PATCH 8/14 migration: move begining stage to the migration thread
In reply to Juan Quintela--- include/migration/migration.h | 1 - migration.c | 28 +++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-)
include/migration/migration.h +0 -1
@@ -54,7 +54,6 @@ struct MigrationStatebool enabled_capabilities[MIGRATION_CAPABILITY_MAX ];int64_t xbzrle_cache_size;bool complete; -bool first_time; };void process_incoming_migration (QEMUFile *f);
migration.c +15 -13
@@ -674,17 +674,6 @@ static bool migrate_fd_put_ready(MigrationState *s, uint64_t max_size)qemu_mutex_unlock_iothread ();return false; } -if (s->first_time) { - s->first_time = false; -DPRINTF ("beginning savevm\n" ); - ret =qemu_savevm_state_begin (s->file, &s->params); -if (ret <0 ) { -DPRINTF ("failed, %d\n" , ret); -migrate_fd_error (s); -qemu_mutex_unlock_iothread (); -return false; - } - }DPRINTF ("iterate\n" ); pending_size =qemu_savevm_state_pending (s->file, max_size);
@@ -733,6 +722,17 @@ static void *buffered_file_thread(void *opaque)int64_t initial_time =qemu_get_clock_ms (rt_clock);int64_t max_size =0 ;bool last_round = false; +int ret; + +qemu_mutex_lock_iothread (); +DPRINTF ("beginning savevm\n" ); + ret =qemu_savevm_state_begin (s->file, &s->params); +if (ret <0 ) { +DPRINTF ("failed, %d\n" , ret); +qemu_mutex_unlock_iothread (); + goto out; + } +qemu_mutex_unlock_iothread ();while (true) {int64_t current_time =qemu_get_clock_ms (rt_clock);
@@ -768,6 +768,10 @@ static void *buffered_file_thread(void *opaque) } } +out: +if (ret <0 ) { +migrate_fd_error (s); + }g_free (s->buffer);return NULL ; }
@@ -789,8 +793,6 @@ void migrate_fd_connect(MigrationState *s) s->buffer_size =0 ; s->buffer_capacity =0 ; - s->first_time = true; - s->xfer_limit = s->bandwidth_limit /XFER_LIMIT_RATIO ; s->complete = false;
Signature · 1 line
1.8.1
Re: [Qemu-devel] [PATCH 08/14] migration: move begining stage to the migration thread
On 01/15/2013 04:18 AM, Juan Quintela wrote:
In the subject line: s/begining/beginning/
Quoted 6 lines
Signed-off-by Juan Quintela <[email protected]>--- include/migration/migration.h | 1 - migration.c | 28 +++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
PATCH 9/14 migration: Add buffered_flush error handling
In reply to Juan QuintelaNow that we have error handling we can do proper handling of buffered_flush().
--- migration.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
migration.c +2 -1
@@ -757,7 +757,8 @@ static void *buffered_file_thread(void *opaque)/* usleep expects microseconds */ g_usleep ((initial_time +BUFFER_DELAY - current_time)*1000 ); } -if (buffered_flush (s) <0 ) { + ret =buffered_flush (s); +if (ret <0 ) {break ; }
Signature · 1 line
1.8.1
PATCH 10/14 migration: move exit condition to migration thread
In reply to Juan Quintela--- migration.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
migration.c +8 -6
@@ -669,12 +669,6 @@ static bool migrate_fd_put_ready(MigrationState *s, uint64_t max_size)bool last_round = false;qemu_mutex_lock_iothread (); -if (s->state !=MIG_STATE_ACTIVE ) { -DPRINTF ("put_ready returning because of non-active state\n" ); -qemu_mutex_unlock_iothread (); -return false; - } -DPRINTF ("iterate\n" ); pending_size =qemu_savevm_state_pending (s->file, max_size);DPRINTF ("pending size %lu max %lu\n" , pending_size, max_size);
@@ -737,9 +731,17 @@ static void *buffered_file_thread(void *opaque)while (true) {int64_t current_time =qemu_get_clock_ms (rt_clock); +qemu_mutex_lock_iothread (); +if (s->state !=MIG_STATE_ACTIVE ) { +DPRINTF ("put_ready returning because of non-active state\n" ); +qemu_mutex_unlock_iothread (); +break ; + }if (s->complete) { +qemu_mutex_unlock_iothread ();break ; } +qemu_mutex_unlock_iothread ();if (current_time >= initial_time +BUFFER_DELAY ) {uint64_t transferred_bytes = s->bytes_xfer;uint64_t time_spent = current_time - initial_time;
Signature · 1 line
1.8.1
PATCH 11/14 migration: unfold rest of migrate_fd_put_ready() into thread
In reply to Juan QuintelaThis will allow us finer control in next patches.
--- migration.c | 95 ++++++++++++++++++++++++++----------------------------------- 1 file changed, 41 insertions(+), 54 deletions(-)
migration.c +41 -54
@@ -662,54 +662,6 @@ static int64_t buffered_get_rate_limit(void *opaque)return s->xfer_limit; } -static bool migrate_fd_put_ready (MigrationState *s,uint64_t max_size) -{ -int ret; -uint64_t pending_size; -bool last_round = false; - -qemu_mutex_lock_iothread (); -DPRINTF ("iterate\n" ); - pending_size =qemu_savevm_state_pending (s->file, max_size); -DPRINTF ("pending size %lu max %lu\n" , pending_size, max_size); -if (pending_size >= max_size) { - ret =qemu_savevm_state_iterate (s->file); -if (ret <0 ) { -migrate_fd_error (s); - } - }else { -int old_vm_running =runstate_is_running (); -int64_t start_time, end_time; - -DPRINTF ("done iterating\n" ); - start_time =qemu_get_clock_ms (rt_clock); -qemu_system_wakeup_request (QEMU_WAKEUP_REASON_OTHER ); -if (old_vm_running) { -vm_stop (RUN_STATE_FINISH_MIGRATE ); - }else { -vm_stop_force_state (RUN_STATE_FINISH_MIGRATE ); - } - -if (qemu_savevm_state_complete (s->file) <0 ) { -migrate_fd_error (s); - }else { -migrate_fd_completed (s); - } - end_time =qemu_get_clock_ms (rt_clock); - s->total_time = end_time - s->total_time; - s->downtime = end_time - start_time; -if (s->state !=MIG_STATE_COMPLETED ) { -if (old_vm_running) { -vm_start (); - } - } - last_round = true; - } -qemu_mutex_unlock_iothread (); - -return last_round; -} -static void *buffered_file_thread (void *opaque) {MigrationState *s = opaque;
@@ -730,6 +682,7 @@ static void *buffered_file_thread(void *opaque)while (true) {int64_t current_time =qemu_get_clock_ms (rt_clock); +uint64_t pending_size;qemu_mutex_lock_iothread ();if (s->state !=MIG_STATE_ACTIVE ) {
@@ -741,6 +694,46 @@ static void *buffered_file_thread(void *opaque)qemu_mutex_unlock_iothread ();break ; } +if (s->bytes_xfer < s->xfer_limit) { +DPRINTF ("iterate\n" ); + pending_size =qemu_savevm_state_pending (s->file, max_size); +DPRINTF ("pending size %lu max %lu\n" , pending_size, max_size); +if (pending_size >= max_size) { + ret =qemu_savevm_state_iterate (s->file); +if (ret <0 ) { +qemu_mutex_unlock_iothread (); +break ; + } + }else { +int old_vm_running =runstate_is_running (); +int64_t start_time, end_time; + +DPRINTF ("done iterating\n" ); + start_time =qemu_get_clock_ms (rt_clock); +qemu_system_wakeup_request (QEMU_WAKEUP_REASON_OTHER ); +if (old_vm_running) { +vm_stop (RUN_STATE_FINISH_MIGRATE ); + }else { +vm_stop_force_state (RUN_STATE_FINISH_MIGRATE ); + } + ret =qemu_savevm_state_complete (s->file); +if (ret <0 ) { +qemu_mutex_unlock_iothread (); +break ; + }else { +migrate_fd_completed (s); + } + end_time =qemu_get_clock_ms (rt_clock); + s->total_time = end_time - s->total_time; + s->downtime = end_time - start_time; +if (s->state !=MIG_STATE_COMPLETED ) { +if (old_vm_running) { +vm_start (); + } + } + last_round = true; + } + }qemu_mutex_unlock_iothread ();if (current_time >= initial_time +BUFFER_DELAY ) {uint64_t transferred_bytes = s->bytes_xfer;
@@ -763,12 +756,6 @@ static void *buffered_file_thread(void *opaque)if (ret <0 ) {break ; } - -DPRINTF ("file is ready\n" ); -if (s->bytes_xfer < s->xfer_limit) { -DPRINTF ("notifying client\n" ); - last_round =migrate_fd_put_ready (s, max_size); - } } out:
Signature · 1 line
1.8.1
PATCH 12/14 migration: Only go to the iterate stage if there is anything to send
In reply to Juan Quintela--- migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration.c +1 -1
@@ -698,7 +698,7 @@ static void *buffered_file_thread(void *opaque)DPRINTF ("iterate\n" ); pending_size =qemu_savevm_state_pending (s->file, max_size);DPRINTF ("pending size %lu max %lu\n" , pending_size, max_size); -if (pending_size >= max_size) { +if (pending_size && pending_size >= max_size) { ret =qemu_savevm_state_iterate (s->file);if (ret <0 ) {qemu_mutex_unlock_iothread ();
Signature · 1 line
1.8.1
PATCH 13/14 migration: remove argument to qemu_savevm_state_cancel
In reply to Juan Quintela--- include/sysemu/sysemu.h | 2 +- migration.c | 2 +- savevm.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-)
include/sysemu/sysemu.h +1 -1
@@ -77,7 +77,7 @@ int qemu_savevm_state_begin(QEMUFile *f, const MigrationParams *params);int qemu_savevm_state_iterate (QEMUFile *f);int qemu_savevm_state_complete (QEMUFile *f); -void qemu_savevm_state_cancel (QEMUFile *f); +void qemu_savevm_state_cancel (void );uint64_t qemu_savevm_state_pending (QEMUFile *f,uint64_t max_size);int qemu_loadvm_state (QEMUFile *f);
migration.c +1 -1
@@ -330,7 +330,7 @@ static void migrate_fd_cancel(MigrationState *s) s->state =MIG_STATE_CANCELLED ;notifier_list_notify (&migration_state_notifiers, s); -qemu_savevm_state_cancel (s->file); +qemu_savevm_state_cancel ();migrate_fd_cleanup (s); }
savevm.c +4 -4
@@ -1590,13 +1590,13 @@ int qemu_savevm_state_begin(QEMUFile *f, ret = se->ops->save_live_setup (f, se->opaque);if (ret <0 ) { -qemu_savevm_state_cancel (f); +qemu_savevm_state_cancel ();return ret; } } ret =qemu_file_get_error (f);if (ret !=0 ) { -qemu_savevm_state_cancel (f); +qemu_savevm_state_cancel (); }return ret;
@@ -1647,7 +1647,7 @@ int qemu_savevm_state_iterate(QEMUFile *f) } ret =qemu_file_get_error (f);if (ret !=0 ) { -qemu_savevm_state_cancel (f); +qemu_savevm_state_cancel (); }return ret; }
@@ -1727,7 +1727,7 @@ uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size)return ret; } -void qemu_savevm_state_cancel (QEMUFile *f) +void qemu_savevm_state_cancel (void ) {SaveStateEntry *se;
Signature · 1 line
1.8.1
PATCH 14/14 Rename buffered_ to migration_
In reply to Juan QuintelaThis is consistent once that we have moved everything to migration.c
--- migration.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
migration.c +19 -19
@@ -522,7 +522,7 @@ int64_t migrate_xbzrle_cache_size(void)/* migration thread support */ -static ssize_t buffered_flush (MigrationState *s) +static ssize_t migration_flush (MigrationState *s) {size_t offset =0 ;ssize_t ret =0 ;
@@ -552,7 +552,7 @@ static ssize_t buffered_flush(MigrationState *s)return offset; } -static int buffered_put_buffer (void *opaque,const uint8_t *buf, +static int migration_put_buffer (void *opaque,const uint8_t *buf,int64_t pos,int size) {MigrationState *s = opaque;
@@ -585,7 +585,7 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf,return size; } -static int buffered_close (void *opaque) +static int migration_close (void *opaque) {MigrationState *s = opaque;ssize_t ret =0 ;
@@ -595,7 +595,7 @@ static int buffered_close(void *opaque) s->xfer_limit =INT_MAX ;while (!qemu_file_get_error (s->file) && s->buffer_size) { - ret =buffered_flush (s); + ret =migration_flush (s);if (ret <0 ) {break ; }
@@ -609,7 +609,7 @@ static int buffered_close(void *opaque)return ret; } -static int buffered_get_fd (void *opaque) +static int migration_get_fd (void *opaque) {MigrationState *s = opaque;
@@ -622,7 +622,7 @@ static int buffered_get_fd(void *opaque)* 1: Time to stop * negative: There has been an error */ -static int buffered_rate_limit (void *opaque) +static int migration_rate_limit (void *opaque) {MigrationState *s = opaque;int ret;
@@ -639,7 +639,7 @@ static int buffered_rate_limit(void *opaque)return 0 ; } -static int64_t buffered_set_rate_limit (void *opaque,int64_t new_rate) +static int64_t migration_set_rate_limit (void *opaque,int64_t new_rate) {MigrationState *s = opaque;if (qemu_file_get_error (s->file)) {
@@ -655,14 +655,14 @@ out:return s->xfer_limit; } -static int64_t buffered_get_rate_limit (void *opaque) +static int64_t migration_get_rate_limit (void *opaque) {MigrationState *s = opaque;return s->xfer_limit; } -static void *buffered_file_thread (void *opaque) +static void *migration_file_thread (void *opaque) {MigrationState *s = opaque;int64_t initial_time =qemu_get_clock_ms (rt_clock);
@@ -752,7 +752,7 @@ static void *buffered_file_thread(void *opaque)/* usleep expects microseconds */ g_usleep ((initial_time +BUFFER_DELAY - current_time)*1000 ); } - ret =buffered_flush (s); + ret =migration_flush (s);if (ret <0 ) {break ; }
@@ -766,13 +766,13 @@ out:return NULL ; } -static const QEMUFileOps buffered_file_ops = { - .get_fd = buffered_get_fd, - .put_buffer = buffered_put_buffer, - .close = buffered_close, - .rate_limit = buffered_rate_limit, - .get_rate_limit = buffered_get_rate_limit, - .set_rate_limit = buffered_set_rate_limit, +static const QEMUFileOps migration_file_ops = { + .get_fd = migration_get_fd, + .put_buffer = migration_put_buffer, + .close = migration_close, + .rate_limit = migration_rate_limit, + .get_rate_limit = migration_get_rate_limit, + .set_rate_limit = migration_set_rate_limit, };void migrate_fd_connect (MigrationState *s)
@@ -786,9 +786,9 @@ void migrate_fd_connect(MigrationState *s) s->xfer_limit = s->bandwidth_limit /XFER_LIMIT_RATIO ; s->complete = false; - s->file =qemu_fopen_ops (s, &buffered_file_ops); + s->file =qemu_fopen_ops (s, &migration_file_ops); -qemu_thread_create (&s->thread, buffered_file_thread, s, +qemu_thread_create (&s->thread, migration_file_thread, s,QEMU_THREAD_DETACHED );notifier_list_notify (&migration_state_notifiers, s); }
Signature · 1 line
1.8.1
Re: [Qemu-devel] [PATCH 14/14] Rename buffered_ to migration_
Il 15/01/2013 12:18, Juan Quintela ha scritto:
Quoted 1 line
This is consistent once that we have moved everything to
migration.c
Please drop this patch, I have the same changes later in my queue and it causes a lot of conflicts if you put it here. It's true that the code is migration.c, but it is still about buffering so I think the renaming is premature.
Otherwise the series looks good, thanks!
Paolo
Quoted 132 lines
Signed-off-by Juan Quintela <[email protected]>--- migration.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)migration.c +19
-19@@ -522,7 +522,7 @@ int64_t migrate_xbzrle_cache_size(void)/* migration thread support */ -static ssize_t buffered_flush (MigrationState *s) +static ssize_t migration_flush (MigrationState *s) {size_t offset =0 ;ssize_t ret =0 ;@@ -552,7 +552,7 @@ static ssize_t buffered_flush(MigrationState *s)return offset; } -static int buffered_put_buffer (void *opaque,const uint8_t *buf, +static int migration_put_buffer (void *opaque,const uint8_t *buf,int64_t pos,int size) {MigrationState *s = opaque;@@ -585,7 +585,7 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf,return size; } -static int buffered_close (void *opaque) +static int migration_close (void *opaque) {MigrationState *s = opaque;ssize_t ret =0 ;@@ -595,7 +595,7 @@ static int buffered_close(void *opaque) s->xfer_limit =INT_MAX ;while (!qemu_file_get_error (s->file) && s->buffer_size) { - ret =buffered_flush (s); + ret =migration_flush (s);if (ret <0 ) {break ; }@@ -609,7 +609,7 @@ static int buffered_close(void *opaque)return ret; } -static int buffered_get_fd (void *opaque) +static int migration_get_fd (void *opaque) {MigrationState *s = opaque;@@ -622,7 +622,7 @@ static int buffered_get_fd(void *opaque)* 1: Time to stop * negative: There has been an error */ -static int buffered_rate_limit (void *opaque) +static int migration_rate_limit (void *opaque) {MigrationState *s = opaque;int ret;@@ -639,7 +639,7 @@ static int buffered_rate_limit(void *opaque)return 0 ; } -static int64_t buffered_set_rate_limit (void *opaque,int64_t new_rate) +static int64_t migration_set_rate_limit (void *opaque,int64_t new_rate) {MigrationState *s = opaque;if (qemu_file_get_error (s->file)) {@@ -655,14 +655,14 @@ out:return s->xfer_limit; } -static int64_t buffered_get_rate_limit (void *opaque) +static int64_t migration_get_rate_limit (void *opaque) {MigrationState *s = opaque;return s->xfer_limit; } -static void *buffered_file_thread (void *opaque) +static void *migration_file_thread (void *opaque) {MigrationState *s = opaque;int64_t initial_time =qemu_get_clock_ms (rt_clock);@@ -752,7 +752,7 @@ static void *buffered_file_thread(void *opaque)/* usleep expects microseconds */ g_usleep ((initial_time +BUFFER_DELAY - current_time)*1000 ); } - ret =buffered_flush (s); + ret =migration_flush (s);if (ret <0 ) {break ; }@@ -766,13 +766,13 @@ out:return NULL ; } -static const QEMUFileOps buffered_file_ops = { - .get_fd = buffered_get_fd, - .put_buffer = buffered_put_buffer, - .close = buffered_close, - .rate_limit = buffered_rate_limit, - .get_rate_limit = buffered_get_rate_limit, - .set_rate_limit = buffered_set_rate_limit, +static const QEMUFileOps migration_file_ops = { + .get_fd = migration_get_fd, + .put_buffer = migration_put_buffer, + .close = migration_close, + .rate_limit = migration_rate_limit, + .get_rate_limit = migration_get_rate_limit, + .set_rate_limit = migration_set_rate_limit, };void migrate_fd_connect (MigrationState *s)@@ -786,9 +786,9 @@ void migrate_fd_connect(MigrationState *s) s->xfer_limit = s->bandwidth_limit /XFER_LIMIT_RATIO ; s->complete = false; - s->file =qemu_fopen_ops (s, &buffered_file_ops); + s->file =qemu_fopen_ops (s, &migration_file_ops); -qemu_thread_create (&s->thread, buffered_file_thread, s, +qemu_thread_create (&s->thread, migration_file_thread, s,QEMU_THREAD_DETACHED );notifier_list_notify (&migration_state_notifiers, s); }
Quoted 7 lines · Juan Quintela
Hi
This is the intersect of the paolo & me patches for migration thread, please consided for inclusion.
Quoted 6 lines
arch_init.c | 6 +- include/migration/migration.h | 3 - include/sysemu/sysemu.h | 2 +- migration.c | 183 ++++++++++++++++++++---------------------- savevm.c | 12 +-- 5 files changed, 98 insertions(+), 108 deletions(-)
I found some commit message improvements in 3 and 8, but as that does not affect the code...
Series: Reviewed-by: Eric Blake <[email protected]>
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 9 lines · Juan Quintela
Hi
This is the intersect of the paolo & me patches for migration thread, please consided for inclusion.
The following changes since commit
cf7c3f0cb5a7129f57fa9e69d410d6a05031988c:virtio-9p: fix compilation error. (2013-01-14 18:52:39 -0600)
Quoted 7 lines
are available in the git repository at:
git://repo.or.cz/qemu/quintela.gitthread.nextfor you to fetch changes up to
869342e49d89763f7590ebc52eaecd9ce9f7baa1:Rename
buffered_tomigration_(2013-01-15 12:14:40 +0100)
If this a PULL request, you should put 'PULL' in the subject.
Regards,
Anthony Liguori
Quoted 26 lines
----------------------------------------------------------------
Juan Quintela (8):
qemu-file: Only setlast_errorif it is not already set
migration: move begining stage to the migration thread
migration: Addbuffered_flusherror handling
migration: move exit condition to migration thread
migration: unfold rest ofmigrate_fd_put_ready()into thread
migration: Only go to the iterate stage if there is anything to send
migration: remove argument toqemu_savevm_state_cancelRenamebuffered_tomigration_Paolo Bonzini (6):
Unlock ramlist lock also in error case Protectmigration_bitmap_sync()with the ramlist lock useXFER_LIMIT_RATIOconsistently
migration: make function static
migration: remove double call tomigrate_fd_close
migration: fix off-by-one inbuffered_rate_limitarch_init.c | 6 +- include/migration/migration.h | 3 - include/sysemu/sysemu.h | 2 +- migration.c | 183 ++++++++++++++++++++---------------------- savevm.c | 12 +-- 5 files changed, 98 insertions(+), 108 deletions(-)
Il 16/01/2013 19:14, Anthony Liguori ha scritto:
Quoted 13 lines
Quoted 11 lines · Juan Quintela
Hi
This is the intersect of the paolo & me patches for migration thread, please consided for inclusion.
The following changes since commit
cf7c3f0cb5a7129f57fa9e69d410d6a05031988c:virtio-9p: fix compilation error. (2013-01-14 18:52:39 -0600)
are available in the git repository at:
Quoted 7 lines
Quoted 5 lines
git://repo.or.cz/qemu/quintela.gitthread.nextfor you to fetch changes up to
869342e49d89763f7590ebc52eaecd9ce9f7baa1:Rename
buffered_tomigration_(2013-01-15 12:14:40 +0100)If this a PULL request, you should put 'PULL' in the subject.
It shouldn't be, because the patches have never been posted before. That said, I'm okay with pulling all patches except the last one.
Paolo
Quoted 16 lines · Paolo Bonzini
Il 16/01/2013 19:14, Anthony Liguori ha scritto:
Quoted 15 lines
Quoted 13 lines · Juan Quintela
Hi
This is the intersect of the paolo & me patches for migration thread, please consided for inclusion.
The following changes since commit
cf7c3f0cb5a7129f57fa9e69d410d6a05031988c:virtio-9p: fix compilation error. (2013-01-14 18:52:39 -0600)
are available in the git repository at:
git://repo.or.cz/qemu/quintela.gitthread.next
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
for you to fetch changes up to
869342e49d89763f7590ebc52eaecd9ce9f7baa1:Rename
buffered_tomigration_(2013-01-15 12:14:40 +0100)If this a PULL request, you should put 'PULL' in the subject.
It shouldn't be, because the patches have never been posted before. That said, I'm okay with pulling all patches except the last one.
I will add that as reviewed by? O:-)
Sending all less the last one with proper PULL request.
Later, Juan.
Il 17/01/2013 13:46, Juan Quintela ha scritto:
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
It shouldn't be, because the patches have never been posted before. That said, I'm okay with pulling all patches except the last one.
I will add that as reviewed by? O:-)
Yes.
Paolo