All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/17] vfio/migration: Implement VFIO migration protocol v2
@ 2022-11-03 16:16 Avihai Horon
  2022-11-03 16:16 ` [PATCH v3 01/17] migration: Remove res_compatible parameter Avihai Horon
                   ` (16 more replies)
  0 siblings, 17 replies; 59+ messages in thread
From: Avihai Horon @ 2022-11-03 16:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Williamson, Halil Pasic, Christian Borntraeger, Eric Farman,
	Richard Henderson, David Hildenbrand, Ilya Leoshkevich,
	Thomas Huth, Juan Quintela, Dr. David Alan Gilbert,
	Michael S. Tsirkin, Cornelia Huck, Paolo Bonzini,
	Stefan Hajnoczi, Fam Zheng, Eric Blake,
	Vladimir Sementsov-Ogievskiy, John Snow, qemu-s390x, qemu-block,
	Kunkun Jiang, Zhang, Chen, Yishai Hadas, Jason Gunthorpe,
	Maor Gottlieb, Shay Drory, Avihai Horon, Kirti Wankhede,
	Tarun Gupta, Joao Martins

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="y", Size: 6445 bytes --]

Hello,

A long time has passed since v2 of this series was posted. During this
time we had several KVM calls discussing the problems that were needed
to be solved in order to move forward.

This version of the series includes quite some changes, and I believe
that it addresses all the major problems we have discussed. Please see
below the updated patch list and change log from v2.

Following VFIO migration protocol v2 acceptance in kernel, this series
implements VFIO migration according to the new v2 protocol and replaces
the now deprecated v1 implementation.

The main differences between v1 and v2 migration protocols are:
1. VFIO device state is represented as a finite state machine instead of
   a bitmap.

2. The migration interface with kernel is done using VFIO_DEVICE_FEATURE
   ioctl and normal read() and write() instead of the migration region
   used in v1.

3. Migration protocol v2 currently doesn't support the pre-copy phase of
   migration.

Full description of the v2 protocol and the differences from v1 can be
found here [1].

Patch list:

Patches 1-4 are patches taken from Juan's RFC [2].
As discussed in the KVM call, since we are going to add a new ioctl to
get device data size while it's RUNNING, we don't need the stop and
resume VM functionality from the RFC.

Patches 5-11 are prep patches fixing bugs, adding QEMUFile function
that will be used later and refactoring v1 protocol code to make it
easier to add v2 protocol.

Patches 12-16 implement v2 protocol and remove v1 protocol.

Patch 17 is a preview patch (which is not for merging yet) that
demonstrates how the new ioctl to get device state size will work once
added.

Thanks.

Changes from v2 [3]:
- Rebased on top of latest master branch.

- Added relevant patches from Juan's RFC [2] with minor changes:
  1. Added Reviewed-by tag to patch #3 in the RFC.
  2. Adjusted patch #6 to work without patch #4 in the RFC.

- Added a new patch "vfio/migration: Fix wrong enum usage" that fixes a
  small bug in v1 code. This patch has been sent a few weeks ago [4] but
  wasn't taken yet.

- Patch #2 (vfio/migration: Skip pre-copy if dirty page tracking is not supported):
  1. Dropped this patch and replaced it with
     "vfio/migration: Allow migration without VFIO IOMMU dirty tracking support".
     The new patch uses a different approach – instead of skipping
     pre-copy phase completely, QEMU VFIO code will mark RAM dirty
     (instead of kernel). This ensures that current migration behavior
     is not changed and SLA is taken into account.

- Patch #4 (vfio/common: Change vfio_devices_all_running_and_saving() logic to equivalent one):
  1. Improved commit message to better explain the change.

- Patch #7 (vfio/migration: Implement VFIO migration protocol v2):
  1. Enhanced vfio_migration_set_state() error reporting.
  2. In vfio_save_complete_precopy() of v2 protocol - when changing
     device state to STOP, set recover state to ERROR instead of STOP as
     suggested by Joao.
  3. Constify SaveVMHandlers of v2 protocol.
  4. Modified trace_vfio_vmstate_change and trace_vfio_migration_set_state
     to print device state string instead of enum.
  5. Replaced qemu_put_buffer_async() with qemu_put_buffer() in
     vfio_save_block(), as requested by Juan.
  6. Implemented v2 protocol version of vfio_save_pending() as requested
     by Juan. Until ioctl to get device state size is added, we just
     report some big hard coded value, as agreed in KVM call.

