All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/13] Migration PULL request
@ 2018-01-29 12:09 Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 01/13] migration: Allow migrate_fd_connect to take an Error * Juan Quintela
                   ` (13 more replies)
  0 siblings, 14 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Hi

- migrate_fd_connect cleanup (dave)
- use MAX_VM_PACKAGED_SIZE
  have to change (1<<32) for UINT32_MAX to get no warnings on win32
- Use right s->threashord_size(wei)
- patches reviewed from info/migrate, migration tests and multifd (me)

Later, Juan.

The following changes since commit 6233b4a8c2a32ef6955a921246fa08705bbb3676:

  Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-01-26' into staging (2018-01-26 17:29:14 +0000)

are available in the Git repository at:

  git://github.com/juanquintela/qemu.git tags/migration/20180129

for you to fetch changes up to 4b6bb0a77761b8a906a540e927c7a9dde99bc10f:

  tests: Adjust sleeps for migration test (2018-01-29 12:10:22 +0100)

----------------------------------------------------------------
migration/next for 20180129

----------------------------------------------------------------
Daniel Henrique Barboza (1):
      migration/savevm.c: set MAX_VM_CMD_PACKAGED_SIZE to 1ul << 32

Dr. David Alan Gilbert (2):
      migration: Allow migrate_fd_connect to take an Error *
      migration: Route errors down through migration_channel_connect

Juan Quintela (9):
      migration: Drop current address parameter from save_zero_page()
      tests: Remove deprecated migration tests commands
      tests: Consolidate accelerators declaration
      tests: Use consistent names for migration
      tests: Add deprecated commands migration test
      tests: Add migration precopy test
      tests: Add migration xbzrle test
      tests: Create migrate-start-postcopy command
      tests: Adjust sleeps for migration test

Wei Wang (1):
      migration: use s->threshold_size inside migration_update_counters

 migration/channel.c    |  34 +++----
 migration/channel.h    |   3 +-
 migration/exec.c       |   2 +-
 migration/fd.c         |   2 +-
 migration/migration.c  |  12 ++-
 migration/migration.h  |   2 +-
 migration/ram.c        |  11 +--
 migration/rdma.c       |   2 +-
 migration/savevm.c     |   2 +-
 migration/socket.c     |   4 +-
 migration/tls.c        |   3 +-
 migration/trace-events |   2 +-
 tests/migration-test.c | 252 ++++++++++++++++++++++++++++++++++++++-----------
 13 files changed, 236 insertions(+), 95 deletions(-)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 01/13] migration: Allow migrate_fd_connect to take an Error *
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 02/13] migration: Route errors down through migration_channel_connect Juan Quintela
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Allow whatever is performing the connection to pass migrate_fd_connect
an error to indicate there was a problem during connection, an allow
us to clean up.

The caller must free the error.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/channel.c   | 2 +-
 migration/migration.c | 7 ++++++-
 migration/migration.h | 2 +-
 migration/rdma.c      | 2 +-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/migration/channel.c b/migration/channel.c
index 70ec7ea3b7..fdb7ddbd17 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -78,6 +78,6 @@ void migration_channel_connect(MigrationState *s,
 
         s->to_dst_file = f;
 
-        migrate_fd_connect(s);
+        migrate_fd_connect(s, NULL);
     }
 }
diff --git a/migration/migration.c b/migration/migration.c
index c99a4e62d7..1fbd304c66 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2378,10 +2378,15 @@ static void *migration_thread(void *opaque)
     return NULL;
 }
 
-void migrate_fd_connect(MigrationState *s)
+void migrate_fd_connect(MigrationState *s, Error *error_in)
 {
     s->expected_downtime = s->parameters.downtime_limit;
     s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup, s);
+    if (error_in) {
+        migrate_fd_error(s, error_in);
+        migrate_fd_cleanup(s);
+        return;
+    }
 
     qemu_file_set_blocking(s->to_dst_file, true);
     qemu_file_set_rate_limit(s->to_dst_file,
diff --git a/migration/migration.h b/migration/migration.h
index 786d971ce2..d3b214e5ba 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -190,7 +190,7 @@ uint64_t migrate_max_downtime(void);
 void migrate_set_error(MigrationState *s, const Error *error);
 void migrate_fd_error(MigrationState *s, const Error *error);
 
-void migrate_fd_connect(MigrationState *s);
+void migrate_fd_connect(MigrationState *s, Error *error_in);
 
 MigrationState *migrate_init(void);
 bool migration_is_blocked(Error **errp);
diff --git a/migration/rdma.c b/migration/rdma.c
index 9d5a424011..da474fc19f 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -3758,7 +3758,7 @@ void rdma_start_outgoing_migration(void *opaque,
     trace_rdma_start_outgoing_migration_after_rdma_connect();
 
     s->to_dst_file = qemu_fopen_rdma(rdma, "wb");
-    migrate_fd_connect(s);
+    migrate_fd_connect(s, NULL);
     return;
 err:
     g_free(rdma);
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 02/13] migration: Route errors down through migration_channel_connect
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 01/13] migration: Allow migrate_fd_connect to take an Error * Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 03/13] migration/savevm.c: set MAX_VM_CMD_PACKAGED_SIZE to 1ul << 32 Juan Quintela
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Route async errors (especially from sockets) down through
migration_channel_connect and on to migrate_fd_connect where they
can be cleaned up.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/channel.c    | 34 +++++++++++++++++-----------------
 migration/channel.h    |  3 ++-
 migration/exec.c       |  2 +-
 migration/fd.c         |  2 +-
 migration/socket.c     |  4 +---
 migration/tls.c        |  3 +--
 migration/trace-events |  2 +-
 7 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/migration/channel.c b/migration/channel.c
index fdb7ddbd17..c5eaf0fa0e 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -55,29 +55,29 @@ void migration_channel_process_incoming(QIOChannel *ioc)
  * @s: Current migration state
  * @ioc: Channel to which we are connecting
  * @hostname: Where we want to connect
+ * @error: Error indicating failure to connect, free'd here
  */
 void migration_channel_connect(MigrationState *s,
                                QIOChannel *ioc,
-                               const char *hostname)
+                               const char *hostname,
+                               Error *error)
 {
     trace_migration_set_outgoing_channel(
-        ioc, object_get_typename(OBJECT(ioc)), hostname);
+        ioc, object_get_typename(OBJECT(ioc)), hostname, error);
+
+    if (!error) {
+        if (s->parameters.tls_creds &&
+            *s->parameters.tls_creds &&
+            !object_dynamic_cast(OBJECT(ioc),
+                                 TYPE_QIO_CHANNEL_TLS)) {
+            migration_tls_channel_connect(s, ioc, hostname, &error);
+        } else {
+            QEMUFile *f = qemu_fopen_channel_output(ioc);
+
+            s->to_dst_file = f;
 
-    if (s->parameters.tls_creds &&
-        *s->parameters.tls_creds &&
-        !object_dynamic_cast(OBJECT(ioc),
-                             TYPE_QIO_CHANNEL_TLS)) {
-        Error *local_err = NULL;
-        migration_tls_channel_connect(s, ioc, hostname, &local_err);
-        if (local_err) {
-            migrate_fd_error(s, local_err);
-            error_free(local_err);
         }
-    } else {
-        QEMUFile *f = qemu_fopen_channel_output(ioc);
-
-        s->to_dst_file = f;
-
-        migrate_fd_connect(s, NULL);
     }
+    migrate_fd_connect(s, error);
+    error_free(error);
 }
diff --git a/migration/channel.h b/migration/channel.h
index e4b40579a1..67a461c28a 100644
--- a/migration/channel.h
+++ b/migration/channel.h
@@ -22,5 +22,6 @@ void migration_channel_process_incoming(QIOChannel *ioc);
 
 void migration_channel_connect(MigrationState *s,
                                QIOChannel *ioc,
-                               const char *hostname);
+                               const char *hostname,
+                               Error *error_in);
 #endif
diff --git a/migration/exec.c b/migration/exec.c
index f3be1baf2e..c9537974ad 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -39,7 +39,7 @@ void exec_start_outgoing_migration(MigrationState *s, const char *command, Error
     }
 
     qio_channel_set_name(ioc, "migration-exec-outgoing");
-    migration_channel_connect(s, ioc, NULL);
+    migration_channel_connect(s, ioc, NULL, NULL);
     object_unref(OBJECT(ioc));
 }
 
diff --git a/migration/fd.c b/migration/fd.c
index 30de4b9847..6284a97cba 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -39,7 +39,7 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **
     }
 
     qio_channel_set_name(QIO_CHANNEL(ioc), "migration-fd-outgoing");
-    migration_channel_connect(s, ioc, NULL);
+    migration_channel_connect(s, ioc, NULL, NULL);
     object_unref(OBJECT(ioc));
 }
 
diff --git a/migration/socket.c b/migration/socket.c
index 3a8232dd2d..e090097077 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -79,12 +79,10 @@ static void socket_outgoing_migration(QIOTask *task,
 
     if (qio_task_propagate_error(task, &err)) {
         trace_migration_socket_outgoing_error(error_get_pretty(err));
-        migrate_fd_error(data->s, err);
-        error_free(err);
     } else {
         trace_migration_socket_outgoing_connected(data->hostname);
-        migration_channel_connect(data->s, sioc, data->hostname);
     }
+    migration_channel_connect(data->s, sioc, data->hostname, err);
     object_unref(OBJECT(sioc));
 }
 
diff --git a/migration/tls.c b/migration/tls.c
index 026a008667..a29b35b33c 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -118,11 +118,10 @@ static void migration_tls_outgoing_handshake(QIOTask *task,
 
     if (qio_task_propagate_error(task, &err)) {
         trace_migration_tls_outgoing_handshake_error(error_get_pretty(err));
-        migrate_fd_error(s, err);
     } else {
         trace_migration_tls_outgoing_handshake_complete();
-        migration_channel_connect(s, ioc, NULL);
     }
+    migration_channel_connect(s, ioc, NULL, err);
     object_unref(OBJECT(ioc));
 }
 
diff --git a/migration/trace-events b/migration/trace-events
index 6f29fcc686..93961dea16 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -114,7 +114,7 @@ migrate_transferred(uint64_t tranferred, uint64_t time_spent, double bandwidth,
 process_incoming_migration_co_end(int ret, int ps) "ret=%d postcopy-state=%d"
 process_incoming_migration_co_postcopy_end_main(void) ""
 migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=%p ioctype=%s"
-migration_set_outgoing_channel(void *ioc, const char *ioctype, const char *hostname)  "ioc=%p ioctype=%s hostname=%s"
+migration_set_outgoing_channel(void *ioc, const char *ioctype, const char *hostname, void *err)  "ioc=%p ioctype=%s hostname=%s err=%p"
 
 # migration/rdma.c
 qemu_rdma_accept_incoming_migration(void) ""
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 03/13] migration/savevm.c: set MAX_VM_CMD_PACKAGED_SIZE to 1ul << 32
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 01/13] migration: Allow migrate_fd_connect to take an Error * Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 02/13] migration: Route errors down through migration_channel_connect Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 04/13] migration: use s->threshold_size inside migration_update_counters Juan Quintela
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx, Daniel Henrique Barboza

From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>

MAX_VM_CMD_PACKAGED_SIZE is a constant used in qemu_savevm_send_packaged
and loadvm_handle_cmd_packaged to determine whether a package is too
big to be sent or received. qemu_savevm_send_packaged is called inside
postcopy_start (migration/migration.c) to send the MigrationState
in a single blob to the destination, using the MIG_CMD_PACKAGED subcommand,
which will read it up using loadvm_handle_cmd_packaged. If the blob is
larger than MAX_VM_CMD_PACKAGED_SIZE, an error is thrown and the postcopy
migration is aborted. Both MAX_VM_CMD_PACKAGED_SIZE and MIG_CMD_PACKAGED
were introduced by commit 11cf1d984b ("MIG_CMD_PACKAGED: Send a packaged
chunk ..."). The constant has its original value of 1ul << 24 (16MB).

The current MAX_VM_CMD_PACKAGED_SIZE value is not enough to support postcopy
migration of bigger pseries guests. The blob size for a postcopy migration of
a pseries guest with the following setup:

qemu-system-ppc64 --nographic -vga none -machine pseries,accel=kvm -m 64G \
-smp 1,maxcpus=32 -device virtio-blk-pci,drive=rootdisk \
-drive file=f27.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \
-netdev user,id=u1 -net nic,netdev=u1

Goes around 12MB. Bumping the RAM to 128G makes the blob sizes goes to 20MB.
With 256G the blob goes to 37MB - more than twice the current maximum size.
At this moment the pseries machine can handle guests with up to 1TB of RAM,
making this postcopy blob goes to 128MB of size approximately.

Following the discussions made in [1], there is a need to understand what
devices are aggressively consuming the blob in that manner and see if that
can be mitigated. Until then, we can set MAX_VM_CMD_PACKAGED_SIZE to the
maximum value allowed. Since the size is a 32 bit int variable, we can set
it as 1ul << 32, giving a maximum blob size of 4G that is enough to support
postcopy migration of 32TB RAM guests given the above constraints.

[1] https://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg06313.html

Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/savevm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/savevm.c b/migration/savevm.c
index b7908f62be..b8e9c532af 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -81,7 +81,7 @@ enum qemu_vm_cmd {
     MIG_CMD_MAX
 };
 
-#define MAX_VM_CMD_PACKAGED_SIZE (1ul << 24)
+#define MAX_VM_CMD_PACKAGED_SIZE UINT32_MAX
 static struct mig_cmd_args {
     ssize_t     len; /* -1 = variable */
     const char *name;
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 04/13] migration: use s->threshold_size inside migration_update_counters
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (2 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 03/13] migration/savevm.c: set MAX_VM_CMD_PACKAGED_SIZE to 1ul << 32 Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 05/13] migration: Drop current address parameter from save_zero_page() Juan Quintela
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx, Wei Wang

From: Wei Wang <wei.w.wang@intel.com>

Fixes: b15df1ae50 ("migration: cleanup stats update into function")
The threshold size is changed to be recorded in s->threshold_size.

Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/migration.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index 1fbd304c66..44cbfb0ddd 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2169,7 +2169,6 @@ static void migration_update_counters(MigrationState *s,
                                       int64_t current_time)
 {
     uint64_t transferred, time_spent;
-    int64_t threshold_size;
     double bandwidth;
 
     if (current_time < s->iteration_start_time + BUFFER_DELAY) {
@@ -2179,7 +2178,7 @@ static void migration_update_counters(MigrationState *s,
     transferred = qemu_ftell(s->to_dst_file) - s->iteration_initial_bytes;
     time_spent = current_time - s->iteration_start_time;
     bandwidth = (double)transferred / time_spent;
-    threshold_size = bandwidth * s->parameters.downtime_limit;
+    s->threshold_size = bandwidth * s->parameters.downtime_limit;
 
     s->mbps = (((double) transferred * 8.0) /
                ((double) time_spent / 1000.0)) / 1000.0 / 1000.0;
@@ -2199,7 +2198,7 @@ static void migration_update_counters(MigrationState *s,
     s->iteration_initial_bytes = qemu_ftell(s->to_dst_file);
 
     trace_migrate_transferred(transferred, time_spent,
-                              bandwidth, threshold_size);
+                              bandwidth, s->threshold_size);
 }
 
 /* Migration thread iteration status */
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 05/13] migration: Drop current address parameter from save_zero_page()
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (3 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 04/13] migration: use s->threshold_size inside migration_update_counters Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 06/13] tests: Remove deprecated migration tests commands Juan Quintela
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

It already has RAMBlock and offset, it can calculate it itself.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/ram.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index cb1950f3eb..5a109efeda 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -907,11 +907,10 @@ static void migration_bitmap_sync(RAMState *rs)
  * @rs: current RAM state
  * @block: block that contains the page we want to send
  * @offset: offset inside the block for the page
- * @p: pointer to the page
  */
-static int save_zero_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
-                          uint8_t *p)
+static int save_zero_page(RAMState *rs, RAMBlock *block, ram_addr_t offset)
 {
+    uint8_t *p = block->host + offset;
     int pages = -1;
 
     if (is_zero_range(p, TARGET_PAGE_SIZE)) {
@@ -984,7 +983,7 @@ static int ram_save_page(RAMState *rs, PageSearchStatus *pss, bool last_stage)
             }
         }
     } else {
-        pages = save_zero_page(rs, block, offset, p);
+        pages = save_zero_page(rs, block, offset);
         if (pages > 0) {
             /* Must let xbzrle know, otherwise a previous (now 0'd) cached
              * page would be stale
@@ -1160,7 +1159,7 @@ static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
          */
         if (block != rs->last_sent_block) {
             flush_compressed_data(rs);
-            pages = save_zero_page(rs, block, offset, p);
+            pages = save_zero_page(rs, block, offset);
             if (pages == -1) {
                 /* Make sure the first page is sent out before other pages */
                 bytes_xmit = save_page_header(rs, rs->f, block, offset |
@@ -1180,7 +1179,7 @@ static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
                 ram_release_pages(block->idstr, offset, pages);
             }
         } else {
-            pages = save_zero_page(rs, block, offset, p);
+            pages = save_zero_page(rs, block, offset);
             if (pages == -1) {
                 pages = compress_page_with_multi_thread(rs, block, offset);
             } else {
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 06/13] tests: Remove deprecated migration tests commands
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (4 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 05/13] migration: Drop current address parameter from save_zero_page() Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 07/13] tests: Consolidate accelerators declaration Juan Quintela
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

We move to use migration_set_parameter() for everything.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 tests/migration-test.c | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/tests/migration-test.c b/tests/migration-test.c
index 799e24ebc6..0428d450df 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -369,37 +369,20 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
     QDECREF(rsp);
 }
 
-static void migrate_set_downtime(QTestState *who, const double value)
+static void migrate_set_parameter(QTestState *who, const char *parameter,
+                                  const char *value)
 {
     QDict *rsp;
     gchar *cmd;
-    char *expected;
-    int64_t result_int;
 
-    cmd = g_strdup_printf("{ 'execute': 'migrate_set_downtime',"
-                          "'arguments': { 'value': %g } }", value);
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
+                          "'arguments': { '%s': %s } }",
+                          parameter, value);
     rsp = qtest_qmp(who, cmd);
     g_free(cmd);
     g_assert(qdict_haskey(rsp, "return"));
     QDECREF(rsp);
-    result_int = value * 1000L;
-    expected = g_strdup_printf("%" PRId64, result_int);
-    migrate_check_parameter(who, "downtime-limit", expected);
-    g_free(expected);
-}
-
-static void migrate_set_speed(QTestState *who, const char *value)
-{
-    QDict *rsp;
-    gchar *cmd;
-
-    cmd = g_strdup_printf("{ 'execute': 'migrate_set_speed',"
-                          "'arguments': { 'value': %s } }", value);
-    rsp = qtest_qmp(who, cmd);
-    g_free(cmd);
-    g_assert(qdict_haskey(rsp, "return"));
-    QDECREF(rsp);
-    migrate_check_parameter(who, "max-bandwidth", value);
+    migrate_check_parameter(who, parameter, value);
 }
 
 static void migrate_set_capability(QTestState *who, const char *capability,
@@ -530,8 +513,8 @@ static void test_migrate(void)
      * quickly, but that it doesn't complete precopy even on a slow
      * machine, so also set the downtime.
      */
-    migrate_set_speed(from, "100000000");
-    migrate_set_downtime(from, 0.001);
+    migrate_set_parameter(from, "max-bandwidth", "100000000");
+    migrate_set_parameter(from, "downtime-limit", "1");
 
     /* Wait for the first serial output from the source */
     wait_for_serial("src_serial");
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 07/13] tests: Consolidate accelerators declaration
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (5 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 06/13] tests: Remove deprecated migration tests commands Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 08/13] tests: Use consistent names for migration Juan Quintela
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
 tests/migration-test.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tests/migration-test.c b/tests/migration-test.c
index 0428d450df..3732682a29 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -422,27 +422,29 @@ static void test_migrate_start(QTestState **from, QTestState **to,
     gchar *cmd_src, *cmd_dst;
     char *bootpath = g_strdup_printf("%s/bootsect", tmpfs);
     const char *arch = qtest_get_arch();
+    const char *accel = "kvm:tcg";
 
     got_stop = false;
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
         init_bootfile_x86(bootpath);
-        cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 150M"
+        cmd_src = g_strdup_printf("-machine accel=%s -m 150M"
                                   " -name pcsource,debug-threads=on"
                                   " -serial file:%s/src_serial"
                                   " -drive file=%s,format=raw",
-                                  tmpfs, bootpath);
-        cmd_dst = g_strdup_printf("-machine accel=kvm:tcg -m 150M"
+                                  accel, tmpfs, bootpath);
+        cmd_dst = g_strdup_printf("-machine accel=%s -m 150M"
                                   " -name pcdest,debug-threads=on"
                                   " -serial file:%s/dest_serial"
                                   " -drive file=%s,format=raw"
                                   " -incoming %s",
-                                  tmpfs, bootpath, uri);
+                                  accel, tmpfs, bootpath, uri);
     } else if (strcmp(arch, "ppc64") == 0) {
-        const char *accel;
 
         /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */
-        accel = access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg";
+        if (access("/sys/module/kvm_hv", F_OK)) {
+            accel = "tcg";
+        }
         init_bootfile_ppc(bootpath);
         cmd_src = g_strdup_printf("-machine accel=%s -m 256M"
                                   " -name pcsource,debug-threads=on"
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 08/13] tests: Use consistent names for migration
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (6 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 07/13] tests: Consolidate accelerators declaration Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 09/13] tests: Add deprecated commands migration test Juan Quintela
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
 tests/migration-test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/migration-test.c b/tests/migration-test.c
index 3732682a29..ac4a916169 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -429,12 +429,12 @@ static void test_migrate_start(QTestState **from, QTestState **to,
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
         init_bootfile_x86(bootpath);
         cmd_src = g_strdup_printf("-machine accel=%s -m 150M"
-                                  " -name pcsource,debug-threads=on"
+                                  " -name source,debug-threads=on"
                                   " -serial file:%s/src_serial"
                                   " -drive file=%s,format=raw",
                                   accel, tmpfs, bootpath);
         cmd_dst = g_strdup_printf("-machine accel=%s -m 150M"
-                                  " -name pcdest,debug-threads=on"
+                                  " -name target,debug-threads=on"
                                   " -serial file:%s/dest_serial"
                                   " -drive file=%s,format=raw"
                                   " -incoming %s",
@@ -447,12 +447,12 @@ static void test_migrate_start(QTestState **from, QTestState **to,
         }
         init_bootfile_ppc(bootpath);
         cmd_src = g_strdup_printf("-machine accel=%s -m 256M"
-                                  " -name pcsource,debug-threads=on"
+                                  " -name source,debug-threads=on"
                                   " -serial file:%s/src_serial"
                                   " -drive file=%s,if=pflash,format=raw",
                                   accel, tmpfs, bootpath);
         cmd_dst = g_strdup_printf("-machine accel=%s -m 256M"
-                                  " -name pcdest,debug-threads=on"
+                                  " -name target,debug-threads=on"
                                   " -serial file:%s/dest_serial"
                                   " -incoming %s",
                                   accel, tmpfs, uri);
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 09/13] tests: Add deprecated commands migration test
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (7 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 08/13] tests: Use consistent names for migration Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 10/13] tests: Add migration precopy test Juan Quintela
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

We add deprecated commands on a new test, so we don't have to add it
on normal tests.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
 tests/migration-test.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/tests/migration-test.c b/tests/migration-test.c
index ac4a916169..2a0b651cd1 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -500,6 +500,51 @@ static void test_migrate_end(QTestState *from, QTestState *to)
     cleanup("dest_serial");
 }
 
+static void deprecated_set_downtime(QTestState *who, const double value)
+{
+    QDict *rsp;
+    gchar *cmd;
+    char *expected;
+    int64_t result_int;
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate_set_downtime',"
+                          "'arguments': { 'value': %g } }", value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    result_int = value * 1000L;
+    expected = g_strdup_printf("%" PRId64, result_int);
+    migrate_check_parameter(who, "downtime-limit", expected);
+    g_free(expected);
+}
+
+static void deprecated_set_speed(QTestState *who, const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate_set_speed',"
+                          "'arguments': { 'value': %s } }", value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, "max-bandwidth", value);
+}
+
+static void test_deprecated(void)
+{
+    QTestState *from;
+
+    from = qtest_start("");
+
+    deprecated_set_downtime(from, 0.12345);
+    deprecated_set_speed(from, "12345");
+
+    qtest_quit(from);
+}
+
 static void test_migrate(void)
 {
     char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
@@ -563,6 +608,7 @@ int main(int argc, char **argv)
     module_call_init(MODULE_INIT_QOM);
 
     qtest_add_func("/migration/postcopy/unix", test_migrate);
+    qtest_add_func("/migration/deprecated", test_deprecated);
 
     ret = g_test_run();
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 10/13] tests: Add migration precopy test
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (8 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 09/13] tests: Add deprecated commands migration test Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 11/13] tests: Add migration xbzrle test Juan Quintela
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
 tests/migration-test.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/tests/migration-test.c b/tests/migration-test.c
index 2a0b651cd1..44c8860134 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -545,7 +545,7 @@ static void test_deprecated(void)
     qtest_quit(from);
 }
 
-static void test_migrate(void)
+static void test_postcopy(void)
 {
     char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
     QTestState *from, *to;
@@ -588,6 +588,45 @@ static void test_migrate(void)
     test_migrate_end(from, to);
 }
 
+static void test_precopy_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* We want to pick a speed slow enough that the test completes
+     * quickly, but that it doesn't complete precopy even on a slow
+     * machine, so also set the downtime.
+     */
+    /* 1 ms should make it not converge*/
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1GB/s */
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");
+
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300 ms should converge */
+    migrate_set_parameter(from, "downtime-limit", "300");
+
+    if (!got_stop) {
+        qtest_qmp_eventwait(from, "STOP");
+    }
+
+    qtest_qmp_eventwait(to, "RESUME");
+
+    wait_for_serial("dest_serial");
+    wait_for_migration_complete(from);
+
+    test_migrate_end(from, to);
+    g_free(uri);
+}
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -607,8 +646,9 @@ int main(int argc, char **argv)
 
     module_call_init(MODULE_INIT_QOM);
 
-    qtest_add_func("/migration/postcopy/unix", test_migrate);
+    qtest_add_func("/migration/precopy/unix", test_precopy_unix);
     qtest_add_func("/migration/deprecated", test_deprecated);
+    qtest_add_func("/migration/postcopy/unix", test_postcopy);
 
     ret = g_test_run();
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 11/13] tests: Add migration xbzrle test
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (9 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 10/13] tests: Add migration precopy test Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 12/13] tests: Create migrate-start-postcopy command Juan Quintela
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
 tests/migration-test.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/tests/migration-test.c b/tests/migration-test.c
index 44c8860134..84f5bcf00a 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -533,6 +533,20 @@ static void deprecated_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void deprecated_set_cache_size(QTestState *who, const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-cache-size',"
+                          "'arguments': { 'value': %s } }", value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, "xbzrle-cache-size", value);
+}
+
 static void test_deprecated(void)
 {
     QTestState *from;
@@ -541,6 +555,7 @@ static void test_deprecated(void)
 
     deprecated_set_downtime(from, 0.12345);
     deprecated_set_speed(from, "12345");
+    deprecated_set_cache_size(from, "4096");
 
     qtest_quit(from);
 }
@@ -627,6 +642,54 @@ static void test_precopy_unix(void)
     g_free(uri);
 }
 
+static void test_xbzrle(const char *uri)
+{
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* We want to pick a speed slow enough that the test completes
+     * quickly, but that it doesn't complete precopy even on a slow
+     * machine, so also set the downtime.
+     */
+    /* 1 ms should make it not converge*/
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1GB/s */
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");
+
+    migrate_set_parameter(from, "xbzrle-cache-size", "33554432");
+
+    migrate_set_capability(from, "xbzrle", "true");
+    migrate_set_capability(to, "xbzrle", "true");
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300ms should converge */
+    migrate_set_parameter(from, "downtime-limit", "300");
+
+    if (!got_stop) {
+        qtest_qmp_eventwait(from, "STOP");
+    }
+    qtest_qmp_eventwait(to, "RESUME");
+
+    wait_for_serial("dest_serial");
+    wait_for_migration_complete(from);
+
+    test_migrate_end(from, to);
+}
+
+static void test_xbzrle_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+
+    test_xbzrle(uri);
+    g_free(uri);
+}
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -649,6 +712,7 @@ int main(int argc, char **argv)
     qtest_add_func("/migration/precopy/unix", test_precopy_unix);
     qtest_add_func("/migration/deprecated", test_deprecated);
     qtest_add_func("/migration/postcopy/unix", test_postcopy);
+    qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
 
     ret = g_test_run();
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 12/13] tests: Create migrate-start-postcopy command
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (10 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 11/13] tests: Add migration xbzrle test Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 12:09 ` [Qemu-devel] [PULL 13/13] tests: Adjust sleeps for migration test Juan Quintela
  2018-01-29 18:53 ` [Qemu-devel] [PULL 00/13] Migration PULL request Peter Maydell
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

This way, it is like the rest of commands

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
 tests/migration-test.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tests/migration-test.c b/tests/migration-test.c
index 84f5bcf00a..d191f6e03b 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -416,6 +416,15 @@ static void migrate(QTestState *who, const char *uri)
     QDECREF(rsp);
 }
 
+static void migrate_start_postcopy(QTestState *who)
+{
+    QDict *rsp;
+
+    rsp = wait_command(who, "{ 'execute': 'migrate-start-postcopy' }");
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+}
+
 static void test_migrate_start(QTestState **from, QTestState **to,
                                const char *uri)
 {
@@ -564,7 +573,6 @@ static void test_postcopy(void)
 {
     char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
     QTestState *from, *to;
-    QDict *rsp;
 
     test_migrate_start(&from, &to, uri);
 
@@ -585,9 +593,7 @@ static void test_postcopy(void)
 
     wait_for_migration_pass(from);
 
-    rsp = wait_command(from, "{ 'execute': 'migrate-start-postcopy' }");
-    g_assert(qdict_haskey(rsp, "return"));
-    QDECREF(rsp);
+    migrate_start_postcopy(from);
 
     if (!got_stop) {
         qtest_qmp_eventwait(from, "STOP");
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PULL 13/13] tests: Adjust sleeps for migration test
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (11 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 12/13] tests: Create migrate-start-postcopy command Juan Quintela
@ 2018-01-29 12:09 ` Juan Quintela
  2018-01-29 18:53 ` [Qemu-devel] [PULL 00/13] Migration PULL request Peter Maydell
  13 siblings, 0 replies; 17+ messages in thread
From: Juan Quintela @ 2018-01-29 12:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Also reorder code to not sleep when event already happened.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
 tests/migration-test.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/tests/migration-test.c b/tests/migration-test.c
index d191f6e03b..fcad2ed460 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -268,10 +268,9 @@ static uint64_t get_migration_pass(QTestState *who)
 
 static void wait_for_migration_complete(QTestState *who)
 {
-    QDict *rsp, *rsp_return;
-    bool completed;
-
-    do {
+    while (true) {
+        QDict *rsp, *rsp_return;
+        bool completed;
         const char *status;
 
         rsp = wait_command(who, "{ 'execute': 'query-migrate' }");
@@ -280,8 +279,11 @@ static void wait_for_migration_complete(QTestState *who)
         completed = strcmp(status, "completed") == 0;
         g_assert_cmpstr(status, !=,  "failed");
         QDECREF(rsp);
-        usleep(1000 * 100);
-    } while (!completed);
+        if (completed) {
+            return;
+        }
+        usleep(1000);
+    }
 }
 
 static void wait_for_migration_pass(QTestState *who)
@@ -290,16 +292,13 @@ static void wait_for_migration_pass(QTestState *who)
     uint64_t pass;
 
     /* Wait for the 1st sync */
-    do {
+    while (!got_stop && !initial_pass) {
+        usleep(1000);
         initial_pass = get_migration_pass(who);
-        if (got_stop || initial_pass) {
-            break;
-        }
-        usleep(1000 * 100);
-    } while (true);
+    }
 
     do {
-        usleep(1000 * 100);
+        usleep(1000);
         pass = get_migration_pass(who);
     } while (pass == initial_pass && !got_stop);
 }
@@ -489,13 +488,13 @@ static void test_migrate_end(QTestState *from, QTestState *to)
     /* Destination still running, wait for a byte to change */
     do {
         qtest_memread(to, start_address, &dest_byte_b, 1);
-        usleep(10 * 1000);
+        usleep(1000 * 10);
     } while (dest_byte_a == dest_byte_b);
 
     qtest_qmp_discard_response(to, "{ 'execute' : 'stop'}");
     /* With it stopped, check nothing changes */
     qtest_memread(to, start_address, &dest_byte_c, 1);
-    sleep(1);
+    usleep(1000 * 200);
     qtest_memread(to, start_address, &dest_byte_d, 1);
     g_assert_cmpint(dest_byte_c, ==, dest_byte_d);
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PULL 00/13] Migration PULL request
  2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
                   ` (12 preceding siblings ...)
  2018-01-29 12:09 ` [Qemu-devel] [PULL 13/13] tests: Adjust sleeps for migration test Juan Quintela
@ 2018-01-29 18:53 ` Peter Maydell
  2018-01-30  6:29   ` Juan Quintela
  13 siblings, 1 reply; 17+ messages in thread
From: Peter Maydell @ 2018-01-29 18:53 UTC (permalink / raw)
  To: Juan Quintela
  Cc: QEMU Developers, Laurent Vivier, Dr. David Alan Gilbert, Peter Xu

On 29 January 2018 at 12:09, Juan Quintela <quintela@redhat.com> wrote:
> Hi
>
> - migrate_fd_connect cleanup (dave)
> - use MAX_VM_PACKAGED_SIZE
>   have to change (1<<32) for UINT32_MAX to get no warnings on win32
> - Use right s->threashord_size(wei)
> - patches reviewed from info/migrate, migration tests and multifd (me)
>
> Later, Juan.
>
> The following changes since commit 6233b4a8c2a32ef6955a921246fa08705bbb3676:
>
>   Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-01-26' into staging (2018-01-26 17:29:14 +0000)
>
> are available in the Git repository at:
>
>   git://github.com/juanquintela/qemu.git tags/migration/20180129
>
> for you to fetch changes up to 4b6bb0a77761b8a906a540e927c7a9dde99bc10f:
>
>   tests: Adjust sleeps for migration test (2018-01-29 12:10:22 +0100)
>
> ----------------------------------------------------------------
> migration/next for 20180129

Hi. On aarch32 host I get this assert in the tests:

TEST: tests/migration-test... (pid=605)
  /ppc64/migration/deprecated:                                         OK
  /ppc64/migration/precopy/unix:                                       OK
  /ppc64/migration/postcopy/unix:                                      OK
  /ppc64/migration/xbzrle/unix:
Unexpected 32 on dest_serial serial
**
ERROR:/home/peter.maydell/qemu/tests/migration-test.c:218:wait_for_serial:
code should not be reached
FAIL
GTester: last random seed: R02S31c8250adcdb12a122a1c5c0ab62d01e
(pid=639)
FAIL: tests/migration-test

thanks
-- PMM

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PULL 00/13] Migration PULL request
  2018-01-29 18:53 ` [Qemu-devel] [PULL 00/13] Migration PULL request Peter Maydell
