Skip to contentSkip to conversation

migation: unbreak postcopy recovery

PATCH In review Peter Xu 4 participants 13 messages Jun 27, 2018 – Jul 6, 2018

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

v3 cover migation: unbreak postcopy recovery

v3:
- keep the recovery logic even for RDMA by dropping the 3rd patch and touch up the original 4th patch (current 3rd patch) to suite that [Dave]

v2:
- break the first patch into several
- fix a QEMUFile leak

Please review. Thanks,

Peter Xu (4):
migration: delay postcopy paused state
migration: move income process out of multifd
migration: unbreak postcopy recovery
migration: unify incoming processing

 migration/ram.h       |  2 +-
 migration/exec.c      |  3 ---
 migration/fd.c        |  3 ---
 migration/migration.c | 44 ++++++++++++++++++++++++++++++++++++-------
 migration/ram.c       | 11 +++++------
 migration/savevm.c    |  6 +++---
 migration/socket.c    |  5 -----
 7 files changed, 46 insertions(+), 28 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v3 1/4 migration: delay postcopy paused state

Before this patch we firstly setup the postcopy-paused state then we clean up the QEMUFile handles. That can be racy if there is a very fast "migrate-recover" command running in parallel. Fix that up.

---
 migration/savevm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
migration/savevm.c +3 -3
index c2f34ffc7c..851d74e8b6 100644
@@ -2194,9 +2194,6 @@ static bool postcopy_pause_incoming(MigrationIncomingState *mis)
     /* Clear the triggered bit to allow one recovery */
     mis->postcopy_recover_triggered = false;
 
-    migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE,
-                      MIGRATION_STATUS_POSTCOPY_PAUSED);
-
     assert(mis->from_src_file);
     qemu_file_shutdown(mis->from_src_file);
     qemu_fclose(mis->from_src_file);
@@ -2209,6 +2206,9 @@ static bool postcopy_pause_incoming(MigrationIncomingState *mis)
     mis->to_src_file = NULL;
     qemu_mutex_unlock(&mis->rp_mutex);
 
+    migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE,
+                      MIGRATION_STATUS_POSTCOPY_PAUSED);
+
     /* Notify the fault thread for the invalidated file handle */
     postcopy_fault_thread_notify(mis);
 
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v3 2/4 migration: move income process out of multifd

In reply to Peter Xu

Move the call to migration_incoming_process() out of multifd code. It's a bit strange that we can migration generic calls in multifd code. Instead, let multifd_recv_new_channel() return a boolean showing whether it's ready to continue the incoming migration.

---
 migration/ram.h       |  2 +-
 migration/migration.c |  5 ++++-
 migration/ram.c       | 11 +++++------
 3 files changed, 10 insertions(+), 8 deletions(-)
migration/ram.h +1 -1
index d386f4d641..457bf54b8c 100644
@@ -46,7 +46,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);
-void multifd_recv_new_channel(QIOChannel *ioc);
+bool multifd_recv_new_channel(QIOChannel *ioc);
 
 uint64_t ram_pagesize_summary(void);
 int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
migration/migration.c +4 -1
index e1eaa97df4..6ecea2de30 100644
@@ -507,7 +507,10 @@ void migration_ioc_process_incoming(QIOChannel *ioc)
         migration_incoming_setup(f);
         return;
     }
-    multifd_recv_new_channel(ioc);
+
+    if (multifd_recv_new_channel(ioc)) {
+        migration_incoming_process();
+    }
 }
 
 /**
migration/ram.c +5 -6
index cd5f55117d..52167d5142 100644
@@ -873,7 +873,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 multifd is ready for the migration, otherwise false */
+bool multifd_recv_new_channel(QIOChannel *ioc)
 {
     MultiFDRecvParams *p;
     Error *local_err = NULL;
@@ -882,7 +883,7 @@ void multifd_recv_new_channel(QIOChannel *ioc)
     id = multifd_recv_initial_packet(ioc, &local_err);
     if (id < 0) {
         multifd_recv_terminate_threads(local_err);
-        return;
+        return false;
     }
 
     p = &multifd_recv_state->params[id];
@@ -890,7 +891,7 @@ void multifd_recv_new_channel(QIOChannel *ioc)
         error_setg(&local_err, "multifd: received id '%d' already setup'",
                    id);
         multifd_recv_terminate_threads(local_err);
-        return;
+        return false;
     }
     p->c = ioc;
     object_ref(OBJECT(ioc));
