[RFC V1 05/12] iommufd: preserve device fd

2024-07-20 Thread Steve Sistare
Save the iommu and vfio device fd in CPR state when it is created, and fetch the fd from that state after CPR. Save the devid as the fd id. Remember that the fd was reused, for subsequent patches. Signed-off-by: Steve Sistare --- backends/iommufd.c | 12 +++- hw/vfio/iommufd.c

[RFC V1 11/12] iommufd: update DMA virtual addresses

2024-07-20 Thread Steve Sistare
Register a vmstate post_load handler to call IOMMU_IOAS_CHANGE_PROCESS and update the virtual address of all DMA mappings after CPR. Signed-off-by: Steve Sistare --- backends/iommufd.c | 81 +- 1 file changed, 80 insertions(+), 1 deletion

[RFC V1 07/12] iommufd: change_process kernel interface

2024-07-20 Thread Steve Sistare
Define IOMMU_IOAS_CHANGE_PROCESS for use by CPR. This interface is preliminary. Signed-off-by: Steve Sistare --- linux-headers/linux/iommufd.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/linux-headers/linux/iommufd.h b/linux-headers/linux/iommufd.h index 72e8f4b

[RFC V1 12/12] vfio: mdev blocker

2024-07-20 Thread Steve Sistare
Block CPR if the container has any mdevs (mediated devices). CPR is not supported for legacy containers and mdevs. It will be supported for iommufd containers with mdevs in a future patch. Signed-off-by: Steve Sistare --- hw/vfio/pci.c | 10 ++ include/hw/vfio

[RFC V1 06/12] iommufd: export iommufd_cdev_get_info_iova_range

2024-07-20 Thread Steve Sistare
Export iommufd_cdev_get_info_iova_range for use by CPR. No functional change. Signed-off-by: Steve Sistare --- hw/vfio/iommufd.c | 4 ++-- include/hw/vfio/vfio-common.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c index

[RFC V1 08/12] vfio/iommufd: register container for cpr

2024-07-20 Thread Steve Sistare
Register a vfio iommufd container for CPR. Add a blocker if the kernel does not support IOMMU_IOAS_CHANGE_PROCESS. Signed-off-by: Steve Sistare --- backends/iommufd.c| 8 ++ hw/vfio/cpr-iommufd.c | 60 +++ hw/vfio/iommufd.c

[RFC V1 09/12] vfio/iommufd: rebuild device

2024-07-20 Thread Steve Sistare
was already already mapped by the device, so suppress map and unmap during CPR -- eg, if the reused flag is set. Clear the reused flag in the post_load handler. Signed-off-by: Steve Sistare --- backends/iommufd.c| 8 hw/vfio/cpr-iommufd.c | 24 hw/vfio/iommufd.c

[RFC V1 01/12] vfio: move cpr_exec_notifier

2024-07-20 Thread Steve Sistare
Move the cpr notifier to the base container. This change will be squashed into the "live update: vfio" series. Signed-off-by: Steve Sistare --- hw/vfio/cpr-legacy.c | 10 +- include/hw/vfio/vfio-common.h | 1 - include/hw/vfio/vfio-container-base.h

[RFC V1 04/12] migration: cpr_find_fd_any

2024-07-20 Thread Steve Sistare
Add a function for finding a CPR fd by name, for any value of id, and return the id. Signed-off-by: Steve Sistare --- include/migration/cpr.h | 1 + migration/cpr.c | 15 +++ 2 files changed, 16 insertions(+) diff --git a/include/migration/cpr.h b/include/migration/cpr.h

[RFC V1 03/12] iommufd: pass name to connect

2024-07-20 Thread Steve Sistare
Pass device name to iommufd_backend_connect and iommufd_backend_disconnect, for use by CPR in a subsequent patch. No functional change. Signed-off-by: Steve Sistare --- backends/iommufd.c | 4 ++-- hw/vfio/iommufd.c| 6 +++--- include/sysemu/iommufd.h | 5 +++-- 3 files changed

[RFC V1 00/12] Live update: iommufd

2024-07-20 Thread Steve Sistare
interface which is a work in progress: iommufd live update https://lore.kernel.org/linux-iommu/1721501805-86928-1-git-send-email-steven.sist...@oracle.com Steve Sistare (12): vfio: move cpr_exec_notifier iommufd: no DMA to BARs iommufd: pass name to connect migration: cpr_find_fd_any

[RFC V1 02/12] iommufd: no DMA to BARs

2024-07-20 Thread Steve Sistare
address) Signed-off-by: Steve Sistare --- hw/vfio/common.c | 3 ++- hw/vfio/helpers.c | 1 + include/exec/memory.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index da2e0ec..403d45a 100644 --- a/hw/vfio/common.c +++ b/hw/vfio

