qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fei Li <fli@suse.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com, dgilbert@redhat.com, famz@redhat.com,
	peterx@redhat.com, quintela@redhat.com
Subject: [Qemu-devel] [PATCH RFC v7 6/9] migration: fix the multifd code when receiving less channels
Date: Thu,  1 Nov 2018 18:17:12 +0800	[thread overview]
Message-ID: <20181101101715.9443-7-fli@suse.com> (raw)
In-Reply-To: <20181101101715.9443-1-fli@suse.com>

In our current code, when multifd is used during migration, if there
is an error before the destination receives all new channels, the
source keeps running, however the destination does not exit but keeps
waiting until the source is killed deliberately.

Fix this by dumping the specific error and let users decide whether
to quit from the destination side when failing to receive packet via
some channel.

Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Signed-off-by: Fei Li <fli@suse.com>
---
 migration/channel.c   | 11 ++++++-----
 migration/migration.c |  9 +++++++--
 migration/migration.h |  2 +-
 migration/ram.c       |  6 +++++-
 migration/ram.h       |  2 +-
 5 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/migration/channel.c b/migration/channel.c
index 33e0e9b82f..20e4c8e2dc 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -30,6 +30,7 @@
 void migration_channel_process_incoming(QIOChannel *ioc)
 {
     MigrationState *s = migrate_get_current();
+    Error *local_err = NULL;
 
     trace_migration_set_incoming_channel(
         ioc, object_get_typename(OBJECT(ioc)));
@@ -38,13 +39,13 @@ void migration_channel_process_incoming(QIOChannel *ioc)
         *s->parameters.tls_creds &&
         !object_dynamic_cast(OBJECT(ioc),
                              TYPE_QIO_CHANNEL_TLS)) {
-        Error *local_err = NULL;
         migration_tls_channel_process_incoming(s, ioc, &local_err);
-        if (local_err) {
-            error_report_err(local_err);
-        }
     } else {
-        migration_ioc_process_incoming(ioc);
+        migration_ioc_process_incoming(ioc, &local_err);
+    }
+
+    if (local_err) {
+        error_report_err(local_err);
     }
 }
 
diff --git a/migration/migration.c b/migration/migration.c
index 8b36e7f184..87dfc7374f 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -541,7 +541,7 @@ void migration_fd_process_incoming(QEMUFile *f)
     migration_incoming_process();
 }
 
-void migration_ioc_process_incoming(QIOChannel *ioc)
+void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp)
 {
     MigrationIncomingState *mis = migration_incoming_get_current();
     bool start_migration;
@@ -563,9 +563,14 @@ void migration_ioc_process_incoming(QIOChannel *ioc)
          */
         start_migration = !migrate_use_multifd();
     } else {
+        Error *local_err = NULL;
         /* Multiple connections */
         assert(migrate_use_multifd());
-        start_migration = multifd_recv_new_channel(ioc);
+        start_migration = multifd_recv_new_channel(ioc, &local_err);
+        if (local_err) {
+            error_propagate(errp, local_err);
+            return;
+        }
     }
 
     if (start_migration) {
diff --git a/migration/migration.h b/migration/migration.h
index f7813f8261..7df4d426d0 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -229,7 +229,7 @@ struct MigrationState
 void migrate_set_state(int *state, int old_state, int new_state);
 
 void migration_fd_process_incoming(QEMUFile *f);
-void migration_ioc_process_incoming(QIOChannel *ioc);
+void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp);
 void migration_incoming_process(void);
 
 bool  migration_has_all_channels(void);
diff --git a/migration/ram.c b/migration/ram.c
index c84d164fc8..5008a9ab02 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1339,7 +1339,7 @@ bool multifd_recv_all_channels_created(void)
 }
 
 /* Return true if multifd is ready for the migration, otherwise false */