@@ -899,9 +900,7 @@ 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();
 }
 
 /**
Signature · 1 line
2.17.1
Reviewed-by on v3 2/4
#3 lore raw

Re: [Qemu-devel] [PATCH v3 2/4] migration: move income process out of multifd

Quoted 6 lines · Peter Xu

Move the call to migration_incoming_process() out of multifd code. It's a bit strange that we can migration generic calls in multifd code. Instead, let multifd_recv_new_channel() return a boolean showing whether it's ready to continue the incoming migration.

author
#4 lore raw

PATCH v3 3/4 migration: unbreak postcopy recovery

In reply to Peter Xu

The whole postcopy recovery logic was accidentally broken. We need to fix it in two steps.

This is the first step that we should do the recovery when needed. It was bypassed before after commit 36c2f8be2c.

Introduce postcopy_try_recovery() helper for the postcopy recovery logic. Call it both in migration_fd_process_incoming() and migration_ioc_process_incoming().

Fixes 36c2f8be2c ("migration: Delay start of migration main routines")
---
 migration/migration.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
migration/migration.c +18 -5
index 6ecea2de30..0a0db49817 100644
@@ -466,7 +466,8 @@ void migration_incoming_process(void)
     qemu_coroutine_enter(co);
 }
 
-void migration_fd_process_incoming(QEMUFile *f)
+/* Returns true if recovered from a paused migration, otherwise false */
+static bool postcopy_try_recover(QEMUFile *f)
 {
     MigrationIncomingState *mis = migration_incoming_get_current();
 
@@ -491,11 +492,20 @@ void migration_fd_process_incoming(QEMUFile *f)
          * that source is ready to reply to page requests.
          */
         qemu_sem_post(&mis->postcopy_pause_sem_dst);
-    } else {
-        /* New incoming migration */
-        migration_incoming_setup(f);
-        migration_incoming_process();
+        return true;
+    }
+
+    return false;
+}
+
+void migration_fd_process_incoming(QEMUFile *f)
+{
+    if (postcopy_try_recover(f)) {
+        return;
     }
+
+    migration_incoming_setup(f);
+    migration_incoming_process();
 }
 
 void migration_ioc_process_incoming(QIOChannel *ioc)
@@ -504,6 +514,9 @@ void migration_ioc_process_incoming(QIOChannel *ioc)
 
     if (!mis->from_src_file) {
         QEMUFile *f = qemu_fopen_channel_input(ioc);
+        if (postcopy_try_recover(f)) {
+            return;
+        }
         migration_incoming_setup(f);
         return;
     }
Signature · 1 line
2.17.1
Reviewed-by on v3 3/4
#5 lore raw

Re: [Qemu-devel] [PATCH v3 3/4] migration: unbreak postcopy recovery

Quoted 6 lines · Peter Xu

The whole postcopy recovery logic was accidentally broken. We need to fix it in two steps.

This is the first step that we should do the recovery when needed. It was bypassed before after commit 36c2f8be2c.

Quoted 6 lines

Introduce postcopy_try_recovery() helper for the postcopy recovery logic. Call it both in migration_fd_process_incoming() and migration_ioc_process_incoming().

Fixes 36c2f8be2c ("migration: Delay start of migration main routines")
author
#6 lore raw

PATCH v3 4/4 migration: unify incoming processing

In reply to Peter Xu

This is the 2nd patch to unbreak postcopy recovery.

Let's unify the migration_incoming_process() call at a single place rather than calling it in connection setup codes. This fixes a problem that we will go into incoming migration procedure even if we are trying to recovery from a paused postcopy migration.

Fixes 36c2f8be2c ("migration: Delay start of migration main routines")
---
 migration/exec.c      |  3 ---
 migration/fd.c        |  3 ---
 migration/migration.c | 18 ++++++++++++++++--
 migration/socket.c    |  5 -----
 4 files changed, 16 insertions(+), 13 deletions(-)
migration/exec.c +0 -3
index 0bbeb63c97..375d2e1b54 100644
@@ -49,9 +49,6 @@ 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 +0 -3
index fee34ffdc0..a7c13df4ad 100644
@@ -49,9 +49,6 @@ 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;
 }
 