[RFC V1 10/12] migration/ram: old host address

2024-07-20 Thread Steve Sistare
Remember the RAMBlock host address as host_old during migration, for use by CPR. The iommufd interface to update the virtual address of DMA mappings requires it. Signed-off-by: Steve Sistare --- hw/core/machine.c | 6 ++ include/exec/ramblock.h | 1 + migration/migration.h | 2

[RFC V1 4/7] vdpa/cpr: kernel interfaces

2024-07-12 Thread Steve Sistare
Add the proposed vdpa kernel interfaces for CPR: VHOST_NEW_OWNER: new ioctl VHOST_BACKEND_F_NEW_OWNER: new capability VHOST_IOTLB_REMAP: new iotlb message VHOST_BACKEND_F_IOTLB_REMAP: new capability Signed-off-by: Steve Sistare --- include/standard-headers/linux/vhost_types.h | 7

[RFC V1 0/7] Live update: vdpa

2024-07-12 Thread Steve Sistare
for DMA. This series does not add any user-visible interfaces. Steve Sistare (7): migration: cpr_needed_for_reuse migration: skip dirty memory tracking for cpr vdpa/cpr: preserve device fd vdpa/cpr: kernel interfaces vdpa/cpr: use VHOST_NEW_OWNER vdpa/cpr: pass shadow parameter to dma

[RFC V1 1/7] migration: cpr_needed_for_reuse

2024-07-12 Thread Steve Sistare
Define a vmstate "needed" helper. This will be moved to the preceding patch series "Live update: cpr-exec" because it is needed by multiple devices. Signed-off-by: Steve Sistare --- include/migration/cpr.h | 1 + migration/cpr.c | 5 + 2 files changed, 6 inser

[RFC V1 6/7] vdpa/cpr: pass shadow parameter to dma functions

2024-07-12 Thread Steve Sistare
Pass a parameter to the dma mapping functions that indicates if the memory backs rings or buffers for svq's. No functional change. Signed-off-by: Steve Sistare --- hw/virtio/vhost-vdpa.c | 19 ++- include/hw/virtio/vhost-vdpa.h | 4 ++-- net/vhost-vdpa.c

[RFC V1 7/7] vdpa/cpr: preserve dma mappings

2024-07-12 Thread Steve Sistare
. Their pages are not locked in memory, and they are re-created after CPR. Signed-off-by: Steve Sistare --- hw/virtio/trace-events| 4 ++-- hw/virtio/vhost-vdpa.c| 30 +- scripts/tracetool/__init__.py | 2 +- 3 files changed, 28 insertions(+), 8 deletions

[RFC V1 3/7] vdpa/cpr: preserve device fd

2024-07-12 Thread Steve Sistare
Save the vdpa device fd in CPR state when it is created, and fetch the fd from that state after CPR. Remember that the fd was reused, for subsequent patches. Signed-off-by: Steve Sistare --- include/hw/virtio/vhost-vdpa.h | 3 +++ net/vhost-vdpa.c | 24

[RFC V1 5/7] vdpa/cpr: use VHOST_NEW_OWNER

2024-07-12 Thread Steve Sistare
Block CPR if the kernel does not support VHOST_NEW_OWNER. After CPR, call VHOST_NEW_OWNER in new QEMU. Signed-off-by: Steve Sistare --- hw/virtio/trace-events| 1 + hw/virtio/vhost-vdpa.c| 24 ++-- include/hw/virtio/vhost.h | 1 + 3 files changed, 24 insertions

[RFC V1 2/7] migration: skip dirty memory tracking for cpr

2024-07-12 Thread Steve Sistare
CPR preserves memory in place, so there is no need to track dirty memory. By skipping it, CPR can support devices that do not support tracking. Signed-off-by: Steve Sistare --- system/memory.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/system/memory.c b/system/memory.c

[PATCH V1 5/8] vfio-pci: cpr part 2 (msi)

2024-07-09 Thread Steve Sistare
Finish CPR for vfio-pci MSI/MSI-X devices by preserving eventfd's and vector state. Signed-off-by: Steve Sistare --- hw/vfio/pci.c | 117 +- 1 file changed, 116 insertions(+), 1 deletion(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index

[PATCH V1 8/8] vfio-pci: recover from unmap-all-vaddr failure

2024-07-09 Thread Steve Sistare
a new "remap" flag that tells it to restore a mapping without re-allocating new userland data structures. Signed-off-by: Steve Sistare --- hw/vfio/common.c | 45 --- hw/vfio/cpr-legacy.c

[PATCH V1 4/8] vfio-pci: cpr part 1 (fd and dma)

