add non-arbitrary migration stop condition

Currently, we're entering migration's stage 3 when
a treshold of 10 pages remain to be transferred in the system.

This has hurt some users. However, any proposed threshold is
arbitrary by nature, and would only shift the annoyance.

The proposal of this patch is to define a max_downtime variable,
which represents the maximum downtime a migration user is willing
to suffer. Then, based on the bandwidth of last iteration, we
calculate how much data we can transfer in such a window of time.

Whenever we reach that value (or lower), we know is safe to enter
stage3.

This has largely improved the situation for me.
On localhost migrations, where one would expect things to go as
quickly as me running away from the duty of writting software for
windows, a kernel compile was enough to get the migration stuck.

It takes 20 ~ 30 iterations now.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
3 files changed
tree: 828a90711bce2e7e9e3a26ff6f899a316052158b
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. fpu/
  6. gdb-xml/
  7. hw/
  8. linux-user/
  9. pc-bios/
  10. slirp/
  11. target-alpha/
  12. target-arm/
  13. target-cris/
  14. target-i386/
  15. target-m68k/
  16. target-microblaze/
  17. target-mips/
  18. target-ppc/
  19. target-sh4/
  20. target-sparc/
  21. tcg/
  22. tests/
  23. .gitignore
  24. a.out.h
  25. acl.c
  26. acl.h
  27. aes.c
  28. aes.h
  29. aio.c
  30. alpha-dis.c
  31. alpha.ld
  32. arm-dis.c
  33. arm-semi.c
  34. arm.ld
  35. balloon.h
  36. block.c
  37. block.h
  38. block_int.h
  39. bswap.h
  40. bt-host.c
  41. bt-host.h
  42. bt-vhci.c
  43. buffered_file.c
  44. buffered_file.h
  45. cache-utils.c
  46. cache-utils.h
  47. Changelog
  48. cmd.c
  49. cmd.h
  50. cocoa.m
  51. CODING_STYLE
  52. configure
  53. console.c
  54. console.h
  55. COPYING
  56. COPYING.LIB
  57. cpu-all.h
  58. cpu-common.h
  59. cpu-defs.h
  60. cpu-exec.c
  61. cris-dis.c
  62. curses.c
  63. curses_keys.h
  64. cutils.c
  65. d3des.c
  66. d3des.h
  67. def-helper.h
  68. device_tree.c
  69. device_tree.h
  70. dis-asm.h
  71. disas.c
  72. disas.h
  73. dma-helpers.c
  74. dma.h
  75. dyngen-exec.h
  76. elf.h
  77. elf_ops.h
  78. exec-all.h
  79. exec.c
  80. feature_to_c.sh
  81. gdbstub.c
  82. gdbstub.h
  83. gen-icount.h
  84. host-utils.c
  85. host-utils.h
  86. hostregs_helper.h
  87. hpet.h
  88. hppa-dis.c
  89. hppa.ld
  90. hxtool
  91. i386-dis.c
  92. i386.ld
  93. ia64.ld
  94. keymaps.c
  95. keymaps.h
  96. kqemu.c
  97. kqemu.h
  98. kvm-all.c
  99. kvm.h
  100. libfdt_env.h
  101. LICENSE
  102. loader.c
  103. m68k-dis.c
  104. m68k-semi.c
  105. m68k.ld
  106. MAINTAINERS
  107. Makefile
  108. Makefile.hw
  109. Makefile.target
  110. microblaze-dis.c
  111. migration-exec.c
  112. migration-tcp.c
  113. migration.c
  114. migration.h
  115. mips-dis.c
  116. mips.ld
  117. mipsel.ld
  118. module.c
  119. module.h
  120. monitor.c
  121. monitor.h
  122. nbd.c
  123. nbd.h
  124. net-checksum.c
  125. net.c
  126. net.h
  127. osdep.c
  128. osdep.h
  129. pci-ids.txt
  130. posix-aio-compat.c
  131. posix-aio-compat.h
  132. ppc-dis.c
  133. ppc.ld
  134. ppc64.ld
  135. qemu-aio.h
  136. qemu-binfmt-conf.sh
  137. qemu-char.c
  138. qemu-char.h
  139. qemu-common.h
  140. qemu-doc.texi
  141. qemu-img-cmds.hx
  142. qemu-img.c
  143. qemu-img.texi
  144. qemu-io.c
  145. qemu-lock.h
  146. qemu-log.h
  147. qemu-malloc.c
  148. qemu-monitor.hx
  149. qemu-nbd.c
  150. qemu-nbd.texi
  151. qemu-option.c
  152. qemu-option.h
  153. qemu-options.hx
  154. qemu-sockets.c
  155. qemu-tech.texi
  156. qemu-thread.c
  157. qemu-thread.h
  158. qemu-timer.h
  159. qemu-tool.c
  160. qemu.sasl
  161. qemu_socket.h
  162. readline.c
  163. readline.h
  164. README
  165. rules.mak
  166. s390-dis.c
  167. s390.ld
  168. savevm.c
  169. sdl.c
  170. sdl_keysym.h
  171. sh4-dis.c
  172. softmmu-semi.h
  173. softmmu_defs.h
  174. softmmu_exec.h
  175. softmmu_header.h
  176. softmmu_template.h
  177. sparc-dis.c
  178. sparc.ld
  179. sparc64.ld
  180. sys-queue.h
  181. sysemu.h
  182. tap-win32.c
  183. targphys.h
  184. texi2pod.pl
  185. thunk.c
  186. thunk.h
  187. TODO
  188. tool-osdep.c
  189. translate-all.c
  190. uboot_image.h
  191. usb-bsd.c
  192. usb-linux.c
  193. usb-stub.c
  194. VERSION
  195. vgafont.h
  196. vl.c
  197. vnc-auth-sasl.c
  198. vnc-auth-sasl.h
  199. vnc-auth-vencrypt.c
  200. vnc-auth-vencrypt.h
  201. vnc-tls.c
  202. vnc-tls.h
  203. vnc.c
  204. vnc.h
  205. vnc_keysym.h
  206. vnchextile.h
  207. x86_64.ld
  208. x_keymap.c
  209. x_keymap.h