All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avihai Horon <avihaih@nvidia.com>
To: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	qemu-devel@nongnu.org
Cc: Peter Xu <peterx@redhat.com>
Subject: Re: [PULL 17/23] vfio/migration: Implement VFIO_PRECOPY_INFO_REINIT feature
Date: Fri, 3 Jul 2026 15:55:29 +0300	[thread overview]
Message-ID: <c20103ff-c587-477e-a16b-66e2b63c4076@nvidia.com> (raw)
In-Reply-To: <dca7072f-6232-49fa-b8c9-dbb8f82b85a1@oss.qualcomm.com>


On 7/3/2026 12:16 PM, Philippe Mathieu-Daudé wrote:
> External email: Use caution opening links or attachments
>
>
> On 3/7/26 10:13, Avihai Horon wrote:
>>
>> On 7/3/2026 5:07 AM, Philippe Mathieu-Daudé wrote:
>>> External email: Use caution opening links or attachments
>>>
>>>
>>> On 30/6/26 06:31, Cédric Le Goater wrote:
>>>> From: Avihai Horon <avihaih@nvidia.com>
>>>>
>>>> According to VFIO uAPI, precopy initial_bytes is considered as 
>>>> critical
>>>> data that should be transferred and loaded prior to moving to 
>>>> STOP_COPY
>>>> state to ensure precopy phase would be effective.
>>>>
>>>> As currently defined, initial_bytes can only decrease as it's being 
>>>> read
>>>> from the data fd. However, there are cases where a new chunk of
>>>> initial_bytes should be transferred during precopy.
>>>>
>>>> The new VFIO_PRECOPY_INFO_REINIT feature addresses this and allows
>>>> reporting a new value for initial_bytes regardless of any previously
>>>> reported values.
>>>>
>>>> Implement VFIO_PRECOPY_INFO_REINIT feature:
>>>> 1. Opt-in for VFIO_DEVICE_FEATURE_MIG_PRECOPY_INFOv2 to make
>>>>     VFIO_PRECOPY_INFO_REINIT available.
>>>> 2. Request a new switchover ACK if initial_bytes increases post of a
>>>>     previous switchover ACK. This ensures the device is not moved to
>>>>     STOP_COPY before initial_bytes has reached zero again.
>>>>
>>>> Acked-by: Peter Xu <peterx@redhat.com>
>>>> Signed-off-by: Avihai Horon <avihaih@nvidia.com>
>>>> Link: 
>>>> https://lore.kernel.org/qemu-devel/20260622101214.25770-13-
>>>> avihaih@nvidia.com
>>>> Signed-off-by: Cédric Le Goater <clg@redhat.com>
>>>> ---
>>>>   docs/devel/migration/vfio.rst     | 14 +++++++
>>>>   hw/vfio/vfio-migration-internal.h |  1 +
>>>>   hw/vfio/migration.c               | 68 
>>>> ++++++++++++++++++++++++++++---
>>>>   hw/vfio/trace-events              |  4 +-
>>>>   4 files changed, 80 insertions(+), 7 deletions(-)
>>>
>>>
>>>> +/* Returns 1 on success, 0 if not supported and negative errno on
>>>> failure */
>>>> +static int vfio_migration_set_precopy_info_v2(VFIODevice *vbasedev)
>>>> +{
>>>> +    uint64_t buf[DIV_ROUND_UP(sizeof(struct vfio_device_feature),
>>>> +                              sizeof(uint64_t))] = {};
>>>
>>> What is the point of using uint64_t[] here?
>>
>> Since there is no data payload in this case, it's mainly for consistency
>> with other VFIO_DEVICE_FEATURE ioctl call sites.
>
> Ah, I didn't noticed. Does the VFIO_DEVICE_FEATURE ioctl expect
> the buffer to be 64-bit aligned?

Nope.
AFAIU, the 64-bit alignment is for userspace, for the data payload to be 
aligned, in case it holds some 64-bit members.

>
>>
>> Thanks.
>>
>>>
>>>> +    struct vfio_device_feature *feature = (struct
>>>> vfio_device_feature *)buf;
>>>> +
>>>> +    feature->argsz = sizeof(buf);
>>>> +    feature->flags =
>>>> +        VFIO_DEVICE_FEATURE_SET |
>>>> VFIO_DEVICE_FEATURE_MIG_PRECOPY_INFOv2;
>>>> +    if (ioctl(vbasedev->fd, VFIO_DEVICE_FEATURE, feature)) {
>>>> +        if (errno == ENOTTY) {
>>>> +            return 0;
>>>> +        }
>>>> +
>>>> +        return -errno;
>>>> +    }
>>>> +
>>>> +    return 1;
>>>> +}
>>>
>


  reply	other threads:[~2026-07-03 12:55 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30  4:30 [PULL 00/23] vfio queue Cédric Le Goater
2026-06-30  4:30 ` [PULL 01/23] vfio/pci: Initialize rom_read_failed in vfio_pci_load_rom() Cédric Le Goater
2026-06-30  4:30 ` [PULL 02/23] vfio/pci: Fix information leak in vfio_rom_read() Cédric Le Goater
2026-06-30  4:30 ` [PULL 03/23] docs: Update vfio-user spec to describe DMA access mode bits Cédric Le Goater
2026-06-30  4:30 ` [PULL 04/23] vfio-user: validate VERSION replies Cédric Le Goater
2026-06-30  4:30 ` [PULL 05/23] vfio/iommufd: Merge .dma_map_file() into .dma_map() Cédric Le Goater
2026-06-30  4:30 ` [PULL 06/23] migration: Propagate errors in migration_completion_precopy() Cédric Le Goater
2026-06-30  4:30 ` [PULL 07/23] migration/ram: Use migration_bitmap_sync_precopy() for postcopy discard Cédric Le Goater
2026-06-30  4:30 ` [PULL 08/23] migration: Run final save_query_pending at switchover Cédric Le Goater
2026-07-03  8:05   ` Avihai Horon
2026-07-03  8:38     ` Lukas Straub
2026-07-03  8:44     ` Cédric Le Goater
2026-07-03 12:54       ` Avihai Horon
2026-07-03 14:01         ` Cédric Le Goater
2026-07-06  8:00           ` Avihai Horon
2026-07-06  8:12             ` Cédric Le Goater
2026-06-30  4:30 ` [PULL 09/23] migration: Log the approver in qemu_loadvm_approve_switchover() Cédric Le Goater
2026-06-30  4:30 ` [PULL 10/23] migration: Replace switchover_ack_needed SaveVMHandler Cédric Le Goater
2026-06-30  4:30 ` [PULL 11/23] migration: Rename switchover-ack code to legacy Cédric Le Goater
2026-06-30  4:30 ` [PULL 12/23] migration: Make switchover-ack re-usable Cédric Le Goater
2026-06-30  4:30 ` [PULL 13/23] migration: Fail migration if switchover-ack is requested after switchover decision Cédric Le Goater
2026-06-30  4:30 ` [PULL 14/23] vfio/migration: Extract VFIO_MIG_FLAG_DEV_INIT_DATA_SENT sending to helper Cédric Le Goater
2026-06-30  4:30 ` [PULL 15/23] vfio/migration: Add Error ** parameter to vfio_migration_init() Cédric Le Goater
2026-06-30  4:31 ` [PULL 16/23] vfio/migration: Add new switchover-ack mechanism Cédric Le Goater
2026-06-30  4:31 ` [PULL 17/23] vfio/migration: Implement VFIO_PRECOPY_INFO_REINIT feature Cédric Le Goater
2026-07-03  2:07   ` Philippe Mathieu-Daudé
2026-07-03  8:13     ` Avihai Horon
2026-07-03  9:16       ` Philippe Mathieu-Daudé
2026-07-03 12:55         ` Avihai Horon [this message]
2026-06-30  4:31 ` [PULL 18/23] vfio/migration: Check VFIO_PRECOPY_INFO_REINIT during switchover Cédric Le Goater
2026-06-30  4:31 ` [PULL 19/23] migration: Enable new switchover-ack Cédric Le Goater
2026-06-30  4:31 ` [PULL 20/23] iommufd: Introduce handler for device ATS support Cédric Le Goater
2026-06-30  4:31 ` [PULL 21/23] vfio/pci: Add ats property Cédric Le Goater
2026-06-30  4:31 ` [PULL 22/23] vfio/pci: Propagate errors in vfio_pci_load_rom() using Error API Cédric Le Goater
2026-06-30  4:31 ` [PULL 23/23] vfio/listener: Fix translated_addr for non-identity-mapped RAM sections Cédric Le Goater
2026-07-02 19:24 ` [PULL 00/23] vfio queue Stefan Hajnoczi
2026-07-03  7:41   ` Cédric Le Goater

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=c20103ff-c587-477e-a16b-66e2b63c4076@nvidia.com \
    --to=avihaih@nvidia.com \
    --cc=clg@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@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.