aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-03-24 19:26:11 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-03-24 19:26:11 +0000
commit77fea92dbb2811442b38e9adfa8587a12290bf64 (patch)
tree777727102e8b16159d0f42551da20ea41a4a0e26
parented4916e8f88f53a344d4eb636e289c6d5ca34e17 (diff)
parent09576e74dbe697c5f0a7bc2ad7b59601457a2ff4 (diff)
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20180323a' into staging
Migration fixes for 2.12 All small fixes. Dan's is a missing piece of a cleanup that finally completes something, and between Paolo, Dan and myself we recon it's still on the edge of being a bug fix. # gpg: Signature made Fri 23 Mar 2018 20:17:40 GMT # gpg: using RSA key 0516331EBC5BFDE7 # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A 9FA9 0516 331E BC5B FDE7 * remotes/dgilbert/tags/pull-migration-20180323a: migration: Fix block migration flag case migration/block: compare only read blocks against the rate limiter migration/block: limit the number of parallel I/O requests migration: Fix rate limiting issue on RDMA migration migration: convert socket server to QIONetListener Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--migration/block.c5
-rw-r--r--migration/migration.c1
-rw-r--r--migration/qemu-file.c2
-rw-r--r--migration/socket.c48
4 files changed, 21 insertions, 35 deletions
diff --git a/migration/block.c b/migration/block.c
index 5c03632257..4c04d937b1 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -37,6 +37,7 @@
#define MAX_IS_ALLOCATED_SEARCH (65536 * BDRV_SECTOR_SIZE)
#define MAX_IO_BUFFERS 512
+#define MAX_PARALLEL_IO 16
//#define DEBUG_BLK_MIGRATION
@@ -772,9 +773,9 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
/* control the rate of transfer */
blk_mig_lock();
- while ((block_mig_state.submitted +
- block_mig_state.read_done) * BLOCK_SIZE <
+ while (block_mig_state.read_done * BLOCK_SIZE <
qemu_file_get_rate_limit(f) &&
+ block_mig_state.submitted < MAX_PARALLEL_IO &&
(block_mig_state.submitted + block_mig_state.read_done) <
MAX_IO_BUFFERS) {
blk_mig_unlock();
diff --git a/migration/migration.c b/migration/migration.c
index fc629e5965..52a5092add 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1428,6 +1428,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
"a valid migration protocol");
migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,
MIGRATION_STATUS_FAILED);
+ block_cleanup_parameters(s);
return;
}
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index e85f501f86..bb63c779cc 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -253,7 +253,7 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
if (f->hooks && f->hooks->save_page) {
int ret = f->hooks->save_page(f, f->opaque, block_offset,
offset, size, bytes_sent);
-
+ f->bytes_xfer += size;
if (ret != RAM_SAVE_CONTROL_DELAYED) {
if (bytes_sent && *bytes_sent > 0) {
qemu_update_position(f, *bytes_sent);
diff --git a/migration/socket.c b/migration/socket.c
index 8a93fb1af5..122d8ccfbe 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -24,6 +24,7 @@
#include "migration.h"
#include "qemu-file.h"
#include "io/channel-socket.h"
+#include "io/net-listener.h"
#include "trace.h"
@@ -129,34 +130,20 @@ void unix_start_outgoing_migration(MigrationState *s,
}
-static gboolean socket_accept_incoming_migration(QIOChannel *ioc,
- GIOCondition condition,
- gpointer opaque)
+static void socket_accept_incoming_migration(QIONetListener *listener,
+ QIOChannelSocket *cioc,
+ gpointer opaque)
{
- QIOChannelSocket *sioc;
- Error *err = NULL;
-
- sioc = qio_channel_socket_accept(QIO_CHANNEL_SOCKET(ioc),
- &err);
- if (!sioc) {
- error_report("could not accept migration connection (%s)",
- error_get_pretty(err));
- goto out;
- }
-
trace_migration_socket_incoming_accepted();
- qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-incoming");
- migration_channel_process_incoming(QIO_CHANNEL(sioc));
- object_unref(OBJECT(sioc));
+ qio_channel_set_name(QIO_CHANNEL(cioc), "migration-socket-incoming");
+ migration_channel_process_incoming(QIO_CHANNEL(cioc));
-out:
if (migration_has_all_channels()) {
/* Close listening socket as its no longer needed */
- qio_channel_close(ioc, NULL);
- return G_SOURCE_REMOVE;
- } else {
- return G_SOURCE_CONTINUE;
+ qio_net_listener_disconnect(listener);
+
+ object_unref(OBJECT(listener));
}
}
@@ -164,21 +151,18 @@ out:
static void socket_start_incoming_migration(SocketAddress *saddr,
Error **errp)
{
- QIOChannelSocket *listen_ioc = qio_channel_socket_new();
+ QIONetListener *listener = qio_net_listener_new();
- qio_channel_set_name(QIO_CHANNEL(listen_ioc),
- "migration-socket-listener");
+ qio_net_listener_set_name(listener, "migration-socket-listener");
- if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) {
- object_unref(OBJECT(listen_ioc));
+ if (qio_net_listener_open_sync(listener, saddr, errp) < 0) {
+ object_unref(OBJECT(listener));
return;
}
- qio_channel_add_watch(QIO_CHANNEL(listen_ioc),
- G_IO_IN,
- socket_accept_incoming_migration,
- listen_ioc,
- (GDestroyNotify)object_unref);
+ qio_net_listener_set_client_func(listener,
+ socket_accept_incoming_migration,
+ NULL, NULL);
}
void tcp_start_incoming_migration(const char *host_port, Error **errp)