2024-07-09 Thread Steve Sistare
resumes the VM. This functionality is delivered by 3 patches for clarity. Part 1 handles device file descriptors and DMA. Part 2 adds eventfd and MSI/MSI-X vector support. Part 3 adds INTX support. Signed-off-by: Steve Sistare --- hw/pci/pci.c | 13 hw/vfio/common.c

[PATCH V1 2/8] pci: export msix_is_pending

2024-07-09 Thread Steve Sistare
Export msix_is_pending for use by cpr. No functional change. Signed-off-by: Steve Sistare Acked-by: Michael S. Tsirkin --- hw/pci/msix.c | 2 +- include/hw/pci/msix.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/pci/msix.c b/hw/pci/msix.c index 487e498

[PATCH V1 3/8] vfio-pci: refactor for cpr

2024-07-09 Thread Steve Sistare
Refactor vector use into a helper vfio_vector_init. Add vfio_notifier_init and vfio_notifier_cleanup for named notifiers, and pass additional arguments to vfio_remove_kvm_msi_virq. All for use by CPR in a subsequent patch. No functional change. Signed-off-by: Steve Sistare --- hw/vfio/pci.c

[PATCH V1 6/8] vfio-pci: cpr part 3 (intx)

2024-07-09 Thread Steve Sistare
initialization, but still perform kvm initialization. Signed-off-by: Steve Sistare --- hw/vfio/pci.c | 51 +++ 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index f0213e0..b5e7592 100644 --- a/hw/vfio/pci.c

[PATCH V1 7/8] vfio: vfio_find_ram_discard_listener

2024-07-09 Thread Steve Sistare
Define vfio_find_ram_discard_listener as a subroutine so additional calls to it may be added in a subsequent patch. Signed-off-by: Steve Sistare --- hw/vfio/common.c | 35 ++- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/hw/vfio/common.c b/hw

[PATCH V1 0/8] Live update: vfio

2024-07-09 Thread Steve Sistare
/qemu-devel/1658851843-236870-1-git-send-email-steven.sist...@oracle.com/ This series depends on the following, which is based on commit 44b7329de469: [PATCH V2 00/11] Live update: cpr-exec https://lore.kernel.org/qemu-devel/1719776434-435013-1-git-send-email-steven.sist...@oracle.com/ Steve

[PATCH V1 1/8] migration: cpr_needed_for_reuse

2024-07-09 Thread Steve Sistare
Define a vmstate "needed" helper. This will be moved to the preceding patch series "Live update: cpr-exec" because it is needed by multiple devices. Signed-off-by: Steve Sistare --- include/migration/cpr.h | 1 + migration/cpr.c | 5 + 2 files changed, 6 inser

[RFC V1 2/6] migration: VMSTATE_FD

2024-06-30 Thread Steve Sistare
Define VMSTATE_FD for declaring a file descriptor field in a VMStateDescription. Signed-off-by: Steve Sistare --- include/migration/vmstate.h | 9 + migration/vmstate-types.c | 32 2 files changed, 41 insertions(+) diff --git a/include/migration

[RFC V1 6/6] migration: cpr-transfer mode

2024-06-30 Thread Steve Sistare
which must support SCM_RIGHTS, and they are mmap'd in new QEMU. Signed-off-by: Steve Sistare --- migration/cpr.c | 9 - migration/migration.c | 37 + migration/ram.c | 1 + migration/vmstate-types.c | 5 +++-- qapi/migr

[RFC V1 3/6] migration: cpr-transfer save and load

2024-06-30 Thread Steve Sistare
Add functions to create a QEMUFile based on a unix URI, for saving or loading, for use by cpr-transfer mode to preserve CPR state. Signed-off-by: Steve Sistare --- include/migration/cpr.h | 3 ++ migration/cpr-transfer.c | 81 migration

[RFC V1 1/6] migration: SCM_RIGHTS for QEMUFile

2024-06-30 Thread Steve Sistare
Define functions to put/get file descriptors to/from a QEMUFile, for qio channels that support SCM_RIGHTS. Maintain ordering such that put(A), put(fd), put(B) followed by get(A), get(fd), get(B) always succeeds. Other get orderings may succeed but are not guaranteed. Signed-off-by: Steve

[RFC V1 5/6] migration: cpr-uri option

2024-06-30 Thread Steve Sistare
Define the cpr-uri QEMU command-line option to specify the URI from which CPR vmstate is loaded for cpr-transfer mode. Signed-off-by: Steve Sistare --- include/migration/cpr.h | 1 + migration/cpr.c | 7 +++ qemu-options.hx | 8 system/vl.c | 3 +++ 4

[RFC V1 0/6] Live update: cpr-transfer

