All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Avihai Horon <avihaih@nvidia.com>
Cc: qemu-devel@nongnu.org, "Alex Williamson" <alex@shazbot.org>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Jason Herne" <jjherne@linux.ibm.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"David Hildenbrand" <david@kernel.org>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Matthew Rosato" <mjrosato@linux.ibm.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
	"John Snow" <jsnow@redhat.com>,
	"Maor Gottlieb" <maorg@nvidia.com>
Subject: Re: [PATCH v2 06/13] migration: Make switchover-ack re-usable
Date: Mon, 08 Jun 2026 12:23:57 +0200	[thread overview]
Message-ID: <87wlw9jpoi.fsf@pond.sub.org> (raw)
In-Reply-To: <f3434226-237b-40e4-9b55-3e79a0656705@nvidia.com> (Avihai Horon's message of "Thu, 4 Jun 2026 18:05:20 +0300")

Avihai Horon <avihaih@nvidia.com> writes:

> On 6/3/2026 10:17 AM, Markus Armbruster wrote:
>> External email: Use caution opening links or attachments
>>
>>
>> Avihai Horon <avihaih@nvidia.com> writes:
>>
>>> Switchover-ack is a mechanism to synchronize between source and
>>> destination QEMU during migration to prevent the source from switching
>>> over prematurely.
>>>
>>> VFIO uses switchover-ack to ensure switchover happens only after
>>> destination side has loaded the precopy initial bytes. This is important
>>> for VFIO, as otherwise downtime could be impacted and be higher.
>>>
>>> In its current state, switchover-ack is a one-time mechanism, meaning
>>> that switchover is acked only once and past that another ACK cannot be
>>> requested again. This was sufficient until now, as VFIO precopy initial
>>> bytes was defined to be monotonically decreasing. Thus, when precopy
>>> initial bytes reached zero for all VFIO devices, a single ACK would be
>>> sent and its validity would hold.
>>>
>>> However, now the new VFIO_PRECOPY_INFO_REINIT feature allows precopy
>>> initial bytes to be re-initialized during precopy. Specifically, it
>>> means that initial bytes can grow after reaching zero, which would
>>> invalidate a previously sent switchover ACK.
>>>
>>> To solve this, make switchover-ack reusable and allow devices to request
>>> switchover ACKs when needed via the save_query_pending SaveVMHandler.
>>>
>>> Since now switchover ACK can be requested for a specific device and in
>>> different times, make switchover ACK per-device (instead of a single ACK
>>> for all devices) and let source side do the pending ACKs accounting.
>>>
>>> Keep the legacy switchover-ack mechanism for backward compatibility and
>>> turn it on by a compatibility property for older machines. Enable the
>>> property until VFIO implements the new switchover-ack.
>>
>> I figure this is about the transmission of ACKs via the return path.  If
>> both source and destination understand the new per-device ACK, they use
>> it.  Else, they use old one.  Correct?
>
> Correct.
>
>>
>> This is not visible to the management application.  It may use migration
>> capability @switchover-ack to enable just as before.  Correct?
>
> Correct.
>
>>
>> Can you think of a reason why management applications might need to know
>> whether a certain qemu-system-FOO supports per-device ACKs?
>
> Not that I can think of. It should be an implementation detail internal to QEMU.

Thank you.

>>> Signed-off-by: Avihai Horon <avihaih@nvidia.com>
>>> ---
>>>  qapi/migration.json                | 16 ++++-----
>>>  include/migration/client-options.h |  1 +
>>>  include/migration/register.h       |  2 ++
>>>  migration/migration.h              | 32 ++++++++++++++++--
>>>  migration/savevm.h                 |  6 ++--
>>>  hw/core/machine.c                  |  1 +
>>>  migration/migration.c              | 37 ++++++++++++++-------
>>>  migration/options.c                | 10 ++++++
>>>  migration/savevm.c                 | 53 +++++++++++++++++++++++-------
>>>  migration/trace-events             |  5 +--
>>>  10 files changed, 125 insertions(+), 38 deletions(-)
>>>
>>> diff --git a/qapi/migration.json b/qapi/migration.json
>>> index 27a7970556..550cb77762 100644
>>> --- a/qapi/migration.json
>>> +++ b/qapi/migration.json
>>> @@ -507,15 +507,13 @@
>>>  #     and should not affect the correctness of postcopy migration.
>>>  #     (since 7.1)
>>>  #
>>> -# @switchover-ack: If enabled, migration will not stop the source VM
>>> -#     and complete the migration until an ACK is received from the
>>> -#     destination that it's OK to do so.  Exactly when this ACK is
>>> -#     sent depends on the migrated devices that use this feature.  For
>>> -#     example, a device can use it to make sure some of its data is
>>> -#     sent and loaded in the destination before doing switchover.
>>> -#     This can reduce downtime if devices that support this capability
>>> -#     are present.  'return-path' capability must be enabled to use
>>> -#     it.  (since 8.1)
>>> +# @switchover-ack: If enabled, migration will rely on destination side
>>> +#     to acknowledge the source's switchover decision.  The
>>> +#     acknowledgement may depend, for example, on some device's data
>>> +#     being loaded in the destination before doing switchover.  This
>>> +#     can reduce downtime if devices that support this capability are
>>> +#     present.  'return-path' capability must be enabled to use it.
>>
>> Please use the opportunity to fix markup: @return-path.
>> docs/devel/qapi-code-gen.rst:
>>
>>      Use @foo to reference a member description within the current
>>      definition.  This is an rST extension.  It is currently rendered the
>>      same way as ````foo````, but carries additional meaning.
>>
>> Suggest "Capability @return-path must be ..."
>
> Sure, will change it.
>
>>
>> The old text is concrete: "will not stop the source VM ... until".  The
>> new text is vague "will rely on destination side to acknowledge".  What
>> does that mean exactly?  How does it impact behavior the user /
>> management application cares about?
>
> How about the suggestion below? It's both concrete and doesn't mention the number of ACKs (as requested by Peter).
>
> # @switchover-ack: If enabled, migration will not stop the source VM
> #     and complete the migration until the destination has acknowledged
> #     that switchover is safe.  The acknowledgement may depend...
>
> Thanks.

Better!

With these improvements, QAPI schema
Acked-by: Markus Armbruster <armbru@redhat.com>


>>
>>> +#     (since 8.1)
>>>  #
>>>  # @dirty-limit: If enabled, migration will throttle vCPUs as needed to
>>>  #     keep their dirty page rate within @vcpu-dirty-limit.  This can
>> [...]
>>



  reply	other threads:[~2026-06-08 10:44 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02  9:26 [PATCH v2 00/13] Make switchover-ack re-usable and add VFIO precopy REINIT feature Avihai Horon
2026-06-02  9:26 ` [PATCH v2 01/13] migration: Propagate errors in migration_completion_precopy() Avihai Horon
2026-06-03 19:47   ` Peter Xu
2026-06-04 15:12     ` Avihai Horon
2026-06-04 15:21       ` Peter Xu
2026-06-04 15:38         ` Avihai Horon
2026-06-02  9:26 ` [PATCH v2 02/13] migration: Run final save_query_pending at switchover Avihai Horon
2026-06-03 20:05   ` Peter Xu
2026-06-03 21:04     ` Peter Xu
2026-06-04 15:29       ` Avihai Horon
2026-06-04 17:18         ` Peter Xu
2026-06-08 12:07           ` Avihai Horon
2026-06-08 14:11             ` Peter Xu
2026-06-08 14:32               ` Avihai Horon
2026-06-02  9:26 ` [PATCH v2 03/13] migration: Log the approver in qemu_loadvm_approve_switchover() Avihai Horon
2026-06-02  9:26 ` [PATCH v2 04/13] migration: Replace switchover_ack_needed SaveVMHandler Avihai Horon
2026-06-02  9:26 ` [PATCH v2 05/13] migration: Rename switchover-ack code to legacy Avihai Horon
2026-06-03 20:21   ` Peter Xu
2026-06-02  9:26 ` [PATCH v2 06/13] migration: Make switchover-ack re-usable Avihai Horon
2026-06-03  7:17   ` Markus Armbruster
2026-06-04 15:05     ` Avihai Horon
2026-06-08 10:23       ` Markus Armbruster [this message]
2026-06-02  9:26 ` [PATCH v2 07/13] migration: Fail migration if switchover-ack is requested after switchover decision Avihai Horon
2026-06-03 20:42   ` Peter Xu
2026-06-04 15:36     ` Avihai Horon
2026-06-04 17:48       ` Peter Xu
2026-06-08 12:49         ` Avihai Horon
2026-06-02  9:26 ` [PATCH v2 08/13] vfio/migration: Extract VFIO_MIG_FLAG_DEV_INIT_DATA_SENT sending to helper Avihai Horon
2026-06-03 20:43   ` Peter Xu
2026-06-02  9:26 ` [PATCH v2 09/13] vfio/migration: Add Error ** parameter to vfio_migration_init() Avihai Horon
2026-06-03 11:38   ` Philippe Mathieu-Daudé
2026-06-04 15:06     ` Avihai Horon
2026-06-02  9:26 ` [PATCH v2 10/13] vfio/migration: Add new switchover-ack mechanism Avihai Horon
2026-06-03 20:47   ` Peter Xu
2026-06-02  9:26 ` [PATCH v2 11/13] vfio/migration: Implement VFIO_PRECOPY_INFO_REINIT feature Avihai Horon
2026-06-03 20:49   ` Peter Xu
2026-06-02  9:26 ` [PATCH v2 12/13] vfio/migration: Check VFIO_PRECOPY_INFO_REINIT during switchover Avihai Horon
2026-06-02  9:26 ` [PATCH v2 13/13] migration: Enable new switchover-ack Avihai Horon

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=87wlw9jpoi.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex@shazbot.org \
    --cc=avihaih@nvidia.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=david@kernel.org \
    --cc=eblake@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=farosas@suse.de \
    --cc=iii@linux.ibm.com \
    --cc=jjherne@linux.ibm.com \
    --cc=jsnow@redhat.com \
    --cc=maorg@nvidia.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=vsementsov@yandex-team.ru \
    --cc=zhao1.liu@intel.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.