From: Markus Armbruster <armbru@redhat.com>
To: Dongli Zhang <dongli.zhang@oracle.com>
Cc: qemu-devel@nongnu.org, peterx@redhat.com, farosas@suse.de,
eblake@redhat.com, maciej.szmigiero@oracle.com,
mark.kanda@oracle.com, bchaney@akamai.com,
pierrick.bouvier@oss.qualcomm.com, joe.jin@oracle.com
Subject: Re: [PATCH 1/5] migration/qapi: Add memfd migration transport
Date: Thu, 27 Aug 2026 10:23:44 +0200 [thread overview]
Message-ID: <87zey8ezu7.fsf@pond.sub.org> (raw)
In-Reply-To: <7d7496c2-79f0-444d-a843-5f5bba467560@oracle.com> (Dongli Zhang's message of "Wed, 26 Aug 2026 10:45:09 -0700")
Dongli Zhang <dongli.zhang@oracle.com> writes:
> On Sun, Aug 23, 2026 11:29:53PM -0700, Markus Armbruster wrote:
> Dongli Zhang <dongli.zhang@oracle.com> writes:
>>
>>> On Fri, Aug 21, 2026 12:13:30AM -0700, Markus Armbruster wrote:
>>>> Dongli Zhang <dongli.zhang@oracle.com> writes:
>>>>
>>>>> On Thu, Aug 20, 2026 12:09:19AM -0700, Markus Armbruster wrote:
>>>>>> Dongli Zhang <dongli.zhang@oracle.com> writes:
>
> [snip]
>
>>>> message.
>>>
>>> Sure.
>>>
>>>>
>>>> We should also help users decide whether to use the feature. I gather
>>>> it's useful with migration mode cpr-exec. Any other use cases? Does it
>>>> even work with other migration modes? If yes, which ones, and what
>>>> happens when you try with another one?
>>>
>>> So far I only added support for cpr-exec. I have not tried othe modes.
>>
>> What happens when you try to use it with other migration modes?
>
> If I use memfd transport without cpr-exec mode, it will be denied.
>
> The code checks that only cpr-exec mode is supported.
>
> (qemu) migrate -d memfd:
> Error: memfd transport is only supported with cpr-exec
Good.
>>> In my opinion, cpr-transfer could also use a memfd-backed channel, but I am not
>>> sure it is necessary.
>>>
>>> For cpr-transfer, the source and destination are separate QEMU processes. If we
>>> want to pass a memfd between them, we still need an IPC mechanism that can
>>> transfer file descriptors, such as a Unix domain socket with SCM_RIGHTS. That
>>> reduces the value of using memfd as the migration channel, because we need at
>>> least one Unix domain socket anyway to pass the memfd fd and coordinate the handoff.
>>>
>>> If a Unix domain socket is already required, the main benefit of memfd would
>>> likely be performance, especially when the device state is large.
>>
>> We'd want to measure the performance impact to see whether it's worth
>> complicating configuration and code.
>
> I may create a VM with many virtio devices to maximize the storage overhead of
> the VM device state. However, I don't think the goal is to improve performance.
As long as that's the case, enabling memfd for cpr-transfer makes no
sense.
>>> cpr-exec is different. The new QEMU is started via exec(), so the memfd fd can
>>> be preserved across exec by clearing CLOEXEC and passing the fd number through
>>> an environment variable. This allows us to add a memfd-backed migration channel
>>> without needing an external file or socket for the device state.
>>
>> What are the actual user-visible benefits?
>
> The goal is to avoid the VM state file used during live update with cpr-exec.
> So, the user-visible benefit is that the file is no longer required. Live update
> with cpr-exec no longer relies on a file on disk.
Got it.
>> Performance? Provide measurements, please.
>
> Not performance.
If we accept memfd for its other benefits, performance measurements
might be interesting. Not now.
>> Simpler configuration? Not sure that would be worth the special case.
>
> Yes. No file required.
>
> "migrate -d memfd:" vs. "migrate -d file:vm.state".
>
> "migrate_incoming memfd:" vs. "migrate_incoming file:vm.state".
Got it.
>> Anything else?
>
> No. Writable storage is no longer required to cache the VM device state file.
> That's the only explicit benefit so far.
Benefits of the new MigrationAddressType @memfd: we gain a zero-config
migration channel for MigMode cpr-exec.
Costs: we gain yet another kind of migration channel, useful only with
cpr-exec. Feels niche.
Are the benefits worth the costs? Migration maintainers decide, not me.
In my (relatively ignorant) opinion, migration already suffers from too
many features. Hard to understand, painful test matrix, expensive to
maintain.
>>> One potential future use case is LUO/KHO support for QEMU. In that case, device
>>> state could be preserved in memory as a memfd and potentially survive across a
>>> KHO kexec. We won't need to preserve anything on storage. Indeed, I did some
>>> internal tests using memfd to preserve device state across kexec although using
>>> different implementation, and it worked.
>>>
>>> For other live migration modes, or even local migration, I do not think this is
>>> useful. For example, saving to and loading from a file won't use memfd, as the
>>> QEMU processes are terminated during the this process.
>>
>> User documentation should spell out when memfd can be used.
It does: "This transport is currently only valid with cpr-exec migration
mode."
>> I recommend
>> to make it usable only when it's known to improve things in at least
>> some scenario that matters. Code should cleanly reject attempts to use
>> memfd when it's not usable.
You showed above that it does.
>> User documentation should help users decide whether to use it.
It does not so far.
>> The commit message(s) may need to provide additional detail on how
>> things improve.
>>
> Thank you very much for feedback!
>
> Dongli Zhang
You're welcome!
Tangent, pardon my ignorance... We have MigMode @cpr-exec and we have
MigrationAddressType @exec. Both involve starting a new instance of
QEMU. How do their use cases differ?
next prev parent reply other threads:[~2026-08-27 8:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 23:27 [PATCH 0/5] Support diskless memfd transport for cpr-exec Dongli Zhang
2026-08-12 23:27 ` [PATCH 1/5] migration/qapi: Add memfd migration transport Dongli Zhang
2026-08-20 7:09 ` Markus Armbruster
2026-08-20 17:46 ` Dongli Zhang
2026-08-21 7:13 ` Markus Armbruster
2026-08-21 20:11 ` Dongli Zhang
2026-08-24 6:29 ` Markus Armbruster
2026-08-26 17:45 ` Dongli Zhang
2026-08-27 8:23 ` Markus Armbruster [this message]
2026-08-28 7:31 ` Dongli Zhang
2026-09-10 19:26 ` Peter Xu
2026-08-12 23:27 ` [PATCH 2/5] migration: Add generic memfd channel helpers Dongli Zhang
2026-08-12 23:27 ` [PATCH 3/5] migration/cpr-exec: Add memfd helpers Dongli Zhang
2026-08-12 23:27 ` [PATCH 4/5] migration/cpr-exec: Support diskless memfd transport Dongli Zhang
2026-08-12 23:27 ` [PATCH 5/5] migration: cpr-exec memfd transport documentation Dongli Zhang
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=87zey8ezu7.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=bchaney@akamai.com \
--cc=dongli.zhang@oracle.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=joe.jin@oracle.com \
--cc=maciej.szmigiero@oracle.com \
--cc=mark.kanda@oracle.com \
--cc=peterx@redhat.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
/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 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.