From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: Michal Privoznik <mprivozn@redhat.com>,
Juan Quintela <quintela@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
David Hildenbrand <david@redhat.com>
Subject: [PATCH v1 0/2] virtio-mem: Handle preallocation with migration
Date: Tue, 18 Jan 2022 16:07:10 +0100 [thread overview]
Message-ID: <20220118150712.139953-1-david@redhat.com> (raw)
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, especially when migrating zeropages or skipping migration
of some pages.
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. When migrating the zeropage, we might not end up
allocating actual backend memory.
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.
For postcopy to work with prealloc=on, we need a matching "requested-size"
on source and destination, meaning we have to start QEMU on the destination
with the current "requested-size" on the source. Only that way, we can try
temporarily allocating the "requested-size" to see if there is a
fundamental issue. If we detect a mismatch, we don't start postcopy.
Cc: Juan Quintela <quintela@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Michal Privoznik <mprivozn@redhat.com>
David Hildenbrand (2):
virtio-mem: Warn if a memory backend with "prealloc=on" is used
virtio-mem: Handle preallocation with migration
hw/virtio/virtio-mem.c | 143 +++++++++++++++++++++++++++++++++
include/hw/virtio/virtio-mem.h | 6 ++
2 files changed, 149 insertions(+)
--
2.34.1
next reply other threads:[~2022-01-18 15:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 15:07 David Hildenbrand [this message]
2022-01-18 15:07 ` [PATCH v1 1/2] virtio-mem: Warn if a memory backend with "prealloc=on" is used David Hildenbrand
2022-01-25 11:19 ` Dr. David Alan Gilbert
2022-01-25 12:08 ` David Hildenbrand
2022-01-18 15:07 ` [PATCH v1 2/2] virtio-mem: Handle preallocation with migration David Hildenbrand
2022-01-25 11:43 ` Dr. David Alan Gilbert
2022-01-19 13:26 ` [PATCH v1 0/2] " Michal Prívozník
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220118150712.139953-1-david@redhat.com \
--to=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=mprivozn@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).