2024-06-30 Thread Steve Sistare
nformation (qemu) info status VM status: running Steve Sistare (6): migration: SCM_RIGHTS for QEMUFile migration: VMSTATE_FD migration: cpr-transfer save and load migration: cpr-uri parameter migration: cpr-uri option migration: cpr-transfer mode include/migration/cpr.h| 4 +

[RFC V1 4/6] migration: cpr-uri parameter

2024-06-30 Thread Steve Sistare
Define the cpr-uri migration parameter to specify the URI to which CPR vmstate is saved for cpr-transfer mode. Signed-off-by: Steve Sistare --- migration/migration-hmp-cmds.c | 10 ++ migration/options.c| 29 + migration/options.h| 1

[PATCH V2 05/11] physmem: preserve ram blocks for cpr

2024-06-30 Thread Steve Sistare
to guard against that length changing, use lseek to get the actual length of an incoming memfd. Signed-off-by: Steve Sistare --- system/physmem.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/system/physmem.c b/system/physmem.c index efe95ff..e37352e

[PATCH V2 10/11] migration: cpr-exec save and load

2024-06-30 Thread Steve Sistare
To preserve CPR state across exec, create a QEMUFile based on a memfd, and keep the memfd open across exec. Save the value of the memfd in an environment variable so post-exec QEMU can find it. These new functions are called in a subsequent patch. Signed-off-by: Steve Sistare --- include

[PATCH V2 11/11] migration: cpr-exec mode

2024-06-30 Thread Steve Sistare
for memory-backend-memfd. Signed-off-by: Steve Sistare --- include/migration/cpr.h | 2 ++ migration/cpr-exec.c| 85 + migration/cpr.c | 37 ++--- migration/migration.c | 14 ++-- migration/ram.c | 2 ++ qapi

[PATCH V2 03/11] migration: save cpr mode

2024-06-30 Thread Steve Sistare
Save the mode in CPR state, so the user does not need to explicitly specify it for the target. Modify migrate_mode() so it returns the incoming mode on the target. Signed-off-by: Steve Sistare --- include/migration/cpr.h | 7 +++ migration/cpr.c | 23

[PATCH V2 04/11] migration: stop vm earlier for cpr

2024-06-30 Thread Steve Sistare
Stop the vm earlier for cpr, to guarantee consistent device state when CPR state is saved. Signed-off-by: Steve Sistare --- migration/migration.c | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index

[PATCH V2 08/11] vl: helper to request exec

2024-06-30 Thread Steve Sistare
Add a qemu_system_exec_request() hook that causes the main loop to exit and exec a command using the specified arguments. This will be used during CPR to exec a new version of QEMU. Signed-off-by: Steve Sistare --- include/sysemu/runstate.h | 3 +++ system/runstate.c | 29

[PATCH V2 01/11] machine: alloc-anon option

2024-06-30 Thread Steve Sistare
a new RAM flag, at the lowest level the implementation uses RAM_SHARED with fd=-1 as the condition for calling memfd_create. Signed-off-by: Steve Sistare --- hw/core/machine.c | 24 include/hw/boards.h | 1 + qapi/machine.json | 14 ++ qemu-options.hx

[PATCH V2 07/11] oslib: qemu_clear_cloexec

2024-06-30 Thread Steve Sistare
Define qemu_clear_cloexec, analogous to qemu_set_cloexec. Signed-off-by: Steve Sistare Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Marc-André Lureau Reviewed-by: Fabiano Rosas --- include/qemu/osdep.h | 9 + util/oslib-posix.c | 9 + util/oslib-win32.c | 4 3

[PATCH V2 09/11] migration: cpr-exec-command parameter

2024-06-30 Thread Steve Sistare
' command. Signed-off-by: Steve Sistare --- hmp-commands.hx| 2 +- migration/migration-hmp-cmds.c | 25 + migration/options.c| 14 ++ qapi/migration.json| 21 ++--- 4 files changed, 58 insertions(+), 4

[PATCH V2 00/11] Live update: cpr-exec

2024-06-30 Thread Steve Sistare
ches below are foundational and are needed for both cpr-exec mode and cpr-transfer mode. The last 5 patches are specific to cpr-exec and implement the mechanisms for sharing state across exec. Steve Sistare (11): machine: alloc-anon option migration: cpr-state migration: save cpr mode migration: stop

[PATCH V2 06/11] migration: fix mismatched GPAs during cpr

2024-06-30 Thread Steve Sistare
's address if the target region does not have an address yet. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas --- include/exec/memory.h | 12 migration/ram.c | 15 +-- system/memory.c | 10 -- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git

[PATCH V2 02/11] migration: cpr-state

2024-06-30 Thread Steve Sistare
process will be specific to each migration mode, and added in subsequent patches. Signed-off-by: Steve Sistare --- include/migration/cpr.h | 21 ++ migration/cpr.c | 188 migration/meson.build | 1 + migration/migration.c | 6