@ 2018-01-30  6:29   ` Juan Quintela
  2018-02-01 13:10     ` Laurent Vivier
  0 siblings, 1 reply; 17+ messages in thread
From: Juan Quintela @ 2018-01-30  6:29 UTC (permalink / raw)
  To: Peter Maydell
  Cc: QEMU Developers, Laurent Vivier, Dr. David Alan Gilbert, Peter Xu

Peter Maydell <peter.maydell@linaro.org> wrote:
> On 29 January 2018 at 12:09, Juan Quintela <quintela@redhat.com> wrote:
>> Hi
>>
>> - migrate_fd_connect cleanup (dave)
>> - use MAX_VM_PACKAGED_SIZE
>>   have to change (1<<32) for UINT32_MAX to get no warnings on win32
>> - Use right s->threashord_size(wei)
>> - patches reviewed from info/migrate, migration tests and multifd (me)
>>
>> Later, Juan.
>>
>> The following changes since commit 6233b4a8c2a32ef6955a921246fa08705bbb3676:
>>
>>   Merge remote-tracking branch
>> 'remotes/ericb/tags/pull-nbd-2018-01-26' into staging (2018-01-26
>> 17:29:14 +0000)
>>
>> are available in the Git repository at:
>>
>>   git://github.com/juanquintela/qemu.git tags/migration/20180129
>>
>> for you to fetch changes up to 4b6bb0a77761b8a906a540e927c7a9dde99bc10f:
>>
>>   tests: Adjust sleeps for migration test (2018-01-29 12:10:22 +0100)
>>
>> ----------------------------------------------------------------
>> migration/next for 20180129
>
> Hi. On aarch32 host I get this assert in the tests:
>
> TEST: tests/migration-test... (pid=605)
>   /ppc64/migration/deprecated:                                         OK
>   /ppc64/migration/precopy/unix:                                       OK
>   /ppc64/migration/postcopy/unix:                                      OK
>   /ppc64/migration/xbzrle/unix:
> Unexpected 32 on dest_serial serial
> **
> ERROR:/home/peter.maydell/qemu/tests/migration-test.c:218:wait_for_serial:
> code should not be reached