migration/migration.c +16 -2
index 0a0db49817..7fc92327d7 100644
@@ -511,17 +511,31 @@ void migration_fd_process_incoming(QEMUFile *f)
 void migration_ioc_process_incoming(QIOChannel *ioc)
 {
     MigrationIncomingState *mis = migration_incoming_get_current();
+    bool start_migration;
 
     if (!mis->from_src_file) {
+        /* The first connection (multifd may have multiple) */
         QEMUFile *f = qemu_fopen_channel_input(ioc);
+
+        /* If it's a recovery, we're done */
         if (postcopy_try_recover(f)) {
             return;
         }
+
         migration_incoming_setup(f);
-        return;
+
+        /*
+         * Common migration only needs one channel, so we can start
+         * right now.  Multifd needs more than one channel, we wait.
+         */
+        start_migration = !migrate_use_multifd();
+    } else {
+        /* Multiple connections */
+        assert(migrate_use_multifd());
+        start_migration = multifd_recv_new_channel(ioc);
     }
 
-    if (multifd_recv_new_channel(ioc)) {
+    if (start_migration) {
         migration_incoming_process();
     }
 }
migration/socket.c +0 -5
index 3456eb76e9..f4c8174400 100644
@@ -168,12 +168,7 @@ static void socket_accept_incoming_migration(QIONetListener *listener,
     if (migration_has_all_channels()) {
         /* Close listening socket as its no longer needed */
         qio_net_listener_disconnect(listener);
-
         object_unref(OBJECT(listener));
-
-        if (!migrate_use_multifd()) {
-            migration_incoming_process();
-        }
     }
 }
 
Signature · 1 line
2.17.1
Reviewed-by on v3 4/4
#7 lore raw

Re: [Qemu-devel] [PATCH v3 4/4] migration: unify incoming processing

Quoted 9 lines · Peter Xu

This is the 2nd patch to unbreak postcopy recovery.

Let's unify the migration_incoming_process() call at a single place rather than calling it in connection setup codes. This fixes a problem that we will go into incoming migration procedure even if we are trying to recovery from a paused postcopy migration.

Fixes 36c2f8be2c ("migration: Delay start of migration main routines")
#8 lore raw
In reply to Peter Xu
Quoted 9 lines · Peter Xu

v3:
- keep the recovery logic even for RDMA by dropping the 3rd patch and touch up the original 4th patch (current 3rd patch) to suite that [Dave]

v2:
- break the first patch into several
- fix a QEMUFile leak

Please review. Thanks,

Hi Peter,

I have applied this patchset with upstream Qemu for testing postcopy pause recover feature in PowerPC,

I used NFS shared qcow2 between source and target host

source:

# ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -vga none \
-machine pseries -m 64G,slots=128,maxmem=128G -smp 16,maxcpus=32 \
-device virtio-blk-pci,drive=rootdisk -drive \
file=/home/bala/sharing/hostos-ppc64le.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \
-monitor telnet:127.0.0.1:1234,server,nowait -net nic,model=virtio \
-net user -redir tcp:2000::22

To keep the VM with workload I ran stress-ng inside guest,

# stress-ng --cpu 6 --vm 6 --io 6

target:

# ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -vga none \
-machine pseries -m 64G,slots=128,maxmem=128G -smp 16,maxcpus=32 \
-device virtio-blk-pci,drive=rootdisk -drive \
file=/home/bala/sharing/hostos-ppc64le.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \
-monitor telnet:127.0.0.1:1235,server,nowait -net nic,model=virtio \
-net user -redir tcp:2001::22 -incoming tcp:0:4445

enabled postcopy on both source and destination from qemu monitor

(qemu) migrate_set_capability postcopy-ram on

Quoted 1 line

From source qemu monitor,

(qemu) migrate -d tcp:10.45.70.203:4445
(qemu) info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off
zero-blocks: off compress: off events: off postcopy-ram: on x-colo: off
release-ram: off block: off return-path: off pause-before-switchover:
off x-multifd: off dirty-bitmaps: off postcopy-blocktime: off
late-block-activate: off
Migration status: active
total time: 2331 milliseconds
expected downtime: 300 milliseconds
setup: 65 milliseconds
transferred ram: 38914 kbytes
throughput: 273.16 mbps
remaining ram: 67063784 kbytes
total ram: 67109120 kbytes
duplicate: 1627 pages
skipped: 0 pages
normal: 9706 pages
normal bytes: 38824 kbytes
dirty sync count: 1
page size: 4 kbytes
multifd bytes: 0 kbytes

triggered postcopy from source,
(qemu) migrate_start_postcopy

After triggering postcopy from source, in target I tried to pause the postcopy migration

(qemu) migrate_pause

In target I see error as,
error while loading state section id 4(ram)
qemu-system-ppc64: Detected IO failure for postcopy. Migration paused.

In source I see error as,
qemu-system-ppc64: Detected IO failure for postcopy. Migration paused.

Later from target I try for recovery from target monitor, (qemu) migrate_recover qemu+ssh://10.45.70.203/system Migrate recovery is triggered already

but in source still it remains to be in postcopy-paused state (qemu) info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off
zero-blocks: off compress: off events: off postcopy-ram: on x-colo: off
release-ram: off block: off return-path: off pause-before-switchover:
off x-multifd: off dirty-bitmaps: off postcopy-blocktime: off
late-block-activate: off
Migration status: postcopy-paused
total time: 222841 milliseconds
expected downtime: 382991 milliseconds
setup: 65 milliseconds
transferred ram: 385270 kbytes
throughput: 265.06 mbps
remaining ram: 8150528 kbytes
total ram: 67109120 kbytes
duplicate: 14679647 pages
skipped: 0 pages
normal: 63937 pages
normal bytes: 255748 kbytes
dirty sync count: 2
page size: 4 kbytes
multifd bytes: 0 kbytes
dirty pages rate: 854740 pages
postcopy request count: 374

later I also tried to recover postcopy in source monitor, (qemu) migrate_recover qemu+ssh://10.45.193.21/system Migrate recover can only be run when postcopy is paused.

Looks to be it is broken, please help me if I missed something in this test.

Thank you,
Bala

Quoted 20 lines

Peter Xu (4):
migration: delay postcopy paused state
migration: move income process out of multifd
migration: unbreak postcopy recovery
migration: unify incoming processing

 migration/ram.h       |  2 +-
 migration/exec.c      |  3 ---
 migration/fd.c        |  3 ---
 migration/migration.c | 44 ++++++++++++++++++++++++++++++++++++-------
 migration/ram.c       | 11 +++++------
 migration/savevm.c    |  6 +++---
 migration/socket.c    |  5 -----
 7 files changed, 46 insertions(+), 28 deletions(-)
Signature · 1 line
2.17.1
author
#9 lore raw
Quoted 11 lines · Balamuruhan S
Quoted 9 lines · Peter Xu

v3:
- keep the recovery logic even for RDMA by dropping the 3rd patch and touch up the original 4th patch (current 3rd patch) to suite that [Dave]

v2:
- break the first patch into several
- fix a QEMUFile leak

Please review. Thanks,

Hi Peter,

Hi, Balamuruhan,

Glad to know that you are playing this stuff with ppc. I think the major steps are correct, though...

Quoted 26 lines

I have applied this patchset with upstream Qemu for testing postcopy pause recover feature in PowerPC,

I used NFS shared qcow2 between source and target host

source:

# ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -vga none \
(quoted diff) +0 -2
-machine pseries -m 64G,slots=128,maxmem=128G -smp 16,maxcpus=32 \
-device virtio-blk-pci,drive=rootdisk -drive \

file=/home/bala/sharing/hostos-ppc64le.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \

(quoted diff) +0 -2
-monitor telnet:127.0.0.1:1234,server,nowait -net nic,model=virtio \
-net user -redir tcp:2000::22

To keep the VM with workload I ran stress-ng inside guest,

# stress-ng --cpu 6 --vm 6 --io 6

target:

# ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -vga none \
(quoted diff) +0 -2
-machine pseries -m 64G,slots=128,maxmem=128G -smp 16,maxcpus=32 \
-device virtio-blk-pci,drive=rootdisk -drive \

file=/home/bala/sharing/hostos-ppc64le.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \

(quoted diff) +0 -2
-monitor telnet:127.0.0.1:1235,server,nowait -net nic,model=virtio \
-net user -redir tcp:2001::22 -incoming tcp:0:4445
Quoted 6 lines

enabled postcopy on both source and destination from qemu monitor

(qemu) migrate_set_capability postcopy-ram on

From source qemu monitor,
(qemu) migrate -d tcp:10.45.70.203:4445

[1]

Quoted 40 lines

(qemu) info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off
zero-blocks: off compress: off events: off postcopy-ram: on x-colo: off
release-ram: off block: off return-path: off pause-before-switchover:
off x-multifd: off dirty-bitmaps: off postcopy-blocktime: off
late-block-activate: off
Migration status: active
total time: 2331 milliseconds
expected downtime: 300 milliseconds
setup: 65 milliseconds
transferred ram: 38914 kbytes
throughput: 273.16 mbps
remaining ram: 67063784 kbytes
total ram: 67109120 kbytes
duplicate: 1627 pages
skipped: 0 pages
normal: 9706 pages
normal bytes: 38824 kbytes
dirty sync count: 1
page size: 4 kbytes
multifd bytes: 0 kbytes

triggered postcopy from source,
(qemu) migrate_start_postcopy

After triggering postcopy from source, in target I tried to pause the postcopy migration

(qemu) migrate_pause

In target I see error as,
error while loading state section id 4(ram)
qemu-system-ppc64: Detected IO failure for postcopy. Migration paused.

Quoted 5 lines

In source I see error as,
qemu-system-ppc64: Detected IO failure for postcopy. Migration paused.

Later from target I try for recovery from target monitor, (qemu) migrate_recover qemu+ssh://10.45.70.203/system

... here is that URI for libvirt only?

Normally I'll use something similar to [1] above.

Quoted 1 line

Migrate recovery is triggered already

And this means that you have already sent one recovery command before hand. In the future we'd better allow the recovery command to be run more than once (in case the first one mistyped...).

Quoted 32 lines

but in source still it remains to be in postcopy-paused state (qemu) info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off
zero-blocks: off compress: off events: off postcopy-ram: on x-colo: off
release-ram: off block: off return-path: off pause-before-switchover:
off x-multifd: off dirty-bitmaps: off postcopy-blocktime: off
late-block-activate: off
Migration status: postcopy-paused
total time: 222841 milliseconds
expected downtime: 382991 milliseconds
setup: 65 milliseconds
transferred ram: 385270 kbytes
throughput: 265.06 mbps
remaining ram: 8150528 kbytes
total ram: 67109120 kbytes
duplicate: 14679647 pages
skipped: 0 pages
normal: 63937 pages
normal bytes: 255748 kbytes
dirty sync count: 2
page size: 4 kbytes
multifd bytes: 0 kbytes
dirty pages rate: 854740 pages
postcopy request count: 374

Quoted 2 lines

later I also tried to recover postcopy in source monitor, (qemu) migrate_recover qemu+ssh://10.45.193.21/system

This command should be run on destination side only. Here the "migrate-recover" command on destination will start a new listening port there waiting for the migration to be continued. Then after that command we need an extra command on source to start the recovery:

(HMP) migrate -r $URI

Here $URI should be the only you specified in the "migrate-recover" command on destination machine.

Quoted 1 line

Migrate recover can only be run when postcopy is paused.

I can try to fix up this error. Basically we shouldn't allow this command to be run on source machine.

Quoted 3 lines

Looks to be it is broken, please help me if I missed something in this test.

Btw, I'm writting up an unit test for postcopy recovery recently, that could be a good reference for the new feature. Meanwhile I think I should write up some documents too afterwards.

Regards,

Quoted 24 lines

Thank you,
Bala

Quoted 20 lines

Peter Xu (4):
migration: delay postcopy paused state
migration: move income process out of multifd
migration: unbreak postcopy recovery
migration: unify incoming processing

 migration/ram.h       |  2 +-
 migration/exec.c      |  3 ---
 migration/fd.c        |  3 ---
 migration/migration.c | 44 ++++++++++++++++++++++++++++++++++++-------
 migration/ram.c       | 11 +++++------
 migration/savevm.c    |  6 +++---
 migration/socket.c    |  5 -----
 7 files changed, 46 insertions(+), 28 deletions(-)
Signature · 1 line
2.17.1
Signature · 1 line
Peter Xu
Tested-by
#10 lore raw
Quoted 10 lines · Peter Xu
Quoted 9 lines · Balamuruhan S
Quoted 8 lines · Peter Xu

v3:
- keep the recovery logic even for RDMA by dropping the 3rd patch and touch up the original 4th patch (current 3rd patch) to suite that [Dave]

v2:
- break the first patch into several
- fix a QEMUFile leak

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

Please review. Thanks,

Hi Peter,

Hi, Balamuruhan,

Glad to know that you are playing this stuff with ppc. I think the major steps are correct, though...

Thank you Peter for correcting my mistake, It works like a charm. Nice feature!

Quoted 133 lines
Quoted 26 lines

I have applied this patchset with upstream Qemu for testing postcopy pause recover feature in PowerPC,

I used NFS shared qcow2 between source and target host

source:

# ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -vga none \
(quoted diff) +0 -2
-machine pseries -m 64G,slots=128,maxmem=128G -smp 16,maxcpus=32 \
-device virtio-blk-pci,drive=rootdisk -drive \

file=/home/bala/sharing/hostos-ppc64le.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \

(quoted diff) +0 -2
-monitor telnet:127.0.0.1:1234,server,nowait -net nic,model=virtio \
-net user -redir tcp:2000::22

To keep the VM with workload I ran stress-ng inside guest,

# stress-ng --cpu 6 --vm 6 --io 6

target:

# ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -vga none \
(quoted diff) +0 -2
-machine pseries -m 64G,slots=128,maxmem=128G -smp 16,maxcpus=32 \
-device virtio-blk-pci,drive=rootdisk -drive \

file=/home/bala/sharing/hostos-ppc64le.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \

(quoted diff) +0 -2
-monitor telnet:127.0.0.1:1235,server,nowait -net nic,model=virtio \
-net user -redir tcp:2001::22 -incoming tcp:0:4445
Quoted 6 lines

enabled postcopy on both source and destination from qemu monitor

(qemu) migrate_set_capability postcopy-ram on

From source qemu monitor,
(qemu) migrate -d tcp:10.45.70.203:4445

[1]

Quoted 40 lines

(qemu) info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off
zero-blocks: off compress: off events: off postcopy-ram: on x-colo: off
release-ram: off block: off return-path: off pause-before-switchover:
off x-multifd: off dirty-bitmaps: off postcopy-blocktime: off
late-block-activate: off
Migration status: active
total time: 2331 milliseconds
expected downtime: 300 milliseconds
setup: 65 milliseconds
transferred ram: 38914 kbytes
throughput: 273.16 mbps
remaining ram: 67063784 kbytes
total ram: 67109120 kbytes
duplicate: 1627 pages
skipped: 0 pages
normal: 9706 pages
normal bytes: 38824 kbytes
dirty sync count: 1
page size: 4 kbytes
multifd bytes: 0 kbytes

triggered postcopy from source,
(qemu) migrate_start_postcopy

After triggering postcopy from source, in target I tried to pause the postcopy migration

(qemu) migrate_pause

In target I see error as,
error while loading state section id 4(ram)
qemu-system-ppc64: Detected IO failure for postcopy. Migration paused.

Quoted 5 lines

In source I see error as,
qemu-system-ppc64: Detected IO failure for postcopy. Migration paused.

Later from target I try for recovery from target monitor, (qemu) migrate_recover qemu+ssh://10.45.70.203/system

... here is that URI for libvirt only?

Normally I'll use something similar to [1] above.

Quoted 1 line

Migrate recovery is triggered already

And this means that you have already sent one recovery command before hand. In the future we'd better allow the recovery command to be run more than once (in case the first one mistyped...).

Quoted 32 lines

but in source still it remains to be in postcopy-paused state (qemu) info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off
zero-blocks: off compress: off events: off postcopy-ram: on x-colo: off
release-ram: off block: off return-path: off pause-before-switchover:
off x-multifd: off dirty-bitmaps: off postcopy-blocktime: off
late-block-activate: off
Migration status: postcopy-paused
total time: 222841 milliseconds
expected downtime: 382991 milliseconds
setup: 65 milliseconds
transferred ram: 385270 kbytes
throughput: 265.06 mbps
remaining ram: 8150528 kbytes
total ram: 67109120 kbytes
duplicate: 14679647 pages
skipped: 0 pages
normal: 63937 pages
normal bytes: 255748 kbytes
dirty sync count: 2
page size: 4 kbytes
multifd bytes: 0 kbytes
dirty pages rate: 854740 pages
postcopy request count: 374

Quoted 2 lines

later I also tried to recover postcopy in source monitor, (qemu) migrate_recover qemu+ssh://10.45.193.21/system

This command should be run on destination side only. Here the "migrate-recover" command on destination will start a new listening port there waiting for the migration to be continued. Then after that command we need an extra command on source to start the recovery:

(HMP) migrate -r $URI

Quoted 7 lines

Here $URI should be the only you specified in the "migrate-recover" command on destination machine.

Quoted 1 line

Migrate recover can only be run when postcopy is paused.

I can try to fix up this error. Basically we shouldn't allow this command to be run on source machine.

Sure, :+1:

Quoted 8 lines
Quoted 4 lines

Looks to be it is broken, please help me if I missed something in this test.

Btw, I'm writting up an unit test for postcopy recovery recently, that could be a good reference for the new feature. Meanwhile I think I should write up some documents too afterwards.

fine, I am also working on writing test scenario in tp-qemu using Avocado-VT for postcopy pause/recover and multifd features.

-- Bala

Quoted 31 lines

Regards,

Quoted 24 lines

Thank you,
Bala

Quoted 20 lines

Peter Xu (4):
migration: delay postcopy paused state
migration: move income process out of multifd
migration: unbreak postcopy recovery
migration: unify incoming processing

 migration/ram.h       |  2 +-
 migration/exec.c      |  3 ---
 migration/fd.c        |  3 ---
 migration/migration.c | 44 ++++++++++++++++++++++++++++++++++++-------
 migration/ram.c       | 11 +++++------
 migration/savevm.c    |  6 +++---
 migration/socket.c    |  5 -----
 7 files changed, 46 insertions(+), 28 deletions(-)
Signature · 1 line
2.17.1
Signature · 1 line
Peter Xu
author
#11 lore raw
Quoted 16 lines · Balamuruhan S
Quoted 15 lines · Peter Xu
Quoted 11 lines · Balamuruhan S
Quoted 9 lines · Peter Xu

v3:
- keep the recovery logic even for RDMA by dropping the 3rd patch and touch up the original 4th patch (current 3rd patch) to suite that [Dave]

v2:
- break the first patch into several
- fix a QEMUFile leak

Please review. Thanks,

Hi Peter,

Hi, Balamuruhan,

Quoted 8 lines
Quoted 3 lines

Glad to know that you are playing this stuff with ppc. I think the major steps are correct, though...

Thank you Peter for correcting my mistake, It works like a charm. Nice feature!

Thanks! Good to know that it worked.

Quoted 149 lines
Quoted 134 lines
Quoted 27 lines

I have applied this patchset with upstream Qemu for testing postcopy pause recover feature in PowerPC,

I used NFS shared qcow2 between source and target host

source:

# ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -vga none \
(quoted diff) +0 -2
-machine pseries -m 64G,slots=128,maxmem=128G -smp 16,maxcpus=32 \
-device virtio-blk-pci,drive=rootdisk -drive \

file=/home/bala/sharing/hostos-ppc64le.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \

(quoted diff) +0 -2
-monitor telnet:127.0.0.1:1234,server,nowait -net nic,model=virtio \
-net user -redir tcp:2000::22

To keep the VM with workload I ran stress-ng inside guest,

# stress-ng --cpu 6 --vm 6 --io 6

target:

# ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -vga none \
(quoted diff) +0 -2
-machine pseries -m 64G,slots=128,maxmem=128G -smp 16,maxcpus=32 \
-device virtio-blk-pci,drive=rootdisk -drive \

file=/home/bala/sharing/hostos-ppc64le.qcow2,if=none,cache=none,format=qcow2,id=rootdisk \

(quoted diff) +0 -2
-monitor telnet:127.0.0.1:1235,server,nowait -net nic,model=virtio \
-net user -redir tcp:2001::22 -incoming tcp:0:4445
Quoted 6 lines

enabled postcopy on both source and destination from qemu monitor

(qemu) migrate_set_capability postcopy-ram on

From source qemu monitor,
(qemu) migrate -d tcp:10.45.70.203:4445

[1]

Quoted 40 lines

(qemu) info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off
zero-blocks: off compress: off events: off postcopy-ram: on x-colo: off
release-ram: off block: off return-path: off pause-before-switchover:
off x-multifd: off dirty-bitmaps: off postcopy-blocktime: off
late-block-activate: off
Migration status: active
total time: 2331 milliseconds
expected downtime: 300 milliseconds
setup: 65 milliseconds
transferred ram: 38914 kbytes
throughput: 273.16 mbps
remaining ram: 67063784 kbytes
total ram: 67109120 kbytes
duplicate: 1627 pages
skipped: 0 pages
normal: 9706 pages
normal bytes: 38824 kbytes
dirty sync count: 1
page size: 4 kbytes
multifd bytes: 0 kbytes

triggered postcopy from source,
(qemu) migrate_start_postcopy

After triggering postcopy from source, in target I tried to pause the postcopy migration

(qemu) migrate_pause

In target I see error as,
error while loading state section id 4(ram)
qemu-system-ppc64: Detected IO failure for postcopy. Migration paused.

Quoted 5 lines

In source I see error as,
qemu-system-ppc64: Detected IO failure for postcopy. Migration paused.

Later from target I try for recovery from target monitor, (qemu) migrate_recover qemu+ssh://10.45.70.203/system

... here is that URI for libvirt only?

Normally I'll use something similar to [1] above.

Quoted 1 line

Migrate recovery is triggered already

And this means that you have already sent one recovery command before hand. In the future we'd better allow the recovery command to be run more than once (in case the first one mistyped...).

Quoted 32 lines

but in source still it remains to be in postcopy-paused state (qemu) info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off
zero-blocks: off compress: off events: off postcopy-ram: on x-colo: off
release-ram: off block: off return-path: off pause-before-switchover:
off x-multifd: off dirty-bitmaps: off postcopy-blocktime: off
late-block-activate: off
Migration status: postcopy-paused
total time: 222841 milliseconds
expected downtime: 382991 milliseconds
setup: 65 milliseconds
transferred ram: 385270 kbytes
throughput: 265.06 mbps
remaining ram: 8150528 kbytes
total ram: 67109120 kbytes
duplicate: 14679647 pages
skipped: 0 pages
normal: 63937 pages
normal bytes: 255748 kbytes
dirty sync count: 2
page size: 4 kbytes
multifd bytes: 0 kbytes
dirty pages rate: 854740 pages
postcopy request count: 374

Quoted 2 lines

later I also tried to recover postcopy in source monitor, (qemu) migrate_recover qemu+ssh://10.45.193.21/system

This command should be run on destination side only. Here the "migrate-recover" command on destination will start a new listening port there waiting for the migration to be continued. Then after that command we need an extra command on source to start the recovery:

(HMP) migrate -r $URI

Quoted 7 lines

Here $URI should be the only you specified in the "migrate-recover" command on destination machine.

Quoted 1 line

Migrate recover can only be run when postcopy is paused.

I can try to fix up this error. Basically we shouldn't allow this command to be run on source machine.

Sure, :+1:

Quoted 5 lines
Quoted 4 lines

Looks to be it is broken, please help me if I missed something in this test.

Quoted 6 lines
Quoted 3 lines

Btw, I'm writting up an unit test for postcopy recovery recently, that could be a good reference for the new feature. Meanwhile I think I should write up some documents too afterwards.

fine, I am also working on writing test scenario in tp-qemu using Avocado-VT for postcopy pause/recover and multifd features.

Nice! I don't know avocado much inside, but definitely it'll be good if we have more tests to cover it so we'll know its breakage asap (and the same applies to multifd for sure).

Regards,

Signature · 1 line
Peter Xu
#12 lore raw
In reply to Peter Xu

Queued

Quoted 16 lines · * Peter Xu ([email protected]) wrote:

v3:
- keep the recovery logic even for RDMA by dropping the 3rd patch and touch up the original 4th patch (current 3rd patch) to suite that [Dave]

v2:
- break the first patch into several
- fix a QEMUFile leak

Please review. Thanks,

Peter Xu (4):
migration: delay postcopy paused state
migration: move income process out of multifd
migration: unbreak postcopy recovery
migration: unify incoming processing

Quoted 13 lines
 migration/ram.h       |  2 +-
 migration/exec.c      |  3 ---
 migration/fd.c        |  3 ---
 migration/migration.c | 44 ++++++++++++++++++++++++++++++++++++-------
 migration/ram.c       | 11 +++++------
 migration/savevm.c    |  6 +++---
 migration/socket.c    |  5 -----
 7 files changed, 46 insertions(+), 28 deletions(-)
Signature · 1 line
2.17.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK