Fix live migration out-of-memory

Upsteam commit 9fa06385f6 ("kvm: Mark full address range dirty on live
migration start") requests dirty logging on the entire 64-bit address
space.  This triggered an allocation in qemu-kvm.c for this range,
which oomed.

Fix by allocating the buffer when we know the actual slot, thus
allocating exactly as much memory as necessary.

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