- Patch #9 (vfio/migration: Reset device if setting recover state fails):
  1. Enhanced error reporting.
  2. Set VFIOMigration->device_state to RUNNING after device reset.

- Patch #11 (docs/devel: Align vfio-migration docs to VFIO migration v2):
  1. Adjusted vfio migration documentation to the added vfio_save_pending()

- Added the last patch (which is not for merging yet) that demonstrates
  how the new ioctl to get device state size will work once added.

Changes from v1 [5]:
- Split the big patch that replaced v1 with v2 into several patches as
  suggested by Joao, to make review easier.
- Change warn_report to warn_report_once when container doesn't support
  dirty tracking.
- Add Reviewed-by tag.

[1]
https://lore.kernel.org/all/20220224142024.147653-10-yishaih@nvidia.com/

[2]
https://lore.kernel.org/qemu-devel/20221003031600.20084-1-quintela@redhat.com/T/

[3]
https://lore.kernel.org/all/20220530170739.19072-1-avihaih@nvidia.com/

[4]
https://lore.kernel.org/all/20221016085752.32740-1-avihaih@nvidia.com/

[5]
https://lore.kernel.org/all/20220512154320.19697-1-avihaih@nvidia.com/

Avihai Horon (13):
  vfio/migration: Fix wrong enum usage
  vfio/migration: Fix NULL pointer dereference bug
  vfio/migration: Allow migration without VFIO IOMMU dirty tracking
    support
  migration/qemu-file: Add qemu_file_get_to_fd()
  vfio/common: Change vfio_devices_all_running_and_saving() logic to
    equivalent one
  vfio/migration: Move migration v1 logic to vfio_migration_init()
  vfio/migration: Rename functions/structs related to v1 protocol
  vfio/migration: Implement VFIO migration protocol v2
  vfio/migration: Remove VFIO migration protocol v1
  vfio/migration: Reset device if setting recover state fails
  vfio: Alphabetize migration section of VFIO trace-events file
  docs/devel: Align vfio-migration docs to VFIO migration v2
  vfio/migration: Query device data size in vfio_save_pending()

Juan Quintela (4):
  migration: Remove res_compatible parameter
  migration: No save_live_pending() method uses the QEMUFile parameter
  migration: Block migration comment or code is wrong
  migration: Simplify migration_iteration_run()

 docs/devel/vfio-migration.rst  |  68 ++--
 hw/s390x/s390-stattrib.c       |   8 +-
 hw/vfio/common.c               | 103 +++--
 hw/vfio/migration.c            | 669 +++++++++------------------------
 hw/vfio/trace-events           |  28 +-
 include/hw/vfio/vfio-common.h  |   8 +-
 include/migration/register.h   |  22 +-
 linux-headers/linux/vfio.h     |  13 +
 migration/block-dirty-bitmap.c |  10 +-
 migration/block.c              |  13 +-
 migration/migration.c          |  35 +-
 migration/qemu-file.c          |  34 ++
 migration/qemu-file.h          |   1 +
 migration/ram.c                |  10 +-
 migration/savevm.c             |  17 +-
 migration/savevm.h             |   6 +-
 migration/trace-events         |   2 +-
 17 files changed, 402 insertions(+), 645 deletions(-)

-- 
2.21.3



^ permalink raw reply	[flat|nested] 59+ messages in thread

end of thread, other threads:[~2022-11-29 10:42 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 16:16 [PATCH v3 00/17] vfio/migration: Implement VFIO migration protocol v2 Avihai Horon
2022-11-03 16:16 ` [PATCH v3 01/17] migration: Remove res_compatible parameter Avihai Horon
2022-11-08 17:52   ` Vladimir Sementsov-Ogievskiy
2022-11-10 13:36     ` Avihai Horon
2022-11-21  7:20       ` Avihai Horon
2022-11-23 18:23       ` Dr. David Alan Gilbert
2022-11-24 12:19         ` Avihai Horon
2022-11-03 16:16 ` [PATCH v3 02/17] migration: No save_live_pending() method uses the QEMUFile parameter Avihai Horon
2022-11-08 17:57   ` Vladimir Sementsov-Ogievskiy
2022-11-03 16:16 ` [PATCH v3 03/17] migration: Block migration comment or code is wrong Avihai Horon
2022-11-08 18:36   ` Vladimir Sementsov-Ogievskiy
2022-11-08 18:38     ` Vladimir Sementsov-Ogievskiy
2022-11-10 13:38     ` Avihai Horon
2022-11-21  7:21       ` Avihai Horon
2022-11-03 16:16 ` [PATCH v3 04/17] migration: Simplify migration_iteration_run() Avihai Horon
2022-11-08 18:56   ` Vladimir Sementsov-Ogievskiy
2022-11-10 13:42     ` Avihai Horon
2022-11-03 16:16 ` [PATCH v3 05/17] vfio/migration: Fix wrong enum usage Avihai Horon
2022-11-08 19:05   ` Vladimir Sementsov-Ogievskiy
2022-11-10 13:47     ` Avihai Horon
2022-11-03 16:16 ` [PATCH v3 06/17] vfio/migration: Fix NULL pointer dereference bug Avihai Horon
2022-11-08 19:08   ` Vladimir Sementsov-Ogievskiy
2022-11-03 16:16 ` [PATCH v3 07/17] vfio/migration: Allow migration without VFIO IOMMU dirty tracking support Avihai Horon
2022-11-15 23:36   ` Alex Williamson
2022-11-16 13:29     ` Avihai Horon
2022-11-03 16:16 ` [PATCH v3 08/17] migration/qemu-file: Add qemu_file_get_to_fd() Avihai Horon
2022-11-08 20:26   ` Vladimir Sementsov-Ogievskiy
2022-11-03 16:16 ` [PATCH v3 09/17] vfio/common: Change vfio_devices_all_running_and_saving() logic to equivalent one Avihai Horon
2022-11-03 16:16 ` [PATCH v3 10/17] vfio/migration: Move migration v1 logic to vfio_migration_init() Avihai Horon
2022-11-15 23:56   ` Alex Williamson
2022-11-16 13:39     ` Avihai Horon
2022-11-03 16:16 ` [PATCH v3 11/17] vfio/migration: Rename functions/structs related to v1 protocol Avihai Horon
2022-11-03 16:16 ` [PATCH v3 12/17] vfio/migration: Implement VFIO migration protocol v2 Avihai Horon
2022-11-16 18:29   ` Alex Williamson
2022-11-17 17:07     ` Avihai Horon
2022-11-17 17:24       ` Jason Gunthorpe
2022-11-20  8:46         ` Avihai Horon
2022-11-17 17:38       ` Alex Williamson
2022-11-20  9:34         ` Avihai Horon
2022-11-24 12:41           ` Avihai Horon
2022-11-28 18:50             ` Alex Williamson
2022-11-28 19:40               ` Jason Gunthorpe
2022-11-28 20:36                 ` Alex Williamson
2022-11-28 20:56                   ` Jason Gunthorpe
2022-11-28 21:10                     ` Alex Williamson
2022-11-29 10:40                       ` Avihai Horon
2022-11-23 18:59   ` Dr. David Alan Gilbert
2022-11-24 12:25     ` Avihai Horon
2022-11-24 13:28       ` Dr. David Alan Gilbert
2022-11-24 14:07         ` Avihai Horon
2022-11-03 16:16 ` [PATCH v3 13/17] vfio/migration: Remove VFIO migration protocol v1 Avihai Horon
2022-11-03 16:16 ` [PATCH v3 14/17] vfio/migration: Reset device if setting recover state fails Avihai Horon
2022-11-16 18:36   ` Alex Williamson
2022-11-17 17:11     ` Avihai Horon
2022-11-17 18:18       ` Alex Williamson
2022-11-20  9:39         ` Avihai Horon
2022-11-03 16:16 ` [PATCH v3 15/17] vfio: Alphabetize migration section of VFIO trace-events file Avihai Horon
2022-11-03 16:16 ` [PATCH v3 16/17] docs/devel: Align vfio-migration docs to VFIO migration v2 Avihai Horon
2022-11-03 16:16 ` [PATCH v3 17/17] vfio/migration: Query device data size in vfio_save_pending() Avihai Horon

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.