From: Alex Williamson <alex@shazbot.org>
To: "Cédric Le Goater" <clg@redhat.com>, "Peter Xu" <peterx@redhat.com>
Cc: Yishai Hadas <yishaih@nvidia.com>, <alex.williamson@redhat.com>,
<jgg@nvidia.com>, <kvm@vger.kernel.org>, <kevin.tian@intel.com>,
<joao.m.martins@oracle.com>, <leonro@nvidia.com>,
<maorg@nvidia.com>, <avihaih@nvidia.com>,
<liulongfang@huawei.com>, <giovanni.cabiddu@intel.com>,
<kwankhede@nvidia.com>,
alex@shazbot.org
Subject: Re: [PATCH vfio 0/6] Add support for PRE_COPY initial bytes re-initialization
Date: Fri, 27 Feb 2026 13:23:27 -0700 [thread overview]
Message-ID: <20260227132327.3e627601@shazbot.org> (raw)
In-Reply-To: <20260224082019.25772-1-yishaih@nvidia.com>
+Cédric, +Peter, please see what you think of this approach relative to
QEMU. The broken uAPI for flags on the PRECOPY_INFO ioctl is
unfortunate, but we need an opt-in for the driver to enable REINIT
reporting anyway. Thanks,
Alex
On Tue, 24 Feb 2026 10:20:13 +0200
Yishai Hadas <yishaih@nvidia.com> wrote:
> This series introduces support for re-initializing the initial_bytes
> value during the VFIO PRE_COPY migration phase.
>
> Background
> ==========
> As currently defined, initial_bytes is monotonically decreasing and
> precedes dirty_bytes when reading from the saving file descriptor.
> The transition from initial_bytes to dirty_bytes is unidirectional and
> irreversible.
>
> The initial_bytes are considered critical data that is highly
> recommended to be transferred to the target as part of PRE_COPY.
> Without this data, the PRE_COPY phase would be ineffective.
>
> Problem Statement
> =================
> In some cases, a new chunk of critical data may appear during the
> PRE_COPY phase. The current API does not provide a mechanism for the
> driver to report an updated initial_bytes value when this occurs.
>
> Solution
> ========
> For that, we extend the VFIO_MIG_GET_PRECOPY_INFO ioctl with an output
> flag named VFIO_PRECOPY_INFO_REINIT to allow drivers reporting a new
> initial_bytes value during the PRE_COPY phase.
>
> However, Currently, existing VFIO_MIG_GET_PRECOPY_INFO implementations
> don't assign info.flags before copy_to_user(), this effectively echoes
> userspace-provided flags back as output, preventing the field from being
> used to report new reliable data from the drivers.
>
> Reliable use of the new VFIO_PRECOPY_INFO_REINIT flag requires userspace
> to explicitly opt in. For that we introduce a new feature named
> VFIO_DEVICE_FEATURE_MIG_PRECOPY_INFOv2.
>
> User should opt-in to the above feature with a SET operation, no data is
> required and any supplied data is ignored.
>
> When the caller opts in:
> - We set info.flags to zero, otherwise we keep v1 behaviour as is for
> compatibility reasons.
> - The new output flag VFIO_PRECOPY_INFO_REINIT can be used reliably.
> - The VFIO_PRECOPY_INFO_REINIT output flag indicates that new initial
> data is present on the stream. The initial_bytes value should be
> re-evaluated relative to the readiness state for transition to
> STOP_COPY.
>
> The mlx5 VFIO driver is extended to support this case when the
> underlying firmware also supports the REINIT migration state.
>
> As part of this series, a core helper function is introduced to provide
> shared functionality for implementing the VFIO_MIG_GET_PRECOPY_INFO
> ioctl, and all drivers have been updated to use it.
>
> Note:
> We may need to send the net/mlx5 patch to VFIO as a pull request to
> avoid conflicts prior to acceptance.
>
> Yishai
>
> Yishai Hadas (6):
> vfio: Define uAPI for re-init initial bytes during the PRE_COPY phase
> vfio: Add support for VFIO_DEVICE_FEATURE_MIG_PRECOPY_INFOv2
> vfio: Adapt drivers to use the core helper vfio_check_precopy_ioctl
> net/mlx5: Add IFC bits for migration state
> vfio/mlx5: consider inflight SAVE during PRE_COPY
> vfio/mlx5: Add REINIT support to VFIO_MIG_GET_PRECOPY_INFO
>
> .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 17 +--
> drivers/vfio/pci/mlx5/cmd.c | 25 +++-
> drivers/vfio/pci/mlx5/cmd.h | 6 +-
> drivers/vfio/pci/mlx5/main.c | 118 +++++++++++-------
> drivers/vfio/pci/qat/main.c | 17 +--
> drivers/vfio/pci/vfio_pci_core.c | 1 +
> drivers/vfio/pci/virtio/migrate.c | 17 +--
> drivers/vfio/vfio_main.c | 20 +++
> include/linux/mlx5/mlx5_ifc.h | 16 ++-
> include/linux/vfio.h | 40 ++++++
> include/uapi/linux/vfio.h | 22 ++++
> samples/vfio-mdev/mtty.c | 16 +--
> 12 files changed, 217 insertions(+), 98 deletions(-)
>
next prev parent reply other threads:[~2026-02-27 20:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 8:20 [PATCH vfio 0/6] Add support for PRE_COPY initial bytes re-initialization Yishai Hadas
2026-02-24 8:20 ` [PATCH vfio 1/6] vfio: Define uAPI for re-init initial bytes during the PRE_COPY phase Yishai Hadas
2026-02-27 20:42 ` Alex Williamson
2026-02-24 8:20 ` [PATCH vfio 2/6] vfio: Add support for VFIO_DEVICE_FEATURE_MIG_PRECOPY_INFOv2 Yishai Hadas
2026-02-27 20:42 ` Alex Williamson
2026-02-28 19:51 ` Alex Williamson
2026-02-24 8:20 ` [PATCH vfio 3/6] vfio: Adapt drivers to use the core helper vfio_check_precopy_ioctl Yishai Hadas
2026-02-24 8:20 ` [PATCH vfio 4/6] net/mlx5: Add IFC bits for migration state Yishai Hadas
2026-02-24 8:20 ` [PATCH vfio 5/6] vfio/mlx5: consider inflight SAVE during PRE_COPY Yishai Hadas
2026-02-24 8:20 ` [PATCH vfio 6/6] vfio/mlx5: Add REINIT support to VFIO_MIG_GET_PRECOPY_INFO Yishai Hadas
2026-02-27 20:23 ` Alex Williamson [this message]
2026-02-28 6:27 ` [PATCH vfio 0/6] Add support for PRE_COPY initial bytes re-initialization Cédric Le Goater
2026-03-01 12:43 ` Yishai Hadas
2026-03-10 9:46 ` Yishai Hadas
2026-03-10 10:09 ` Cédric Le Goater
2026-03-10 12:44 ` Yishai Hadas
2026-03-10 16:00 ` Alex Williamson
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=20260227132327.3e627601@shazbot.org \
--to=alex@shazbot.org \
--cc=alex.williamson@redhat.com \
--cc=avihaih@nvidia.com \
--cc=clg@redhat.com \
--cc=giovanni.cabiddu@intel.com \
--cc=jgg@nvidia.com \
--cc=joao.m.martins@oracle.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=leonro@nvidia.com \
--cc=liulongfang@huawei.com \
--cc=maorg@nvidia.com \
--cc=peterx@redhat.com \
--cc=yishaih@nvidia.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