All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Steve Sistare <steven.sistare@oracle.com>
Cc: qemu-devel@nongnu.org,  Peter Xu <peterx@redhat.com>,
	 Fabiano Rosas <farosas@suse.de>,
	 David Hildenbrand <david@redhat.com>,
	 Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	 Eduardo Habkost <eduardo@habkost.net>,
	 Philippe Mathieu-Daude <philmd@linaro.org>,
	 Paolo Bonzini <pbonzini@redhat.com>,
	 "Daniel P. Berrange" <berrange@redhat.com>
Subject: Re: [PATCH V4 14/19] migration: cpr-transfer mode
Date: Tue, 10 Dec 2024 13:26:51 +0100	[thread overview]
Message-ID: <87ikrr67w4.fsf@pond.sub.org> (raw)
In-Reply-To: <1733145611-62315-15-git-send-email-steven.sistare@oracle.com> (Steve Sistare's message of "Mon, 2 Dec 2024 05:20:06 -0800")

Steve Sistare <steven.sistare@oracle.com> writes:

> Add the cpr-transfer migration mode.  Usage:
>
>   qemu-system-$arch -machine aux-ram-share=on ...
>
>   start new QEMU with "-incoming <main-uri> -incoming <cpr-channel>"
>
>   Issue commands to old QEMU:
>     migrate_set_parameter mode cpr-transfer
>
>     {"execute": "migrate", ...
>         {"channel-type": "main"...}, {"channel-type": "cpr"...} ... }

Much technical detail here that won't make sense to the reader until
further down, but next to nothing on what the thing actually
accomplishes.  Makes the commit message unnecessarily hard to
understand.  But please read on.

> The migrate command stops the VM, saves CPR state to cpr-channel, saves
> normal migration state to main-uri, and old QEMU enters the postmigrate
> state.  The user starts new QEMU on the same host as old QEMU, with the
> same arguments as old QEMU,

Any additional requirements over traditional migration?

There, "same arguments" is sufficient, but not necessary.  For instance,
changing certain backends is quite possible.

>                             plus two -incoming options.

Two -incoming options to define two migration channels, the traditional
one of MigrationChannelType "main", and an another one of
MigrationChannelType "cpr"?

>                                                          Guest RAM is
> preserved in place, albeit with new virtual addresses in new QEMU.
>
> This mode requires a second migration channel of type "cpr", in the
> channel arguments on the outgoing side, and in a second -incoming
> command-line parameter on the incoming side.
>
> 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, which allows anonymous
> memory to be transferred in place to the new process.  The memfds
> are kept open by sending the descriptors to new QEMU via the CPR
> channel, which must support SCM_RIGHTS, and they are mmap'd in new QEMU.
>
> The implementation splits qmp_migrate into start and finish functions.
> Start sends CPR state to new QEMU, which responds by closing the CPR
> channel.  Old QEMU detects the HUP then calls finish, which connects
> the main migration channel.
>
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>

I'd lead with a brief explanation of the feature and its benefits.
Could steam from the cover letter like this:

  New migration mode cpr-transfer mode enables transferring a guest to a
  new QEMU instance on the same host with minimal guest pause time, by
  preserving guest RAM in place, albeit with new virtual addresses in
  new QEMU, and by preserving device file descriptors.

Then talk about required special setup.  I see aux-ram-share=on.
Anything else?  Any differences between source and destination QEMU
there?

Then talk about the two channels.  First what they do, second how to
create their destination end with -incoming, third how to create their
source end with "migrate".

Finally mention whatever technical detail you believe needs mentioning
here.

[...]

> diff --git a/qapi/migration.json b/qapi/migration.json
> index a26960b..1bc963f 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -614,9 +614,44 @@
>  #     or COLO.
>  #
>  #     (since 8.2)
> +#
> +# @cpr-transfer: This mode allows the user to transfer a guest to a
> +#     new QEMU instance on the same host with minimal guest pause
> +#     time, by preserving guest RAM in place, albeit with new virtual
> +#     addresses in new QEMU.
> +#
> +#     The user starts new QEMU on the same host as old QEMU, with the
> +#     the same arguments as old QEMU, plus the -incoming option.

Two of them?

> +#                                                                 The
> +#     user issues the migrate command to old QEMU, which stops the VM,
> +#     saves state to the migration channels, and enters the
> +#     postmigrate state.  Execution resumes in new QEMU.

The commit message also mentions file descriptors are migrared over.
Worth mentioning here, too?

> +#
> +#     This mode requires a second migration channel type "cpr" in the
> +#     channel arguments on the outgoing side.  The channel must be a
> +#     type, such as unix socket, that supports SCM_RIGHTS.  However,

This is vague.  Would anything but a UNIX domain socket work?

Applies to both source and destination end?

> +#     the cpr channel cannot be added to the list of channels for a
> +#     migrate-incoming command, because it must be read before new
> +#     QEMU opens a monitor.

Ugh!  Remind me, why is that the case?

> +#                            Instead, the user passes the channel as a
> +#     second -incoming command-line argument to new QEMU using JSON
> +#     syntax.
> +#
> +#     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.

What happens when the conditions aren't met?  migrate command fails
with a useful error message?

> +#
> +#     The incoming migration channel cannot be a file type, and for
> +#     the tcp type, the port cannot be 0 (meaning dynamically choose
> +#     a port).

Which of the two channels are you discussing?

> +#
> +#     When using -incoming defer, you must issue the migrate command
> +#     to old QEMU before issuing any monitor commands to new QEMU.

I'm confused.  Not even qmp_capabilities?  Why?

> +#     However, new QEMU does not open and read the migration stream
> +#     until you issue the migrate incoming command.
> +#
> +#     (since 10.0)
>  ##
>  { 'enum': 'MigMode',
> -  'data': [ 'normal', 'cpr-reboot' ] }
> +  'data': [ 'normal', 'cpr-reboot', 'cpr-transfer' ] }
>  
>  ##
>  # @ZeroPageDetection:

