All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Dongli Zhang <dongli.zhang@oracle.com>
Cc: Markus Armbruster <armbru@redhat.com>,
	 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: Fri, 21 Aug 2026 09:13:30 +0200	[thread overview]
Message-ID: <87a4qg0wv9.fsf@pond.sub.org> (raw)
In-Reply-To: <614160f2-2f3e-4489-ac4b-758f162be553@oracle.com> (Dongli Zhang's message of "Thu, 20 Aug 2026 10:46:45 -0700")

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:
>> 
>>> Add a memfd migration transport to the MigrationAddress QAPI schema. The
>>> new transport has no user-supplied arguments because QEMU creates and
>>> passes the backing memfd internally.
>>>
>>> The initial user is cpr-exec, where the main VM/device migration stream can
>>> be stored in an inherited memfd instead of an external file.
>>>
>>> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
>>> ---
>>>  qapi/migration.json | 32 +++++++++++++++++++++++++++-----
>>>  1 file changed, 27 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/qapi/migration.json b/qapi/migration.json
>>> index b1eaf7b054..1505c201ca 100644
>>> --- a/qapi/migration.json
>>> +++ b/qapi/migration.json
>>> @@ -702,9 +702,11 @@
>>>  # @cpr-exec: The migrate command stops the VM, saves state to the
>>>  #     migration channel, directly exec's a new version of QEMU on the
>>>  #     same host, replacing the original process while retaining its
>>> -#     PID, and loads state from the channel.  Guest RAM is preserved
>>> -#     in place.  Devices and their pinned pages are also preserved for
>>> -#     VFIO and IOMMUFD.
>>> +#     PID, and loads state from the channel.  With the @memfd
>>> +#     migration transport, QEMU saves VM/device state to an internal
>>> +#     memfd instead of an external main migration channel.  Guest RAM
>>> +#     is preserved in place.  Devices and their pinned pages are also
>>> +#     preserved for VFIO and IOMMUFD.
>>>  #
>>>  #     Old QEMU starts new QEMU by exec'ing the command specified by
>>>  #     the @cpr-exec-command parameter.  The command may be a direct
>>> @@ -716,6 +718,13 @@
>>>  #     as a file, that accepts all data before old QEMU exits.
>>>  #     Otherwise, old QEMU may quietly block writing to the channel.
>>>  #
>>> +#     Alternatively, use the @memfd migration transport to save
>>> +#     VM/device state to an internal memfd inherited by new QEMU.
>>> +#
>> 
>> Any guidance on when to use @memfd?
>
> My objective is to avoid using disks, or running QEMU with writable storage.
>
> Both guest I/O and networking can go through VFIO, and everything remains in memory.
>
> When I was testing these CPR features, my favorite was cpr-exec because it does
> not require creating an additional QEMU instance.
>
> Based on my understanding, the best approach to live update a running binary is
> to replace only the code section while keeping everything else in memory, i.e.
> guest memory, device fds, and device state.
>
> Unfortunately, device state cannot simply remain in memory across exec(), so we
> need to migrate it from the old instance to the new instance. I was thinking:
> why not use memory instead of storage?
>
> Initially, I added the change only for cpr-exec. Later, I reworked the change to
> make memfd a new migration transport. As a side benefit for me, I also practiced
> how to add a new transport to the QEMU migration code :)

This is why you wrote the feature.  Please work it into the commit
message.

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?

>>> +#     With @memfd, the new QEMU command may include '-incoming memfd:'
>>> +#     to load the migration stream automatically, or '-incoming defer'
>>> +#     to load it later with `migrate-incoming`.
>>> +#
>> 
>> Isn't that the same for any transport?  I.e. old and new QEMU must use a
>> common transport, and you configure it for the new one with -incoming
>> right away, or later with migrate-incoming.
>
> Yes, it is the same for all transports. I added the explanation only because the
> memfd transport does not need additional data or a filename, for example, the
> URI is just "memfd:".
>
> Will remove it.
>
>> 
>>>  #     Memory-backend objects must have the share=on attribute, but
>>>  #     memory-backend-epc is not supported.  The VM must be started
>>>  #     with the '-machine aux-ram-share=on' option.

[...]



  reply	other threads:[~2026-08-21  7:14 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 [this message]
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
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=87a4qg0wv9.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.