[PATCH V1 21/26] migration: migrate_add_blocker_mode

2024-04-29 Thread Steve Sistare
Define a convenience function to add a migration blocker for a single mode. Signed-off-by: Steve Sistare --- include/migration/blocker.h | 7 +++ migration/migration.c | 5 + stubs/migr-blocker.c| 5 + 3 files changed, 17 insertions(+) diff --git a/include/migration

[PATCH V1 08/26] migration: vmstate_info_void_ptr

2024-04-29 Thread Steve Sistare
Define VMSTATE_VOID_PTR so the value of a pointer (but not its target) can be saved in the migration stream. This will be needed for CPR. Signed-off-by: Steve Sistare --- include/migration/vmstate.h | 15 +++ migration/vmstate-types.c | 24 2 files

[PATCH V1 07/26] migration: VMStateId

2024-04-29 Thread Steve Sistare
Define a type for the 256 byte id string to guarantee the same length is used and enforced everywhere. Signed-off-by: Steve Sistare --- include/exec/ramblock.h | 3 ++- include/migration/vmstate.h | 2 ++ migration/savevm.c | 8 migration/vmstate.c | 3 ++- 4 files

[PATCH V1 13/26] physmem: ram_block_create

2024-04-29 Thread Steve Sistare
Create a common subroutine to allocate a RAMBlock, de-duping the code to populate its common fields. Add a trace point for good measure. No functional change. Signed-off-by: Steve Sistare --- system/physmem.c| 47 ++- system/trace-events | 3

[PATCH V1 19/26] physmem: preserve ram blocks for cpr

2024-04-29 Thread Steve Sistare
CPR with iommufd. Preserve guest_memfd, even though CPR does not yet support it, to maintain vmstate compatibility when it becomes supported. Signed-off-by: Steve Sistare --- include/exec/ramblock.h | 6 ++ system/physmem.c| 40 2 files chan

[PATCH V1 00/26] Live update: cpr-exec

2024-04-29 Thread Steve Sistare
implements a minimal version of cpr-exec. Future series will add support for: * vfio * chardev's without loss of connectivity * vhost * fine-grained seccomp controls * hostmem-memfd * cpr-exec migration test Steve Sistare (26): oslib: qemu_clear_cloexec vl: helper to request re-exec

[PATCH V1 03/26] migration: SAVEVM_FOREACH

2024-04-29 Thread Steve Sistare
-off-by: Steve Sistare --- migration/savevm.c | 55 +++--- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 4509482..6829ba3 100644 --- a/migration/savevm.c +++ b/migration/savevm.c

[PATCH V1 15/26] physmem: hoist host memory allocation

2024-04-29 Thread Steve Sistare
Hoist host memory allocation from ram_block_add. No functional change. Signed-off-by: Steve Sistare --- system/physmem.c | 80 +--- 1 file changed, 36 insertions(+), 44 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index

[PATCH V1 14/26] physmem: hoist guest_memfd creation

2024-04-29 Thread Steve Sistare
Do not modify RAMBlocks in ram_block_add. The block should be fully formed before calling ram_block_add to add it to the block list. This will simplify error handling and be more modular. Start by hoisting guest_memfd creation to the call sites. No functional change. Signed-off-by: Steve

[PATCH V1 24/26] seccomp: cpr-exec blocker

2024-04-29 Thread Steve Sistare
cpr-exec mode needs permission to exec. Block it if permission is denied. Signed-off-by: Steve Sistare --- include/sysemu/seccomp.h | 1 + system/qemu-seccomp.c| 10 -- system/vl.c | 6 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include

[PATCH V1 26/26] migration: only-migratable-modes

2024-04-29 Thread Steve Sistare
Add the only-migratable-modes option as a generalization of only-migratable. Only devices that support all requested modes are allowed. Signed-off-by: Steve Sistare --- include/migration/misc.h | 3 +++ include/sysemu/sysemu.h| 1 - migration/migration-hmp-cmds.c | 26

[PATCH V1 05/26] migration: precreate vmstate

2024-04-29 Thread Steve Sistare
and qemu_savevm_precreate_load, but these functions are not yet called in this patch. Allow them to be called before or after normal migration is active, when current_migration and current_incoming are not valid. Signed-off-by: Steve Sistare --- include/migration/vmstate.h | 6 migration

[PATCH V1 16/26] physmem: set ram block idstr earlier

2024-04-29 Thread Steve Sistare
to these dependencies changing) by the time vmstate_register_ram is called (where the id was previously assigned). Signed-off-by: Steve Sistare --- include/exec/cpu-common.h | 3 +-- migration/savevm.c| 4 +--- system/physmem.c | 46 +++--- 3 files

[PATCH V1 10/26] migration: vmstate_unregister_named

2024-04-29 Thread Steve Sistare
Define an accessor to find vmstate state handler by name and id and unregister it. This is needed to unregister a specific instance of an object that is not an Object, since it lacks the VMStateIf get_id hook. Signed-off-by: Steve Sistare --- include/migration/vmstate.h | 9

[PATCH V1 23/26] migration: misc cpr-exec blockers

2024-04-29 Thread Steve Sistare
Add blockers for cpr-exec migration mode for devices and options that do not support it. Signed-off-by: Steve Sistare --- accel/xen/xen-all.c| 5 + backends/hostmem-epc.c | 12 ++-- hw/vfio/migration.c| 3 ++- replay/replay.c| 6 ++ 4 files changed, 23

[PATCH V1 20/26] migration: cpr-exec mode

2024-04-29 Thread Steve Sistare
for memory-backend-memfd, and for additional devices, including vfio, chardev, and more. Signed-off-by: Steve Sistare --- include/migration/cpr.h | 14 + include/migration/misc.h | 3 ++ migration/cpr.c | 131 +++ migration/meson.build| 1

[PATCH V1 09/26] migration: vmstate_register_named

2024-04-29 Thread Steve Sistare
Define vmstate_register_named which takes the instance name as its first parameter, instead of generating the name from VMStateIf of the Object. This will be needed to register objects that are not Objects. Pass the new name parameter to vmstate_register_with_alias_id. Signed-off-by: Steve

[PATCH V1 25/26] migration: fix mismatched GPAs during cpr-exec

2024-04-29 Thread Steve Sistare
not occur on the target, causing a "Mismatched GPAs" error during cpr-exec migration. To fix, unconditionally set the target's address to the source's address if the region does not have an address yet. Signed-off-by: Steve Sistare --- include/exec/memory.h | 12 migration/ram.c

[PATCH V1 22/26] migration: ram block cpr-exec blockers

2024-04-29 Thread Steve Sistare
. Preserving guest_memfd may be sufficient for cpr-exec, but it has not been tested yet. - Steve Signed-off-by: Steve Sistare --- include/exec/memory.h | 3 +++ include/exec/ramblock.h | 1 + migration/savevm.c | 2 ++ system/physmem.c| 52

[PATCH V1 18/26] migration: cpr-exec-args parameter

2024-04-29 Thread Steve Sistare
Create the cpr-exec-args migration parameter, defined as a list of strings. It will be used for cpr-exec migration mode in a subsequent patch. No functional change, except that cpr-exec-args is shown by the 'info migrate' command. Signed-off-by: Steve Sistare --- hmp-commands.hx

[PATCH V1 12/26] migration: vmstate factory object

2024-04-29 Thread Steve Sistare
-specific code. A factory is a registered VMStateDescription with factory=true and instance_id VMSTATE_INSTANCE_ID_FACTORY. A factory object is registered using the same VMStateDescription, but with its own instance_name and instance_id. Signed-off-by: Steve Sistare --- include/migration

[PATCH V1 04/26] migration: delete unused parameter mis

2024-04-29 Thread Steve Sistare
Signed-off-by: Steve Sistare --- migration/savevm.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 6829ba3..9789823 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2591,8 +2591,7 @@ static bool

[PATCH V1 01/26] oslib: qemu_clear_cloexec

2024-04-29 Thread Steve Sistare
Define qemu_clear_cloexec, analogous to qemu_set_cloexec. Signed-off-by: Steve Sistare Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Marc-André Lureau --- include/qemu/osdep.h | 9 + util/oslib-posix.c | 9 + util/oslib-win32.c | 4 3 files changed, 22 insertions

[PATCH V1 17/26] machine: memfd-alloc option

2024-04-29 Thread Steve Sistare
Allocate anonymous memory using memfd_create if the memfd-alloc machine option is set. Signed-off-by: Steve Sistare --- hw/core/machine.c | 22 ++ include/hw/boards.h | 1 + qemu-options.hx | 6 ++ system/memory.c | 9 ++--- system/physmem.c| 18

[PATCH V1 11/26] migration: vmstate_register at init time

2024-04-29 Thread Steve Sistare
requiring that qemu call an object-specific initialization function. Signed-off-by: Steve Sistare --- include/migration/vmstate.h | 18 ++ migration/savevm.c | 32 system/vl.c | 3 +++ 3 files changed, 53 insertions(+) diff

[PATCH V1 06/26] migration: precreate vmstate for exec

2024-04-29 Thread Steve Sistare
Provide migration_precreate_save for saving precreate vmstate across exec. Create a memfd, save its value in the environment, and serialize state to it. Reverse the process in migration_precreate_load. Signed-off-by: Steve Sistare --- include/migration/misc.h | 5 ++ migration/meson.build