[...]



  parent reply	other threads:[~2024-12-10 12:27 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-02 13:19 [PATCH V4 00/19] Live update: cpr-transfer Steve Sistare
2024-12-02 13:19 ` [PATCH V4 01/19] backends/hostmem-shm: factor out allocation of "anonymous shared memory with an fd" Steve Sistare
2024-12-09 17:36   ` Peter Xu
2024-12-12 20:37     ` Steven Sistare
2024-12-02 13:19 ` [PATCH V4 02/19] physmem: fd-based shared memory Steve Sistare
2024-12-09 19:42   ` Peter Xu
2024-12-12 20:38     ` Steven Sistare
2024-12-12 21:22       ` Peter Xu
2024-12-13 16:41         ` Steven Sistare
2024-12-13 17:05           ` Steven Sistare
2024-12-16 18:19           ` Peter Xu
2024-12-17 21:54             ` Steven Sistare
2024-12-17 22:46               ` Peter Xu
2024-12-18 16:34                 ` Steven Sistare
2024-12-02 13:19 ` [PATCH V4 03/19] memory: add RAM_PRIVATE Steve Sistare
2024-12-09 19:45   ` Peter Xu
2024-12-02 13:19 ` [PATCH V4 04/19] machine: aux-ram-share option Steve Sistare
2024-12-05  8:25   ` Markus Armbruster
2024-12-05 14:24     ` Steven Sistare
2024-12-05 12:08   ` Markus Armbruster
2024-12-05 12:19     ` Markus Armbruster
2024-12-05 14:24       ` Steven Sistare
2024-12-09 19:54   ` Peter Xu
2024-12-12 20:38     ` Steven Sistare
2024-12-12 21:22       ` Peter Xu
2024-12-02 13:19 ` [PATCH V4 05/19] migration: cpr-state Steve Sistare
2024-12-02 13:19 ` [PATCH V4 06/19] physmem: preserve ram blocks for cpr Steve Sistare
2024-12-09 20:07   ` Peter Xu
2024-12-12 20:38     ` Steven Sistare
2024-12-12 22:48       ` Peter Xu
2024-12-13 15:21         ` Peter Xu
2024-12-13 15:30           ` Steven Sistare
2024-12-18 16:34             ` Steven Sistare
2024-12-18 17:00               ` Peter Xu
2024-12-18 20:22                 ` Steven Sistare
2024-12-18 20:33                   ` Peter Xu
2024-12-02 13:19 ` [PATCH V4 07/19] hostmem-memfd: preserve " Steve Sistare
2024-12-18 19:53   ` Steven Sistare
2024-12-18 20:23     ` Peter Xu
2024-12-02 13:20 ` [PATCH V4 08/19] hostmem-shm: " Steve Sistare
2024-12-12 17:38   ` Peter Xu
2024-12-02 13:20 ` [PATCH V4 09/19] migration: incoming channel Steve Sistare
2024-12-05 15:23   ` Markus Armbruster
2024-12-05 20:45     ` Steven Sistare
2024-12-09 12:12       ` Markus Armbruster
2024-12-09 16:36         ` Peter Xu
2024-12-11  9:18         ` Markus Armbruster
2024-12-11 18:58         ` Steven Sistare
2024-12-10 12:46     ` Markus Armbruster
2024-12-02 13:20 ` [PATCH V4 10/19] migration: cpr channel Steve Sistare
2024-12-05 15:37   ` Markus Armbruster
2024-12-05 20:46     ` Steven Sistare
2024-12-06  9:31       ` Markus Armbruster
2024-12-18 19:53         ` Steven Sistare
2024-12-18 20:27           ` Peter Xu
2024-12-18 20:31             ` Steven Sistare
2024-12-02 13:20 ` [PATCH V4 11/19] migration: SCM_RIGHTS for QEMUFile Steve Sistare
2024-12-02 13:20 ` [PATCH V4 12/19] migration: VMSTATE_FD Steve Sistare
2024-12-02 13:20 ` [PATCH V4 13/19] migration: cpr-transfer save and load Steve Sistare
2024-12-02 13:20 ` [PATCH V4 14/19] migration: cpr-transfer mode Steve Sistare
2024-12-04 16:10   ` Steven Sistare
2024-12-10 12:26   ` Markus Armbruster [this message]
2024-12-11 22:05     ` Steven Sistare
2024-12-02 13:20 ` [PATCH V4 15/19] tests/migration-test: memory_backend Steve Sistare
2024-12-02 13:20 ` [PATCH V4 16/19] tests/qtest: defer connection Steve Sistare
2024-12-18 21:02   ` Steven Sistare
2024-12-19 15:46   ` Peter Xu
2024-12-19 22:33     ` Steven Sistare
2024-12-02 13:20 ` [PATCH V4 17/19] tests/migration-test: " Steve Sistare
2024-12-02 13:20 ` [PATCH V4 18/19] migration-test: cpr-transfer Steve Sistare
2024-12-18 21:03   ` Steven Sistare
2024-12-19 16:56   ` Peter Xu
2024-12-19 22:34     ` Steven Sistare
2024-12-20 15:41       ` Peter Xu
2024-12-02 13:20 ` [PATCH V4 19/19] migration: cpr-transfer documentation Steve Sistare
2024-12-18 21:03   ` Steven Sistare
2024-12-19 17:02   ` Peter Xu
2024-12-19 22:35     ` Steven Sistare

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=87ikrr67w4.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=david@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=farosas@suse.de \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=steven.sistare@oracle.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 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.