1st time I see a problem on the xbzrle test.  I can resent the pull
without that patch, but that is a *test*, the problem is that we have a
xbzrle problem on aarch32 that we didn't know about yet.

So I will just try to do the PULL request anyways.  I will try to get
access to an arm32 system tomorrow and see what is going on.

Thanks for checking it.

Later, Juan.


> FAIL
> GTester: last random seed: R02S31c8250adcdb12a122a1c5c0ab62d01e
> (pid=639)
> FAIL: tests/migration-test
>
> thanks
> -- PMM

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PULL 00/13] Migration PULL request
  2018-01-30  6:29   ` Juan Quintela
@ 2018-02-01 13:10     ` Laurent Vivier
  0 siblings, 0 replies; 17+ messages in thread
From: Laurent Vivier @ 2018-02-01 13:10 UTC (permalink / raw)
  To: quintela; +Cc: Peter Maydell, QEMU Developers, Dr. David Alan Gilbert, Peter Xu

On 30/01/2018 07:29, Juan Quintela wrote:
> Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 29 January 2018 at 12:09, Juan Quintela <quintela@redhat.com> wrote:
>>> Hi
>>>
>>> - migrate_fd_connect cleanup (dave)
>>> - use MAX_VM_PACKAGED_SIZE
>>>   have to change (1<<32) for UINT32_MAX to get no warnings on win32
>>> - Use right s->threashord_size(wei)
>>> - patches reviewed from info/migrate, migration tests and multifd (me)
>>>
>>> Later, Juan.
>>>
>>> The following changes since commit 6233b4a8c2a32ef6955a921246fa08705bbb3676:
>>>
>>>   Merge remote-tracking branch
>>> 'remotes/ericb/tags/pull-nbd-2018-01-26' into staging (2018-01-26
>>> 17:29:14 +0000)
>>>
>>> are available in the Git repository at:
>>>
>>>   git://github.com/juanquintela/qemu.git tags/migration/20180129
>>>
>>> for you to fetch changes up to 4b6bb0a77761b8a906a540e927c7a9dde99bc10f:
>>>
>>>   tests: Adjust sleeps for migration test (2018-01-29 12:10:22 +0100)
>>>
>>> ----------------------------------------------------------------
>>> migration/next for 20180129
>>
>> Hi. On aarch32 host I get this assert in the tests:
>>
>> TEST: tests/migration-test... (pid=605)
>>   /ppc64/migration/deprecated:                                         OK
>>   /ppc64/migration/precopy/unix:                                       OK
>>   /ppc64/migration/postcopy/unix:                                      OK
>>   /ppc64/migration/xbzrle/unix:
>> Unexpected 32 on dest_serial serial
>> **
>> ERROR:/home/peter.maydell/qemu/tests/migration-test.c:218:wait_for_serial:
>> code should not be reached
> 
> 1st time I see a problem on the xbzrle test.  I can resent the pull
> without that patch, but that is a *test*, the problem is that we have a
> xbzrle problem on aarch32 that we didn't know about yet.
> 
> So I will just try to do the PULL request anyways.  I will try to get
> access to an arm32 system tomorrow and see what is going on.
> 
> Thanks for checking it.

