Skip to contentSkip to conversation

Postcopy implementation

PATCH Bharata B Rao 3 participants 15 messages Sep 30, 2015 – Oct 20, 2015 15 messages not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 12 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

This is the 8th cut of my version of postcopy.

The userfaultfd linux kernel code is now in the upstream kernel tree, and so 4.3-rc3 can be used without modification.

This qemu series can be found at:
https://github.com/orbitfp7/qemu.git
on the wp3-postcopy-v8 tag

Quoted 5 lines

Testing status:
* Tested heavily on x86
* Smoke tested on aarch64 (so it does work on different page sizes)
* Power is unhappy for me (but gets further than the htab problem v7 used to have) (I get a kvm run failed)

Seems to be completing successfully on Power. But it takes 2min for the migration status to transition from setup to active.

Host: 4.3.0-rc3+
Guest: 4.3.0-rc3+
QEMU: wp3-postcopy-v8 of your tree.

# ./ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -machine pseries -m 8G,slots=32,maxmem=32G -device virtio-blk-pci,drive=rootdisk -drive file=/home/bharata/F20-snap1,if=none,cache=none,id=rootdisk,format=qcow2 -vga none -net nic,model=virtio -net user -redir tcp:2000::22 -smp 16,maxcpus=32 -serial pty

(qemu) migrate_set_capability x-postcopy-ram on
(qemu) migrate -d tcp:localhost:4444
(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: setup
total time: 0 milliseconds

same status for around 2min...

(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: active
total time: 130089 milliseconds
expected downtime: 300 milliseconds
setup: 24 milliseconds
transferred ram: 79454 kbytes
throughput: 50.09 mbps
remaining ram: 7670688 kbytes
total ram: 8388864 kbytes
duplicate: 160684 pages
skipped: 0 pages
normal: 18860 pages
normal bytes: 75440 kbytes
dirty sync count: 1

(qemu) migrate_start_postcopy

(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: postcopy-active
total time: 135627 milliseconds
expected downtime: 43 milliseconds
setup: 24 milliseconds
transferred ram: 338598 kbytes
throughput: 74.02 mbps
remaining ram: 1688384 kbytes
total ram: 8388864 kbytes
duplicate: 1600406 pages
skipped: 0 pages
normal: 75258 pages
normal bytes: 301032 kbytes
dirty sync count: 0
dirty pages rate: 98 pages

(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: completed
total time: 136898 milliseconds
downtime: 685 milliseconds
setup: 24 milliseconds
transferred ram: 1194196 kbytes
throughput: 72.00 mbps
remaining ram: 0 kbytes
total ram: 8388864 kbytes
duplicate: 1810921 pages
skipped: 0 pages
normal: 286839 pages
normal bytes: 1147356 kbytes
dirty sync count: 2

#2 lore raw
Quoted 28 lines · * Bharata B Rao ([email protected]) wrote:
Quoted 12 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

This is the 8th cut of my version of postcopy.

The userfaultfd linux kernel code is now in the upstream kernel tree, and so 4.3-rc3 can be used without modification.

This qemu series can be found at:
https://github.com/orbitfp7/qemu.git
on the wp3-postcopy-v8 tag

Quoted 5 lines

Testing status:
* Tested heavily on x86
* Smoke tested on aarch64 (so it does work on different page sizes)
* Power is unhappy for me (but gets further than the htab problem v7 used to have) (I get a kvm run failed)

Seems to be completing successfully on Power. But it takes 2min for the migration status to transition from setup to active.

Host: 4.3.0-rc3+
Guest: 4.3.0-rc3+
QEMU: wp3-postcopy-v8 of your tree.

# ./ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -machine pseries -m 8G,slots=32,maxmem=32G -device virtio-blk-pci,drive=rootdisk -drive file=/home/bharata/F20-snap1,if=none,cache=none,id=rootdisk,format=qcow2 -vga none -net nic,model=virtio -net user -redir tcp:2000::22 -smp 16,maxcpus=32 -serial pty
Quoted 8 lines

(qemu) migrate_set_capability x-postcopy-ram on
(qemu) migrate -d tcp:localhost:4444
(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: setup
total time: 0 milliseconds

same status for around 2min...

That's interesting; I saw that behaviour on my aarch64 box, but not on my power box or on x86. Can you try using tcp:127.0.0.1:4444 to force ipv4 (that fixed it for me on aarch64). On the aarch box I found that it still happened with head of tree qemu and so decided it wasn't my postcopy world; I'm assuming what's happening is that it's trying to connect to the IPv6 address, timing out and then trying IPv4.

Quoted 35 lines

(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: active
total time: 130089 milliseconds
expected downtime: 300 milliseconds
setup: 24 milliseconds
transferred ram: 79454 kbytes
throughput: 50.09 mbps
remaining ram: 7670688 kbytes
total ram: 8388864 kbytes
duplicate: 160684 pages
skipped: 0 pages
normal: 18860 pages
normal bytes: 75440 kbytes
dirty sync count: 1

(qemu) migrate_start_postcopy

(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: postcopy-active
total time: 135627 milliseconds
expected downtime: 43 milliseconds
setup: 24 milliseconds
transferred ram: 338598 kbytes
throughput: 74.02 mbps
remaining ram: 1688384 kbytes
total ram: 8388864 kbytes
duplicate: 1600406 pages
skipped: 0 pages
normal: 75258 pages
normal bytes: 301032 kbytes
dirty sync count: 0
dirty pages rate: 98 pages

Quoted 15 lines

(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: completed
total time: 136898 milliseconds
downtime: 685 milliseconds
setup: 24 milliseconds
transferred ram: 1194196 kbytes
throughput: 72.00 mbps
remaining ram: 0 kbytes
total ram: 8388864 kbytes
duplicate: 1810921 pages
skipped: 0 pages
normal: 286839 pages
normal bytes: 1147356 kbytes
dirty sync count: 2

Great; is the guest happy?

Dave

Quoted 1 line

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

#3 lore raw
Quoted 36 lines · Dr. David Alan Gilbert
Quoted 35 lines · * Bharata B Rao ([email protected]) wrote:
Quoted 12 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

This is the 8th cut of my version of postcopy.

The userfaultfd linux kernel code is now in the upstream kernel tree, and so 4.3-rc3 can be used without modification.

This qemu series can be found at:
https://github.com/orbitfp7/qemu.git
on the wp3-postcopy-v8 tag

Quoted 5 lines

Testing status:
* Tested heavily on x86
* Smoke tested on aarch64 (so it does work on different page sizes)
* Power is unhappy for me (but gets further than the htab problem v7 used to have) (I get a kvm run failed)

Seems to be completing successfully on Power. But it takes 2min for the migration status to transition from setup to active.

Host: 4.3.0-rc3+
Guest: 4.3.0-rc3+
QEMU: wp3-postcopy-v8 of your tree.

# ./ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -machine pseries -m 8G,slots=32,maxmem=32G -device virtio-blk-pci,drive=rootdisk -drive file=/home/bharata/F20-snap1,if=none,cache=none,id=rootdisk,format=qcow2 -vga none -net nic,model=virtio -net user -redir tcp:2000::22 -smp 16,maxcpus=32 -serial pty

(qemu) migrate_set_capability x-postcopy-ram on
(qemu) migrate -d tcp:localhost:4444
(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: setup
total time: 0 milliseconds

Quoted 8 lines
Quoted 1 line

same status for around 2min...

That's interesting; I saw that behaviour on my aarch64 box, but not on my power box or on x86. Can you try using tcp:127.0.0.1:4444 to force ipv4 (that fixed it for me on aarch64). On the aarch box I found that it still happened with head of tree qemu and so decided it wasn't my postcopy world; I'm assuming what's happening is that it's trying to connect to the IPv6 address, timing out and then trying IPv4.

Yes, s/localhost/127.0.0.1 helps.

Quoted 2 lines

Great; is the guest happy?

Yes, survived a reboot, postcopy migration back to the original host and then a reboot.

Regards,
Bharata.

#4 lore raw
Quoted 39 lines · * Bharata B Rao ([email protected]) wrote:
Quoted 38 lines · Dr. David Alan Gilbert
Quoted 36 lines · * Bharata B Rao ([email protected]) wrote:
Quoted 12 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

This is the 8th cut of my version of postcopy.

The userfaultfd linux kernel code is now in the upstream kernel tree, and so 4.3-rc3 can be used without modification.

This qemu series can be found at:
https://github.com/orbitfp7/qemu.git
on the wp3-postcopy-v8 tag

Quoted 5 lines

Testing status:
* Tested heavily on x86
* Smoke tested on aarch64 (so it does work on different page sizes)
* Power is unhappy for me (but gets further than the htab problem v7 used to have) (I get a kvm run failed)

Seems to be completing successfully on Power. But it takes 2min for the migration status to transition from setup to active.

Host: 4.3.0-rc3+
Guest: 4.3.0-rc3+
QEMU: wp3-postcopy-v8 of your tree.

# ./ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -machine pseries -m 8G,slots=32,maxmem=32G -device virtio-blk-pci,drive=rootdisk -drive file=/home/bharata/F20-snap1,if=none,cache=none,id=rootdisk,format=qcow2 -vga none -net nic,model=virtio -net user -redir tcp:2000::22 -smp 16,maxcpus=32 -serial pty

(qemu) migrate_set_capability x-postcopy-ram on
(qemu) migrate -d tcp:localhost:4444
(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: setup
total time: 0 milliseconds

same status for around 2min...

Quoted 8 lines
Quoted 6 lines

That's interesting; I saw that behaviour on my aarch64 box, but not on my power box or on x86. Can you try using tcp:127.0.0.1:4444 to force ipv4 (that fixed it for me on aarch64). On the aarch box I found that it still happened with head of tree qemu and so decided it wasn't my postcopy world; I'm assuming what's happening is that it's trying to connect to the IPv6 address, timing out and then trying IPv4.

Yes, s/localhost/127.0.0.1 helps.

OK; it sounds like there's something 'fun' going on with either the bleeding edge kernel or the bleeding edge qemu with IPv6 then.

Quoted 5 lines
Quoted 2 lines

Great; is the guest happy?

Yes, survived a reboot, postcopy migration back to the original host and then a reboot.

OK, great.

Dave

Quoted 3 lines

Regards,
Bharata.

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

#5 lore raw
Quoted 47 lines · Dr. David Alan Gilbert
Quoted 46 lines · * Bharata B Rao ([email protected]) wrote:
Quoted 44 lines · Dr. David Alan Gilbert
Quoted 28 lines · * Bharata B Rao ([email protected]) wrote:
Quoted 12 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

This is the 8th cut of my version of postcopy.

The userfaultfd linux kernel code is now in the upstream kernel tree, and so 4.3-rc3 can be used without modification.

This qemu series can be found at:
https://github.com/orbitfp7/qemu.git
on the wp3-postcopy-v8 tag

Quoted 5 lines

Testing status:
* Tested heavily on x86
* Smoke tested on aarch64 (so it does work on different page sizes)
* Power is unhappy for me (but gets further than the htab problem v7 used to have) (I get a kvm run failed)

Seems to be completing successfully on Power. But it takes 2min for the migration status to transition from setup to active.

Host: 4.3.0-rc3+
Guest: 4.3.0-rc3+
QEMU: wp3-postcopy-v8 of your tree.

# ./ppc64-softmmu/qemu-system-ppc64 --enable-kvm --nographic -machine pseries -m 8G,slots=32,maxmem=32G -device virtio-blk-pci,drive=rootdisk -drive file=/home/bharata/F20-snap1,if=none,cache=none,id=rootdisk,format=qcow2 -vga none -net nic,model=virtio -net user -redir tcp:2000::22 -smp 16,maxcpus=32 -serial pty
Quoted 8 lines

(qemu) migrate_set_capability x-postcopy-ram on
(qemu) migrate -d tcp:localhost:4444
(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: on Migration status: setup
total time: 0 milliseconds

same status for around 2min...

That's interesting; I saw that behaviour on my aarch64 box, but not on my power box or on x86. Can you try using tcp:127.0.0.1:4444 to force ipv4 (that fixed it for me on aarch64). On the aarch box I found that it still happened with head of tree qemu and so decided it wasn't my postcopy world; I'm assuming what's happening is that it's trying to connect to the IPv6 address, timing out and then trying IPv4.

Quoted 4 lines
Quoted 1 line

Yes, s/localhost/127.0.0.1 helps.

OK; it sounds like there's something 'fun' going on with either the bleeding edge kernel or the bleeding edge qemu with IPv6 then.

It's the host kernel. Until 4.3.0-rc2 it works, the problem starts from 4.3.0-rc3. Accessing monitor on localhost using telnet is also affected.

Regards,
Bharata.

#6 lore raw

* Bharata B Rao ([email protected]) wrote:

<snip>

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

That's interesting; I saw that behaviour on my aarch64 box, but not on my power box or on x86. Can you try using tcp:127.0.0.1:4444 to force ipv4 (that fixed it for me on aarch64). On the aarch box I found that it still happened with head of tree qemu and so decided it wasn't my postcopy world; I'm assuming what's happening is that it's trying to connect to the IPv6 address, timing out and then trying IPv4.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Yes, s/localhost/127.0.0.1 helps.

OK; it sounds like there's something 'fun' going on with either the bleeding edge kernel or the bleeding edge qemu with IPv6 then.

It's the host kernel. Until 4.3.0-rc2 it works, the problem starts from 4.3.0-rc3. Accessing monitor on localhost using telnet is also affected.

Hmm that is fun; I'll see if I can find a friendly kernel network person to chat to.

Dave

Quoted 4 lines

Regards,
Bharata.

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

#7 lore raw
In reply to a message not in the archive
Quoted 12 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

This is the 8th cut of my version of postcopy.

The userfaultfd linux kernel code is now in the upstream kernel tree, and so 4.3-rc3 can be used without modification.

This qemu series can be found at:
https://github.com/orbitfp7/qemu.git
on the wp3-postcopy-v8 tag

Quoted 5 lines

Testing status:
* Tested heavily on x86
* Smoke tested on aarch64 (so it does work on different page sizes)
* Power is unhappy for me (but gets further than the htab problem v7 used to have) (I get a kvm run failed)

As I said earlier, postcopy migration works on Power, but memory hotplug seems to have some problem.

qemu-system-ppc64 ... -object memory-backend-ram,id=ram0,size=2G -device pc-dimm,memdev=ram0

qemu/exec.c:1278: find_ram_offset: Assertion `size != 0' failed.

Does this happen on x86 too ?

Regards,
Bharata.

#8 lore raw
Quoted 19 lines · * Bharata B Rao ([email protected]) wrote:
Quoted 12 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

This is the 8th cut of my version of postcopy.

The userfaultfd linux kernel code is now in the upstream kernel tree, and so 4.3-rc3 can be used without modification.

This qemu series can be found at:
https://github.com/orbitfp7/qemu.git
on the wp3-postcopy-v8 tag

Quoted 5 lines

Testing status:
* Tested heavily on x86
* Smoke tested on aarch64 (so it does work on different page sizes)
* Power is unhappy for me (but gets further than the htab problem v7 used to have) (I get a kvm run failed)

Quoted 8 lines

As I said earlier, postcopy migration works on Power, but memory hotplug seems to have some problem.

qemu-system-ppc64 ... -object memory-backend-ram,id=ram0,size=2G -device pc-dimm,memdev=ram0

qemu/exec.c:1278: find_ram_offset: Assertion `size != 0' failed.

Does this happen on x86 too ?

Hmm, yes it does - I hadn't tried that.
The problem is that I added a HOST_PAGE_ALIGN call during RAMBlock creation, and -object gets parsed pretty early on, before the internal host page masks have been setup.

The patch below passes a smoke test; I'll look to clean it up.

Thanks,

Dave

include/exec/exec-all.h +0 -1
index a3719b7..b4c4b6e 100644
@@ -81,7 +81,6 @@ void cpu_gen_init(void);
 int cpu_gen_code(CPUArchState *env, struct TranslationBlock *tb,
                  int *gen_code_size_ptr);
 bool cpu_restore_state(CPUState *cpu, uintptr_t searched_pc);
-void page_size_init(void);
 
 void QEMU_NORETURN cpu_resume_from_signal(CPUState *cpu, void *puc);
 void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
include/qemu-common.h +2 -0
index 01d29dd..ae3530c 100644
@@ -491,4 +491,6 @@ int parse_debug_env(const char *name, int max, int initial);
 
 const char *qemu_ether_ntoa(const MACAddr *mac);
 
+void page_size_init(void);
+
 #endif
kvm-all.c +0 -1
index de1924c..62b71fe 100644
@@ -1461,7 +1461,6 @@ static int kvm_init(MachineState *ms)
      * page size for the system though.
      */
     assert(TARGET_PAGE_SIZE <= getpagesize());
-    page_size_init();
 
     s->sigmask_len = 8;
 
vl.c +1 -0
index e211f6a..818075c 100644
@@ -4249,6 +4249,7 @@ int main(int argc, char **argv, char **envp)
         exit(1);
     }
 
+    page_size_init();
     socket_init();
 
     if (qemu_opts_foreach(qemu_find_opts("object"),
Quoted 4 lines

Regards,
Bharata.

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

Reviewed-by
#14 lore raw

Re: [Qemu-devel] [PATCH v8 04/54] Move configuration section writing

In reply to a message not in the archive

Juan Quintela <[email protected]> wrote:

Post proper list

remove cc'd

Quoted 12 lines
Quoted 11 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The vmstate_configuration is currently written in 'qemu_savevm_state_begin', move it to 'qemu_savevm_state_header' since it's got a hard requirement that it must be the 1st thing after the header.
(In postcopy some 'command' sections get sent early before the saving of the main sections and hence before qemu_savevm_state_begin).

Quoted 1 line
Quoted 1 line
Reviewed-by
#17 lore raw

Re: [Qemu-devel] [PATCH v8 06/54] Rename mis->file to from_src_file

In reply to a message not in the archive
Quoted 1 line · Juan Quintela

"Dr. David Alan Gilbert (git)" <[email protected]> wrote:

Post proper list

Remove cc'd

Quoted 8 lines
Quoted 8 lines

From: "Dr. David Alan Gilbert" <[email protected]>

'file' becomes confusing when you have flows in each direction; rename to make it clear.
This leaves just the main forward direction ms->file, which is used in a lot of places and is probably not worth renaming given the churn.

Reviewed-by
#20 lore raw

Re: [Qemu-devel] [PATCH v8 09/54] Add QEMU_MADV_NOHUGEPAGE

In reply to a message not in the archive

Juan Quintela <[email protected]> wrote:

Post proper list

Remove cc'd

Quoted 10 lines
Quoted 9 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Add QEMU_MADV_NOHUGEPAGE as an OS-independent version of MADV_NOHUGEPAGE.

We include sys/mman.h before making the test to ensure that we pick up the system defines.

Reviewed-by
#23 lore raw

Re: [Qemu-devel] [PATCH v8 10/54] migration/ram.c: Use RAMBlock rather than MemoryRegion

In reply to a message not in the archive

Juan Quintela <[email protected]> wrote:

Post proper list

Remove cc'd

Quoted 9 lines
Quoted 8 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

RAM migration mainly works on RAMBlocks but in a few places uses data from MemoryRegions to access the same information that's already held in RAMBlocks; clean it up just to avoid the MemoryRegion use.

This was a leftover of when I tried to convert migration to use Memory regions, yes, it didn't went too well

Reviewed-by
#26 lore raw

Re: [Qemu-devel] [PATCH v8 13/54] Move dirty page search state into separate structure

In reply to a message not in the archive

Juan Quintela <[email protected]> wrote:

Post proper list

Remove cc'd

Quoted 8 lines
Quoted 7 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Pull the search state for one iteration of the dirty page search into a structure.

Reviewed-by
#29 lore raw

Re: [Qemu-devel] [PATCH v8 17/54] Return path: socket_writev_buffer: Block even on non-blocking fd's

In reply to a message not in the archive

Juan Quintela <[email protected]> wrote:

Post proper list

Remove cc'd

Quoted 9 lines
Quoted 8 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The destination sets the fd to non-blocking on incoming migrations; this also affects the return path from the destination, and thus we need to make sure we can safely write to the return path.

I think that my review by got lost on previous series O:-)