[PATCH V1 02/26] vl: helper to request re-exec

2024-04-29 Thread Steve Sistare
Add a qemu_system_exec_request() hook that causes the main loop to exit and re-exec qemu using the specified arguments. Signed-off-by: Steve Sistare --- include/sysemu/runstate.h | 3 +++ system/runstate.c | 29 + 2 files changed, 32 insertions(+) diff

[PATCH] migration: cpr-reboot documentation

2024-03-13 Thread Steve Sistare
Signed-off-by: Steve Sistare --- docs/devel/migration/CPR.rst | 147 ++ docs/devel/migration/features.rst | 1 + 2 files changed, 148 insertions(+) create mode 100644 docs/devel/migration/CPR.rst diff --git a/docs/devel/migration/CPR.rst b/docs/devel

[PATCH V2 06/11] migration: migration_thread_is_self

2024-03-11 Thread Steve Sistare
Define and export migration_thread_is_self to eliminate a dependency on MigrationState. Signed-off-by: Steve Sistare --- include/migration/misc.h | 1 + migration/migration.c| 7 +++ system/dirtylimit.c | 5 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git

[PATCH V2 05/11] migration: export vcpu_dirty_limit_period

2024-03-11 Thread Steve Sistare
Define and export vcpu_dirty_limit_period to eliminate a dependency on MigrationState. Signed-off-by: Steve Sistare --- include/migration/client-options.h | 1 + migration/options.c| 7 +++ system/dirtylimit.c| 3 +-- 3 files changed, 9 insertions(+), 2

[PATCH V2 11/11] migration: purge MigrationState from public interface

2024-03-11 Thread Steve Sistare
Move remaining MigrationState references from the public file misc.h to the private file migration.h. Signed-off-by: Steve Sistare --- include/migration/misc.h | 6 ++ migration/migration.h| 6 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/migration

[PATCH V2 04/11] migration: export migration_is_running

2024-03-11 Thread Steve Sistare
Delete the MigrationState parameter from migration_is_running and move it to the public API in misc.h. Signed-off-by: Steve Sistare --- include/migration/misc.h | 1 + migration/migration.c | 10 ++ migration/migration.h | 2 -- migration/options.c| 4

[PATCH V2 07/11] migration: migration_is_device

2024-03-11 Thread Steve Sistare
Define and export migration_is_device to eliminate a dependency on MigrationState. Signed-off-by: Steve Sistare --- hw/vfio/common.c | 4 +--- include/migration/misc.h | 1 + migration/migration.c| 7 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/vfio

[PATCH V2 09/11] migration: privatize colo interfaces

2024-03-11 Thread Steve Sistare
Remove private migration interfaces from net/colo-compare.c and push them to migration/colo.c. Signed-off-by: Steve Sistare --- migration/colo.c | 17 +++-- net/colo-compare.c | 3 +-- stubs/colo.c | 1 - 3 files changed, 12 insertions(+), 9 deletions(-) diff --git

[PATCH V2 10/11] migration: delete unused accessors

2024-03-11 Thread Steve Sistare
Signed-off-by: Steve Sistare --- include/migration/misc.h | 3 --- migration/migration.c| 10 -- 2 files changed, 13 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index e521cd5..d563d2c 100644 --- a/include/migration/misc.h +++ b/include/migration

[PATCH V2 02/11] migration: export migration_is_setup_or_active

2024-03-11 Thread Steve Sistare
Delete the MigrationState parameter from migration_is_setup_or_active and move it to the public API in misc.h. Signed-off-by: Steve Sistare Reviewed-by: Philippe Mathieu-Daudé --- hw/vfio/common.c | 2 +- include/migration/misc.h | 1 + migration/migration.c| 12

[PATCH V2 00/11] privatize migration.h

2024-03-11 Thread Steve Sistare
these fixes, no code outside of migration includes migration.h, and no code outside of migration uses MigrationState. This series depends on the following: * singleton patch "migration: export fewer options" Changes in V2: * rebase to migration-next, add RB * split last patch Ste

[PATCH V2 08/11] migration: migration_file_set_error

2024-03-11 Thread Steve Sistare
Define and export migration_file_set_error to eliminate a dependency on MigrationState. Signed-off-by: Steve Sistare --- hw/vfio/common.c | 9 + hw/vfio/migration.c | 11 +++ include/migration/misc.h | 2 ++ migration/migration.c| 11 +++ 4 files

[PATCH V2 01/11] migration: remove migration.h references

2024-03-11 Thread Steve Sistare
Remove migration.h from files that no longer need it due to previous commits. Signed-off-by: Steve Sistare --- hw/vfio/container.c| 1 - hw/virtio/vhost-user.c | 1 - hw/virtio/virtio-balloon.c | 1 - system/qdev-monitor.c | 1 - target/loongarch/kvm/kvm.c | 1 - tests/unit