-bool multifd_recv_new_channel(QIOChannel *ioc)
+bool multifd_recv_new_channel(QIOChannel *ioc, Error **errp)
 {
     MultiFDRecvParams *p;
     Error *local_err = NULL;
@@ -1347,6 +1347,9 @@ bool multifd_recv_new_channel(QIOChannel *ioc)
 
     id = multifd_recv_initial_packet(ioc, &local_err);
     if (id < 0) {
+        error_propagate_prepend(errp, local_err,
+                        "failed to receive packet via multifd channel %x: ",
+                        multifd_recv_state->count);
         multifd_recv_terminate_threads(local_err, false);
         return false;
     }
@@ -1356,6 +1359,7 @@ bool multifd_recv_new_channel(QIOChannel *ioc)
         error_setg(&local_err, "multifd: received id '%d' already setup'",
                    id);
         multifd_recv_terminate_threads(local_err, true);
+        error_propagate(errp, local_err);
         return false;
     }
     p->c = ioc;
diff --git a/migration/ram.h b/migration/ram.h
index 83ff1bc11a..046d3074be 100644
--- a/migration/ram.h
+++ b/migration/ram.h
@@ -47,7 +47,7 @@ int multifd_save_cleanup(Error **errp);
 int multifd_load_setup(void);
 int multifd_load_cleanup(Error **errp);
 bool multifd_recv_all_channels_created(void);
-bool multifd_recv_new_channel(QIOChannel *ioc);
+bool multifd_recv_new_channel(QIOChannel *ioc, Error **errp);
 
 uint64_t ram_pagesize_summary(void);
 int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
-- 
2.13.7

  parent reply	other threads:[~2018-11-01 10:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 10:17 [Qemu-devel] [PATCH RFC v7 0/9] qemu_thread_create: propagate errors to callers to check Fei Li
2018-11-01 10:17 ` [Qemu-devel] [PATCH RFC v7 1/9] Fix segmentation fault when qemu_signal_init fails Fei Li
2018-11-05 13:32   ` Juan Quintela
2018-11-06  5:08     ` Fei Li
2018-11-01 10:17 ` [Qemu-devel] [PATCH RFC v7 2/9] qemu_init_vcpu: add a new Error parameter to propagate Fei Li
2018-11-05 13:34   ` Juan Quintela
2018-11-01 10:17 ` [Qemu-devel] [PATCH RFC v7 3/9] qemu_thread_join: fix segmentation fault Fei Li
2018-11-01 10:17 ` [Qemu-devel] [PATCH RFC v7 4/9] migration: fix some segmentation faults when using multifd Fei Li
2018-11-02  2:31   ` Peter Xu
2018-11-02  6:03     ` Fei Li
2018-11-01 10:17 ` [Qemu-devel] [PATCH RFC v7 5/9] migration: fix the multifd code when sending less channels Fei Li
2018-11-02  2:37   ` Peter Xu
2018-11-02  3:00     ` Fei Li
2018-11-02  3:32       ` Peter Xu
2018-11-02  7:13         ` Fei Li
2018-11-02  7:32           ` Peter Xu
2018-11-02 16:33         ` Dr. David Alan Gilbert
2018-11-12  4:43           ` Fei Li
2018-12-04  7:32             ` Fei Li
2018-11-01 10:17 ` Fei Li [this message]
2018-11-02  2:46   ` [Qemu-devel] [PATCH RFC v7 6/9] migration: fix the multifd code when receiving " Peter Xu
2018-11-06  5:29     ` Fei Li
2018-11-01 10:17 ` [Qemu-devel] [PATCH RFC v7 7/9] migration: remove unused &local_err parameter in migrate_set_error Fei Li
2018-11-05 13:59   ` Juan Quintela
2018-11-06  4:51     ` Fei Li
2018-11-01 10:17 ` [Qemu-devel] [PATCH RFC v7 8/9] migration: add more error handling for postcopy_ram_enable_notify Fei Li
2018-11-01 10:17 ` [Qemu-devel] [PATCH RFC v7 9/9] qemu_thread_create: propagate the error to callers to handle Fei Li
2018-11-05 13:53   ` Juan Quintela
2018-11-06  7:15     ` Fei Li
2018-11-03 18:09 ` [Qemu-devel] [PATCH RFC v7 0/9] qemu_thread_create: propagate errors to callers to check no-reply
2018-11-05  4:57   ` Fei Li
2018-11-05 18:19 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181101101715.9443-7-fli@suse.com \
    --to=fli@suse.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=famz@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).