migration: fix exec/fd migrations
PATCH 1/1 migration: fix exec/fd migrations
Commit:
commit 36c2f8be2c4eb0003ac77a14910842b7ddd7337e
Author: Juan Quintela <[email protected]> Date: Wed Mar 7 08:40:52 2018 +0100
migration: Delay start of migration main routines
Missed tcp and fd transports. This fix its.
--- migration/exec.c | 4 ++++ migration/fd.c | 4 ++++ 2 files changed, 8 insertions(+)
migration/exec.c +4 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "channel.h" #include "exec.h" +#include "migration.h" #include "io/channel-command.h" #include "trace.h"
@@ -48,6 +49,9 @@ static gboolean exec_accept_incoming_migration(QIOChannel *ioc, {migration_channel_process_incoming (ioc);object_unref (OBJECT (ioc)); +if (!migrate_use_multifd ()) { +migration_incoming_process (); + }return G_SOURCE_REMOVE ; }
migration/fd.c +4 -0
@@ -17,6 +17,7 @@#include "qemu/osdep.h" #include "channel.h" #include "fd.h" +#include "migration.h" #include "monitor/monitor.h" #include "io/channel-util.h" #include "trace.h"
@@ -48,6 +49,9 @@ static gboolean fd_accept_incoming_migration(QIOChannel *ioc, {migration_channel_process_incoming (ioc);object_unref (OBJECT (ioc)); +if (!migrate_use_multifd ()) { +migration_incoming_process (); + }return G_SOURCE_REMOVE ; }
Signature · 1 line
2.17.0
Am 23.05.2018 um 11:14 hat Juan Quintela geschrieben:
Quoted 6 lines
Commit:
commit
36c2f8be2c4eb0003ac77a14910842b7ddd7337eAuthor: Juan Quintela <[email protected]> Date: Wed Mar 7 08:40:52 2018 +0100
Quoted 6 lines
migration: Delay start of migration main routines
Missed tcp and fd transports. This fix its.
Reported-by Kevin Wolf <[email protected]>Signed-off-by Juan Quintela <[email protected]>
In my first test run, qemu-iotests 169 still timed out with a message that qemu recevied signal 6, but I haven't been able to reproduce it since. Quite possible that that's an old, unrelated problem. Other than that, the tests are passing again. I suppose this is enough for:
Quoted 52 lines · Juan Quintela
Commit:
commit
36c2f8be2c4eb0003ac77a14910842b7ddd7337eAuthor: Juan Quintela <[email protected]> Date: Wed Mar 7 08:40:52 2018 +0100migration: Delay start of migration main routines
Missed tcp and fd transports. This fix its.
Reported-by Kevin Wolf <[email protected]>Signed-off-by Juan Quintela <[email protected]>--- migration/exec.c | 4 ++++ migration/fd.c | 4 ++++ 2 files changed, 8 insertions(+)migration/exec.c +4
-0@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "channel.h" #include "exec.h" +#include "migration.h" #include "io/channel-command.h" #include "trace.h" @@ -48,6 +49,9 @@ static gboolean exec_accept_incoming_migration(QIOChannel *ioc, {migration_channel_process_incoming (ioc);object_unref (OBJECT (ioc)); +if (!migrate_use_multifd ()) { +migration_incoming_process (); + }return G_SOURCE_REMOVE ; }migration/fd.c +1
-0@@ -17,6 +17,7 @@#include "qemu/osdep.h" #include "channel.h" #include "fd.h" +#include "migration.h" #include "monitor/monitor.h" #include "io/channel-util.h" #include "trace.h"
migration/fd.c static gboolean fd_accept_incoming_migration(QIOChannel *ioc, · line 56
Quoted 8 lines
migration/fd.c +3
-0@@ -48,6 +49,9 @@ static gboolean fd_accept_incoming_migration(QIOChannel *ioc, {migration_channel_process_incoming (ioc);object_unref (OBJECT (ioc)); +if (!migrate_use_multifd ()) { +migration_incoming_process (); + }return G_SOURCE_REMOVE ; }
We are calling migration_incoming_process() everywhere... But actually we have a single entrance at migration_ioc_process_incoming(). How about we still use a single entrance for migration instead (and actually I just noticed that postcopy recovery should be broken now on master since now we don't call migration_fd_process_incoming at all...). I mean something like this (even not tested with compile, just to show what I mean):
migration/migration.c +13 -3
@@ -468,7 +468,6 @@ void migration_fd_process_incoming(QEMUFile *f)qemu_sem_post (&mis->postcopy_pause_sem_dst); }else {/* New incoming migration */ -migration_incoming_setup (f);migration_incoming_process (); } }
@@ -476,13 +475,24 @@ void migration_fd_process_incoming(QEMUFile *f)void migration_ioc_process_incoming (QIOChannel *ioc) {MigrationIncomingState *mis =migration_incoming_get_current (); +bool start_migration = true;if (!mis->from_src_file) {QEMUFile *f =qemu_fopen_channel_input (ioc);migration_incoming_setup (f); -return ; +if (migrate_use_multifd ()) { +/* We need to wait until all channels settled */ +return ; + } + } + +if (migrate_use_multifd ()) { + start_migration =multifd_recv_new_channel (ioc); + } + +if (start_migration) { +migration_fd_process_incoming (mis->from_src_file); } -multifd_recv_new_channel (ioc); }/**
migration/ram.c +4 -4
@@ -866,7 +866,8 @@ bool multifd_recv_all_channels_created(void)return thread_count ==atomic_read (&multifd_recv_state->count); } -void multifd_recv_new_channel (QIOChannel *ioc) +/* Return true if we have all the channels ready; otherwise false */ +bool multifd_recv_new_channel (QIOChannel *ioc) {MultiFDRecvParams *p;Error *local_err =NULL ;
@@ -892,9 +893,8 @@ void multifd_recv_new_channel(QIOChannel *ioc)qemu_thread_create (&p->thread, p->name, multifd_recv_thread, p,QEMU_THREAD_JOINABLE );atomic_inc (&multifd_recv_state->count); -if (multifd_recv_state->count ==migrate_multifd_channels ()) { -migration_incoming_process (); - } + +return multifd_recv_state->count ==migrate_multifd_channels (); }/**
migration/rdma.c +1 -0
@@ -3696,6 +3696,7 @@ static void rdma_accept_incoming_migration(void *opaque) } rdma->migration_started_on_destination =1 ; +migration_incoming_setup (f);migration_fd_process_incoming (f); }
migration/socket.c +0 -4
@@ -170,10 +170,6 @@ static void socket_accept_incoming_migration(QIONetListener *listener,qio_net_listener_disconnect (listener);object_unref (OBJECT (listener)); - -if (!migrate_use_multifd ()) { -migration_incoming_process (); - } } }
This patch will make sure we call migration_incoming_process() only once, logically speaking it should also fix the breakage of postcopy recovery.
What do you think?
CC Dan too.
Thanks,
Signature · 1 line
Peter Xu
Quoted 6 lines · Juan Quintela
Commit:
commit
36c2f8be2c4eb0003ac77a14910842b7ddd7337eAuthor: Juan Quintela <[email protected]> Date: Wed Mar 7 08:40:52 2018 +0100
Quoted 6 lines
migration: Delay start of migration main routines
Missed tcp and fd transports. This fix its.
Reported-by Kevin Wolf <[email protected]>Signed-off-by Juan Quintela <[email protected]>
Fixes things for me, but I see that Peter Xu has more concerns.
Would be happy with checking this in for now and following up with better refactors so that iotests works again in the meantime.
Quoted 14 lines · John Snow
Quoted 6 lines · Juan Quintela
Commit:
commit
36c2f8be2c4eb0003ac77a14910842b7ddd7337eAuthor: Juan Quintela <[email protected]> Date: Wed Mar 7 08:40:52 2018 +0100Quoted 6 lines
migration: Delay start of migration main routines
Missed tcp and fd transports. This fix its.
Reported-by Kevin Wolf <[email protected]>Signed-off-by Juan Quintela <[email protected]>
Quoted 6 lines
Fixes things for me, but I see that Peter Xu has more concerns.
Would be happy with checking this in for now and following up with better refactors so that iotests works again in the meantime.
Tested-by John Snow <[email protected]>
That is my plan. Will send a pull request Tomorrow, and we can go from there. Peter suggestion is good but requires developtemt and testing.
Thanks, Juan.