[PATCH V2 03/11] migration: export migration_is_active

2024-03-11 Thread Steve Sistare
Delete the MigrationState parameter from migration_is_active so it can be exported and used without including migration.h. Signed-off-by: Steve Sistare --- hw/vfio/common.c | 4 ++-- include/migration/misc.h | 2 +- migration/migration.c| 10 ++ system/dirtylimit.c

[PATCH V3] migration: export fewer options

2024-03-11 Thread Steve Sistare
the necessary few via misc.h, which already exports a portion of the client API. Signed-off-by: Steve Sistare --- Changes in V3: * rebase to migration-next --- --- hw/vfio/migration.c| 1 - hw/virtio/virtio-balloon.c | 1 - include/migration/client-options.h | 24

[PATCH V2] migration: massage cpr-reboot documentation

2024-02-29 Thread Steve Sistare
Re-wrap the cpr-reboot documentation to 70 columns, use '@' for cpr-reboot references, capitalize COLO and VFIO, and tweak the wording. Suggested-by: Markus Armbruster Signed-off-by: Steve Sistare --- qapi/migration.json | 36 +++- 1 file changed, 19 insertions

[PATCH] migration: re-format cpr-reboot documentation

2024-02-29 Thread Steve Sistare
Re-wrap the cpr-reboot documentation to 70 columns, use '@' for cpr-reboot references, and capitalize COLO. Suggested-by: Markus Armbruster Signed-off-by: Steve Sistare --- qapi/migration.json | 36 +++- 1 file changed, 19 insertions(+), 17 deletions(-) diff

[PATCH V1 09/10] migration: privatize colo interfaces

2024-02-27 Thread Steve Sistare
Remove private migration interfaces from net/colo-compare.c and push them to migration/colo.c. Signed-off-by: Steve Sistare --- migration/colo.c | 17 +++-- net/colo-compare.c | 3 +-- stubs/colo.c | 1 - 3 files changed, 12 insertions(+), 9 deletions(-) diff --git

[PATCH V1 07/10] migration: migration_is_device

2024-02-27 Thread Steve Sistare
Define and export migration_is_device to eliminate a dependency on MigrationState. Signed-off-by: Steve Sistare --- hw/vfio/common.c | 4 +--- include/migration/misc.h | 1 + migration/migration.c| 7 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/vfio

[PATCH V1 10/10] migration: purge MigrationState from public interface

2024-02-27 Thread Steve Sistare
Delete unused accessors and move remaining MigrationState references from the public file misc.h to the private file migration.h. Signed-off-by: Steve Sistare --- include/migration/misc.h | 9 ++--- migration/migration.c| 10 -- migration/migration.h| 6 ++ 3 files

[PATCH V1 01/10] migration: remove migration.h references

2024-02-27 Thread Steve Sistare
Remove migration.h from files that no longer need it due to previous commits. Signed-off-by: Steve Sistare --- hw/vfio/container.c| 1 - hw/virtio/vhost-user.c | 1 - hw/virtio/virtio-balloon.c | 1 - system/qdev-monitor.c | 1 - target/loongarch/kvm/kvm.c | 1 - tests/unit

[PATCH V1 00/10] privatize migration.h

2024-02-27 Thread Steve Sistare
these fixes, no code outside of migration includes migration.h, and no code outside of migration uses MigrationState. This series depends on the following: * migration patches in the series "allow cpr-reboot for vfio" * singleton patch "migration: export fewer options"

[PATCH V1 06/10] migration: migration_thread_is_self

2024-02-27 Thread Steve Sistare
Define and export migration_thread_is_self to eliminate a dependency on MigrationState. Signed-off-by: Steve Sistare --- include/migration/misc.h | 1 + migration/migration.c| 7 +++ system/dirtylimit.c | 5 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git

[PATCH V1 08/10] migration: migration_file_set_error

2024-02-27 Thread Steve Sistare
Define and export migration_file_set_error to eliminate a dependency on MigrationState. Signed-off-by: Steve Sistare --- hw/vfio/common.c | 9 + hw/vfio/migration.c | 11 +++ include/migration/misc.h | 2 ++ migration/migration.c| 11 +++ 4 files

[PATCH V1 05/10] migration: export vcpu_dirty_limit_period

2024-02-27 Thread Steve Sistare
Define and export vcpu_dirty_limit_period to eliminate a dependency on MigrationState. Signed-off-by: Steve Sistare --- include/migration/client-options.h | 1 + migration/options.c| 7 +++ system/dirtylimit.c| 3 +-- 3 files changed, 9 insertions(+), 2

  1   2   3   4   5   6   7   8   >