All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] virtio-mem: Handle preallocation with migration
@ 2022-12-22 11:02 David Hildenbrand
  2022-12-22 11:02 ` [PATCH v3 1/6] migration: Allow immutable device state to be migrated early (i.e., before RAM) David Hildenbrand
                   ` (5 more replies)
  0 siblings, 6 replies; 27+ messages in thread
From: David Hildenbrand @ 2022-12-22 11:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: David Hildenbrand, Dr . David Alan Gilbert, Juan Quintela,
	Peter Xu, Michael S . Tsirkin, Michal Privoznik

While playing with migration of virtio-mem with an ordinary file backing,
I realized that migration and prealloc doesn't currently work as expected
for virtio-mem. Further, Jing Qi reported that setup issues (insufficient
huge pages on the destination) result in QEMU getting killed with SIGBUS
instead of failing gracefully.

In contrast to ordinary memory backend preallocation, virtio-mem
preallocates memory before plugging blocks to the guest. Consequently,
when migrating we are not actually preallocating on the destination but
"only" migrate pages. Fix that be migrating the bitmap early, before any
RAM content, and use that information to preallocate memory early, before
migrating any RAM.

Postcopy needs some extra care, and I realized that prealloc+postcopy is
shaky in general. Let's at least try to mimic what ordinary
prealloc+postcopy does: temporarily allocate the memory, discard it, and
cross fingers that we'll still have sufficient memory when postcopy
actually tries placing pages.

Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Michal Privoznik <mprivozn@redhat.com>

v2 -> v3:
- New approach/rewrite, drop RB and TB of last patch

v1 -> v2:
- Added RBs and Tested-bys
- "virtio-mem: Fail if a memory backend with "prealloc=on" is specified"
-- Fail instead of warn
-- Adjust subject/description

David Hildenbrand (6):
  migration: Allow immutable device state to be migrated early (i.e.,
    before RAM)
  migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and
    VMSTATE_BITMAP_TEST()
  migration: Factor out checks for advised and listening incomming
    postcopy
  virtio-mem: Fail if a memory backend with "prealloc=on" is specified
  virtio-mem: Migrate bitmap, size and sanity checks early
  virtio-mem: Proper support for preallocation with migration

 hw/core/machine.c              |   4 +-
 hw/virtio/virtio-mem.c         | 154 ++++++++++++++++++++++++++++++++-
 include/hw/virtio/virtio-mem.h |   8 ++
 include/migration/misc.h       |   6 +-
 include/migration/vmstate.h    |  19 +++-
 migration/migration.c          |  27 ++++++
 migration/migration.h          |   4 +
 migration/ram.c                |  16 +---
 migration/savevm.c             | 104 ++++++++++++++++------
 migration/savevm.h             |   1 +
 10 files changed, 298 insertions(+), 45 deletions(-)

-- 
2.38.1



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

end of thread, other threads:[~2023-01-11 17:45 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-22 11:02 [PATCH v3 0/6] virtio-mem: Handle preallocation with migration David Hildenbrand
2022-12-22 11:02 ` [PATCH v3 1/6] migration: Allow immutable device state to be migrated early (i.e., before RAM) David Hildenbrand
2022-12-23  9:34   ` David Hildenbrand
2023-01-05  1:27     ` Michael S. Tsirkin
2023-01-05  8:20       ` David Hildenbrand
2023-01-04 17:23   ` Peter Xu
2023-01-05  8:35     ` David Hildenbrand
2023-01-05 17:15       ` Peter Xu
2023-01-09 14:34         ` David Hildenbrand
2023-01-09 19:54           ` Peter Xu
2023-01-10 10:18             ` David Hildenbrand
2023-01-10 11:52               ` David Hildenbrand
2023-01-10 20:03                 ` Peter Xu
2023-01-11 13:48                   ` David Hildenbrand
2023-01-11 16:35                     ` Peter Xu
2023-01-11 16:58                       ` David Hildenbrand
2023-01-11 17:28                         ` Peter Xu
2023-01-11 17:44                           ` David Hildenbrand
2022-12-22 11:02 ` [PATCH v3 2/6] migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and VMSTATE_BITMAP_TEST() David Hildenbrand
2023-01-05 17:33   ` Dr. David Alan Gilbert
2022-12-22 11:02 ` [PATCH v3 3/6] migration: Factor out checks for advised and listening incomming postcopy David Hildenbrand
2023-01-05 17:18   ` Peter Xu
2023-01-09 14:39     ` David Hildenbrand
2023-01-09 14:42       ` David Hildenbrand
2022-12-22 11:02 ` [PATCH v3 4/6] virtio-mem: Fail if a memory backend with "prealloc=on" is specified David Hildenbrand
2022-12-22 11:02 ` [PATCH v3 5/6] virtio-mem: Migrate bitmap, size and sanity checks early David Hildenbrand
2022-12-22 11:02 ` [PATCH v3 6/6] virtio-mem: Proper support for preallocation with migration David Hildenbrand

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.