I have tested this on ppc32 (G4@900MHz) and I found it never converges.

If I increase the downtime limit, it works:

--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -674,7 +674,7 @@ static void test_xbzrle(const char *uri)
     wait_for_migration_pass(from);

     /* 300ms should converge */
-    migrate_set_parameter(from, "downtime-limit", "300");
+    migrate_set_parameter(from, "downtime-limit", "2000");

The test is also disabled if USERFAULTFD is disabled in the kernel,
whereas it doesn't need it. You should update the "if
(!ufd_version_check())" part.

Thanks,
Laurent

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-02-01 13:11 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 01/13] migration: Allow migrate_fd_connect to take an Error * Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 02/13] migration: Route errors down through migration_channel_connect Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 03/13] migration/savevm.c: set MAX_VM_CMD_PACKAGED_SIZE to 1ul << 32 Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 04/13] migration: use s->threshold_size inside migration_update_counters Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 05/13] migration: Drop current address parameter from save_zero_page() Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 06/13] tests: Remove deprecated migration tests commands Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 07/13] tests: Consolidate accelerators declaration Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 08/13] tests: Use consistent names for migration Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 09/13] tests: Add deprecated commands migration test Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 10/13] tests: Add migration precopy test Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 11/13] tests: Add migration xbzrle test Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 12/13] tests: Create migrate-start-postcopy command Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 13/13] tests: Adjust sleeps for migration test Juan Quintela
2018-01-29 18:53 ` [Qemu-devel] [PULL 00/13] Migration PULL request Peter Maydell
2018-01-30  6:29   ` Juan Quintela
2018-02-01 13:10     ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.