[PATCH V6 08/14] migration: preserve suspended for bg_migration

2023-11-30 Thread Steve Sistare
Do not wake a suspended guest during bg_migration, and restore the prior state at finish rather than unconditionally running. Allow the additional state transitions that occur. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas --- migration/migration.c | 7 +-- system/runstate.c

[PATCH V6 10/14] tests/qtest: option to suspend during migration

2023-11-30 Thread Steve Sistare
suspend_me offset is known. Generate the bootblock for each test, because suspend_me may differ for each. Signed-off-by: Steve Sistare Acked-by: Peter Xu --- tests/migration/i386/Makefile| 5 ++-- tests/migration/i386/a-b-bootblock.S | 50 +--- tests/migration

[PATCH V6 11/14] tests/qtest: precopy migration with suspend

2023-11-30 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly during live migration precopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare --- tests/qtest/migration-helpers.c | 3 ++ tests/qtest/migration-helpers.h | 2 ++ tests/qtest

[PATCH V6 00/14] fix migration of suspended runstate

2023-11-30 Thread Steve Sistare
7;s, but removed other RB's because the patches changed. Changes in V6: * all vm_stop calls completely stop the suspended state * refactored and updated the "cpus" patches * simplified the "preserve suspended" patches * added patch "bootfile per vm" Steve Sis

[PATCH V6 06/14] migration: preserve suspended runstate

2023-11-30 Thread Steve Sistare
running. Signed-off-by: Steve Sistare --- migration/migration.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 28a34c9..d1d94c4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -603,7 +603,7 @@ static

[PATCH V9 00/12] fix migration of suspended runstate

2024-01-03 Thread Steve Sistare
and its use of vm_was_suspended Changes in V9: * rebase to tip * update commit message and doc in "stop vm in suspended runstate" Steve Sistare (12): cpus: vm_was_suspended cpus: stop vm in suspended runstate cpus: check running not RUN_STATE_RUNNING cpus: vm_resume migration: p

[PATCH V9 07/12] migration: preserve suspended for snapshot

2024-01-03 Thread Steve Sistare
vm_stop to RUN_STATE_SAVE_VM and RUN_STATE_RESTORE_VM did not change runstate if the current state was suspended, but now it does, so allow these transitions. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/migration/snapshot.h | 7 +++ migration/migration-hmp-cmds.c | 8

[PATCH V9 06/12] migration: preserve suspended runstate

2024-01-03 Thread Steve Sistare
running. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- migration/migration.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3ce04b2..8124811 100644 --- a/migration/migration.c +++ b/migration/migration.c

[PATCH V9 12/12] tests/qtest: postcopy migration with suspend

2024-01-03 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly by live migration postcopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 20 +++- 1 file changed, 19

[PATCH V9 08/12] migration: preserve suspended for bg_migration

2024-01-03 Thread Steve Sistare
Do not wake a suspended guest during bg_migration, and restore the prior state at finish rather than unconditionally running. Allow the additional state transitions that occur. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 7

[PATCH V9 10/12] tests/qtest: option to suspend during migration

2024-01-03 Thread Steve Sistare
suspend_me offset is known. Generate the bootblock for each test, because suspend_me may differ for each. Signed-off-by: Steve Sistare Acked-by: Peter Xu Reviewed-by: Fabiano Rosas --- tests/migration/i386/Makefile| 5 ++-- tests/migration/i386/a-b-bootblock.S | 50

[PATCH V9 09/12] tests/qtest: migration events

2024-01-03 Thread Steve Sistare
Define a state object to capture events seen by migration tests, to allow more events to be captured in a subsequent patch, and simplify event checking in wait_for_migration_pass. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Daniel P. Berrangé

[PATCH V9 04/12] cpus: vm_resume

2024-01-03 Thread Steve Sistare
Define the vm_resume helper, for use in subsequent patches. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 9 + system/cpus.c | 9 + 2 files changed, 18 insertions(+) diff --git a/include/sysemu/runstate.h b/include/sysemu

[PATCH V9 03/12] cpus: check running not RUN_STATE_RUNNING

2024-01-03 Thread Steve Sistare
check the running boolean instead. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- backends/tpm/tpm_emulator.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/redirect.c | 2 +- hw/xen/xen-hvm-common.c | 2 +- 4 files changed, 4 insertions(+), 4

[PATCH V9 05/12] migration: propagate suspended runstate

2024-01-03 Thread Steve Sistare
If the outgoing machine was previously suspended, propagate that to the incoming side via global_state, so a subsequent vm_start restores the suspended state. To maintain backward and forward compatibility, reclaim some space from the runstate member. Signed-off-by: Steve Sistare Reviewed-by

[PATCH V9 01/12] cpus: vm_was_suspended

2024-01-03 Thread Steve Sistare
Add a state variable to remember if a vm previously transitioned into a suspended state. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 2 ++ system/cpus.c | 15 +++ 2 files changed, 17 insertions(+) diff --git a/include/sysemu

[PATCH V9 02/12] cpus: stop vm in suspended runstate

2024-01-03 Thread Steve Sistare
info status VM status: paused (suspended) (qemu) system_wakeup (qemu) info status VM status: running Suggested-by: Peter Xu Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 9 + qapi/misc.json| 11 +-- qapi/run-sta

[PATCH V9 11/12] tests/qtest: precopy migration with suspend

2024-01-03 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly during live migration precopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration-helpers.c | 3 ++ tests

[PATCH V2 06/11] migration: MigrationNotifyFunc

2024-01-12 Thread Steve Sistare
Define MigrationNotifyFunc to improve type safety and simplify migration notifiers. Signed-off-by: Steve Sistare --- hw/net/virtio-net.c | 4 +--- hw/vfio/migration.c | 3 +-- include/migration/misc.h | 5 - migration/migration.c| 4 ++-- net/vhost-vdpa.c | 6

[PATCH V2 01/11] notify: pass error to notifier with return

2024-01-12 Thread Steve Sistare
Pass an error object as the third parameter to "notifier with return" notifiers, so clients no longer need to bundle an error object in the opaque data. The new parameter is used in a later patch. Signed-off-by: Steve Sistare --- hw/virtio/vhost-user.c | 2 +- hw/virtio/virtio

[PATCH V2 04/11] migration: remove migration_in_postcopy parameter

2024-01-12 Thread Steve Sistare
Delete the explicit MigrationState parameter from migration_in_postcopy, so we can eliminate MigrationState from notifiers in a later patch. No functional change. Signed-off-by: Steve Sistare --- include/migration/misc.h | 2 +- migration/migration.c| 27 --- ui

[PATCH V2 05/11] migration: MigrationEvent for notifiers

2024-01-12 Thread Steve Sistare
: Steve Sistare --- hw/net/virtio-net.c | 12 +++- hw/vfio/migration.c | 8 +--- include/migration/misc.h | 5 + migration/migration.c| 5 - net/vhost-vdpa.c | 7 --- ui/spice-core.c | 9 + 6 files changed, 30 insertions(+), 16

[PATCH V2 08/11] migration: refactor migrate_fd_connect failures

2024-01-12 Thread Steve Sistare
Move common code for the error path in migrate_fd_connect to a shared fail label. No functional change. Signed-off-by: Steve Sistare --- migration/migration.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/migration/migration.c b/migration

[PATCH V2 02/11] migration: remove error from notifier data

2024-01-12 Thread Steve Sistare
Remove the error object from opaque data passed to notifiers. Use the new error parameter passed to the notifier instead. Signed-off-by: Steve Sistare --- hw/virtio/vhost-user.c | 8 include/migration/misc.h | 1 - migration/postcopy-ram.c | 1 - migration/postcopy-ram.h | 1

[PATCH V2 09/11] migration: notifier error checking

2024-01-12 Thread Steve Sistare
Check the status returned by migration notifiers and report errors. If notifiers fail, call the notifiers again so they can clean up. None of the notifiers return an error status at this time. Signed-off-by: Steve Sistare --- include/migration/misc.h | 2 +- migration/migration.c| 37

[PATCH V2 10/11] vfio: register container for cpr

2024-01-12 Thread Steve Sistare
Define entry points to perform per-container cpr-specific initialization and teardown. Signed-off-by: Steve Sistare --- hw/vfio/container.c | 11 ++- hw/vfio/cpr.c | 19 +++ hw/vfio/meson.build | 1 + include/hw/vfio/vfio-common.h

[PATCH V2 11/11] vfio: allow cpr-reboot migration if suspended

2024-01-12 Thread Steve Sistare
ch as by issuing guest-suspend-ram to the qemu guest agent. Relax the vfio blocker so it does not apply to cpr, and add a notifier that verifies the guest is suspended. Skip dirty page tracking, which is N/A for cpr, to avoid ioctl errors. Signed-off-by: Steve Sistare --- hw/vfio/com

[PATCH V2 00/11] allow cpr-reboot for vfio

2024-01-12 Thread Steve Sistare
ch as by issuing guest-suspend-ram to the qemu guest agent. Most of the patches in this series enhance migration notifiers so they can return an error status and message. The last two patches register a notifier for vfio that returns an error if the guest is not suspended. Steve Sistare (11): n

[PATCH V2 03/11] migration: convert to NotifierWithReturn

2024-01-12 Thread Steve Sistare
Change all migration notifiers to type NotifierWithReturn, so notifiers can return an error status in a future patch. For now, pass NULL for the notifier error parameter, and do not check the return value. Signed-off-by: Steve Sistare --- hw/net/virtio-net.c| 4 +++- hw/vfio

[PATCH V2 07/11] migration: per-mode notifiers

2024-01-12 Thread Steve Sistare
Keep a separate list of migration notifiers for each migration mode. Suggested-by: Peter Xu Signed-off-by: Steve Sistare --- include/migration/misc.h | 2 ++ migration/migration.c| 22 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/migration

[PATCH V4 0/5] string list functions

2024-01-12 Thread Steve Sistare
Add some handy string list functions for general use, and use them in live migration functions. These will also be needed for cpr exec mode. Changes in V4: * added exec migration patch Steve Sistare (5): util: strList_from_string qapi: QAPI_LIST_LENGTH util: strv_from_strList util

[PATCH V4 1/5] util: strList_from_string

2024-01-12 Thread Steve Sistare
Generalize hmp_split_at_comma() to take any delimiter string, rename as strList_from_string(), and move it to util/strList.c. No functional change. Signed-off-by: Steve Sistare --- include/monitor/hmp.h | 1 - include/qemu/strList.h | 24 monitor/hmp-cmds.c | 19

[PATCH V4 3/5] util: strv_from_strList

2024-01-12 Thread Steve Sistare
Signed-off-by: Steve Sistare Reviewed-by: Marc-André Lureau --- include/qemu/strList.h | 6 ++ util/strList.c | 14 ++ 2 files changed, 20 insertions(+) diff --git a/include/qemu/strList.h b/include/qemu/strList.h index 010237f..4b86aa6 100644 --- a/include/qemu

[PATCH V4 4/5] util: strList unit tests

2024-01-12 Thread Steve Sistare
Signed-off-by: Steve Sistare Reviewed-by: Marc-André Lureau --- tests/unit/meson.build| 1 + tests/unit/test-strList.c | 80 +++ 2 files changed, 81 insertions(+) create mode 100644 tests/unit/test-strList.c diff --git a/tests/unit/meson.build

[PATCH V4 2/5] qapi: QAPI_LIST_LENGTH

2024-01-12 Thread Steve Sistare
Signed-off-by: Steve Sistare Reviewed-by: Marc-André Lureau --- include/qapi/util.h | 13 + 1 file changed, 13 insertions(+) diff --git a/include/qapi/util.h b/include/qapi/util.h index 81a2b13..e1b8b1d 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -56,4 +56,17

[PATCH V4 5/5] migration: simplify exec migration functions

2024-01-12 Thread Steve Sistare
code uses g_steal_pointer which NULLs argv and prevents the destructor from running, but argv is leaked. Fixes: cbab4face57b ("migration: convert exec backend ...") Signed-off-by: Steve Sistare --- migration/exec.c | 58 1 file c

[PATCH V7 04/12] cpus: vm_resume

2023-12-06 Thread Steve Sistare
Define the vm_resume helper, for use in subsequent patches. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 9 + system/cpus.c | 9 + 2 files changed, 18 insertions(+) diff --git a/include/sysemu/runstate.h b/include/sysemu

[PATCH 05/14] cpus: check running not RUN_STATE_RUNNING

2023-12-06 Thread Steve Sistare
check the running boolean instead. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- backends/tpm/tpm_emulator.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/redirect.c | 2 +- hw/xen/xen-hvm-common.c | 2 +- 4 files changed, 4 insertions(+), 4

[PATCH V7 00/12] fix migration of suspended runstate

2023-12-06 Thread Steve Sistare
/qtest: bootfile per vm tests/qtest: background migration with suspend * rename runstate_is_started to runstate_is_live * move wait_for_suspend in tests Steve Sistare (12): cpus: vm_was_suspended cpus: stop vm in suspended runstate cpus: check running not RUN_STATE_RUNNING cpus: vm_r

[PATCH V7 05/12] migration: propagate suspended runstate

2023-12-06 Thread Steve Sistare
If the outgoing machine was previously suspended, propagate that to the incoming side via global_state, so a subsequent vm_start restores the suspended state. To maintain backward and forward compatibility, reclaim some space from the runstate member. Signed-off-by: Steve Sistare --- migration

[PATCH V7 09/12] tests/qtest: migration events

2023-12-06 Thread Steve Sistare
Define a state object to capture events seen by migration tests, to allow more events to be captured in a subsequent patch, and simplify event checking in wait_for_migration_pass. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Daniel P. Berrangé

[PATCH 11/14] tests/qtest: migration events

2023-12-06 Thread Steve Sistare
Define a state object to capture events seen by migration tests, to allow more events to be captured in a subsequent patch, and simplify event checking in wait_for_migration_pass. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Daniel P. Berrangé

[PATCH V7 03/12] cpus: check running not RUN_STATE_RUNNING

2023-12-06 Thread Steve Sistare
check the running boolean instead. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- backends/tpm/tpm_emulator.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/redirect.c | 2 +- hw/xen/xen-hvm-common.c | 2 +- 4 files changed, 4 insertions(+), 4

[PATCH 09/14] migration: preserve suspended for snapshot

2023-12-06 Thread Steve Sistare
vm_stop to RUN_STATE_SAVE_VM and RUN_STATE_RESTORE_VM did not change runstate if the current state was suspended, but now it does, so allow these transitions. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/migration/snapshot.h | 7 +++ migration/migration-hmp-cmds.c | 8

[PATCH V7 02/12] cpus: stop vm in suspended runstate

2023-12-06 Thread Steve Sistare
: Unable to wake up: guest is not in suspended state (qemu) cont (qemu) info status VM status: paused (suspended) (qemu) system_wakeup (qemu) info status VM status: running Suggested-by: Peter Xu Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu

[PATCH 01/14] temporary: define CLONE_NEWCGROUP qemu-8.2.0

2023-12-06 Thread Steve Sistare
--- system/qemu-seccomp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/system/qemu-seccomp.c b/system/qemu-seccomp.c index 4d7439e..9e1ff85 100644 --- a/system/qemu-seccomp.c +++ b/system/qemu-seccomp.c @@ -22,6 +22,7 @@ #include #include "sysemu/seccomp.h" #include +#define CLONE_NEWC

[PATCH 10/14] migration: preserve suspended for bg_migration

2023-12-06 Thread Steve Sistare
Do not wake a suspended guest during bg_migration, and restore the prior state at finish rather than unconditionally running. Allow the additional state transitions that occur. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 7

[PATCH 07/14] migration: propagate suspended runstate

2023-12-06 Thread Steve Sistare
If the outgoing machine was previously suspended, propagate that to the incoming side via global_state, so a subsequent vm_start restores the suspended state. To maintain backward and forward compatibility, reclaim some space from the runstate member. Signed-off-by: Steve Sistare --- migration

[PATCH V7 08/12] migration: preserve suspended for bg_migration

2023-12-06 Thread Steve Sistare
Do not wake a suspended guest during bg_migration, and restore the prior state at finish rather than unconditionally running. Allow the additional state transitions that occur. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 7

[PATCH 04/14] cpus: stop vm in suspended runstate

2023-12-06 Thread Steve Sistare
: Unable to wake up: guest is not in suspended state (qemu) cont (qemu) info status VM status: paused (suspended) (qemu) system_wakeup (qemu) info status VM status: running Suggested-by: Peter Xu Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu

[PATCH V7 01/12] cpus: vm_was_suspended

2023-12-06 Thread Steve Sistare
Add a state variable to remember if a vm previously transitioned into a suspended state. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 2 ++ system/cpus.c | 15 +++ 2 files changed, 17 insertions(+) diff --git a/include/sysemu

[PATCH 03/14] cpus: vm_was_suspended

2023-12-06 Thread Steve Sistare
Add a state variable to remember if a vm previously transitioned into a suspended state. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 2 ++ system/cpus.c | 15 +++ 2 files changed, 17 insertions(+) diff --git a/include/sysemu

[PATCH 12/14] tests/qtest: option to suspend during migration

2023-12-06 Thread Steve Sistare
suspend_me offset is known. Generate the bootblock for each test, because suspend_me may differ for each. Signed-off-by: Steve Sistare Acked-by: Peter Xu Reviewed-by: Fabiano Rosas --- tests/migration/i386/Makefile| 5 ++-- tests/migration/i386/a-b-bootblock.S | 50

[PATCH V7 12/12] tests/qtest: postcopy migration with suspend

2023-12-06 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly by live migration postcopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare --- tests/qtest/migration-test.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion

[PATCH 14/14] tests/qtest: postcopy migration with suspend

2023-12-06 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly by live migration postcopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare --- tests/qtest/migration-test.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion

[PATCH V7 07/12] migration: preserve suspended for snapshot

2023-12-06 Thread Steve Sistare
vm_stop to RUN_STATE_SAVE_VM and RUN_STATE_RESTORE_VM did not change runstate if the current state was suspended, but now it does, so allow these transitions. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/migration/snapshot.h | 7 +++ migration/migration-hmp-cmds.c | 8

[PATCH V7 11/12] tests/qtest: precopy migration with suspend

2023-12-06 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly during live migration precopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare --- tests/qtest/migration-helpers.c | 3 ++ tests/qtest/migration-helpers.h | 2 ++ tests/qtest

[PATCH V7 10/12] tests/qtest: option to suspend during migration

2023-12-06 Thread Steve Sistare
suspend_me offset is known. Generate the bootblock for each test, because suspend_me may differ for each. Signed-off-by: Steve Sistare Acked-by: Peter Xu Reviewed-by: Fabiano Rosas --- tests/migration/i386/Makefile| 5 ++-- tests/migration/i386/a-b-bootblock.S | 50

[PATCH 08/14] migration: preserve suspended runstate

2023-12-06 Thread Steve Sistare
running. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- migration/migration.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 28a34c9..52ba0bc 100644 --- a/migration/migration.c +++ b/migration/migration.c

[PATCH 13/14] tests/qtest: precopy migration with suspend

2023-12-06 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly during live migration precopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare --- tests/qtest/migration-helpers.c | 3 ++ tests/qtest/migration-helpers.h | 2 ++ tests/qtest

[PATCH 06/14] cpus: vm_resume

2023-12-06 Thread Steve Sistare
Define the vm_resume helper, for use in subsequent patches. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 9 + system/cpus.c | 9 + 2 files changed, 18 insertions(+) diff --git a/include/sysemu/runstate.h b/include/sysemu

[PATCH V7 06/12] migration: preserve suspended runstate

2023-12-06 Thread Steve Sistare
running. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- migration/migration.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3ce04b2..8124811 100644 --- a/migration/migration.c +++ b/migration/migration.c

[PATCH V7 00/12] fix migration of suspended runstate

2023-12-06 Thread Steve Sistare
/qtest: bootfile per vm tests/qtest: background migration with suspend * rename runstate_is_started to runstate_is_live * move wait_for_suspend in tests Steve Sistare (12): cpus: vm_was_suspended cpus: stop vm in suspended runstate cpus: check running not RUN_STATE_RUNNING cpus: vm_r

[PATCH V7 10/12] tests/qtest: option to suspend during migration

2023-12-06 Thread Steve Sistare
suspend_me offset is known. Generate the bootblock for each test, because suspend_me may differ for each. Signed-off-by: Steve Sistare Acked-by: Peter Xu Reviewed-by: Fabiano Rosas --- tests/migration/i386/Makefile| 5 ++-- tests/migration/i386/a-b-bootblock.S | 50

[PATCH V7 04/12] cpus: vm_resume

2023-12-06 Thread Steve Sistare
Define the vm_resume helper, for use in subsequent patches. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 9 + system/cpus.c | 9 + 2 files changed, 18 insertions(+) diff --git a/include/sysemu/runstate.h b/include/sysemu

[PATCH V7 12/12] tests/qtest: postcopy migration with suspend

2023-12-06 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly by live migration postcopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare --- tests/qtest/migration-test.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion

[PATCH V7 07/12] migration: preserve suspended for snapshot

2023-12-06 Thread Steve Sistare
vm_stop to RUN_STATE_SAVE_VM and RUN_STATE_RESTORE_VM did not change runstate if the current state was suspended, but now it does, so allow these transitions. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/migration/snapshot.h | 7 +++ migration/migration-hmp-cmds.c | 8

[PATCH V7 02/12] cpus: stop vm in suspended runstate

2023-12-06 Thread Steve Sistare
: Unable to wake up: guest is not in suspended state (qemu) cont (qemu) info status VM status: paused (suspended) (qemu) system_wakeup (qemu) info status VM status: running Suggested-by: Peter Xu Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu

[PATCH V7 09/12] tests/qtest: migration events

2023-12-06 Thread Steve Sistare
Define a state object to capture events seen by migration tests, to allow more events to be captured in a subsequent patch, and simplify event checking in wait_for_migration_pass. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Daniel P. Berrangé

[PATCH V7 03/12] cpus: check running not RUN_STATE_RUNNING

2023-12-06 Thread Steve Sistare
check the running boolean instead. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- backends/tpm/tpm_emulator.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/redirect.c | 2 +- hw/xen/xen-hvm-common.c | 2 +- 4 files changed, 4 insertions(+), 4

[PATCH V7 11/12] tests/qtest: precopy migration with suspend

2023-12-06 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly during live migration precopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare --- tests/qtest/migration-helpers.c | 3 ++ tests/qtest/migration-helpers.h | 2 ++ tests/qtest

[PATCH V7 01/12] cpus: vm_was_suspended

2023-12-06 Thread Steve Sistare
Add a state variable to remember if a vm previously transitioned into a suspended state. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 2 ++ system/cpus.c | 15 +++ 2 files changed, 17 insertions(+) diff --git a/include/sysemu

[PATCH V7 06/12] migration: preserve suspended runstate

2023-12-06 Thread Steve Sistare
running. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- migration/migration.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3ce04b2..8124811 100644 --- a/migration/migration.c +++ b/migration/migration.c

[PATCH V7 05/12] migration: propagate suspended runstate

2023-12-06 Thread Steve Sistare
If the outgoing machine was previously suspended, propagate that to the incoming side via global_state, so a subsequent vm_start restores the suspended state. To maintain backward and forward compatibility, reclaim some space from the runstate member. Signed-off-by: Steve Sistare --- migration

[PATCH V7 08/12] migration: preserve suspended for bg_migration

2023-12-06 Thread Steve Sistare
Do not wake a suspended guest during bg_migration, and restore the prior state at finish rather than unconditionally running. Allow the additional state transitions that occur. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 7

[PATCH V8 05/12] migration: propagate suspended runstate

2023-12-13 Thread Steve Sistare
If the outgoing machine was previously suspended, propagate that to the incoming side via global_state, so a subsequent vm_start restores the suspended state. To maintain backward and forward compatibility, reclaim some space from the runstate member. Signed-off-by: Steve Sistare Reviewed-by

[PATCH V8 03/12] cpus: check running not RUN_STATE_RUNNING

2023-12-13 Thread Steve Sistare
check the running boolean instead. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- backends/tpm/tpm_emulator.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/redirect.c | 2 +- hw/xen/xen-hvm-common.c | 2 +- 4 files changed, 4 insertions(+), 4

[PATCH V8 08/12] migration: preserve suspended for bg_migration

2023-12-13 Thread Steve Sistare
Do not wake a suspended guest during bg_migration, and restore the prior state at finish rather than unconditionally running. Allow the additional state transitions that occur. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/migration.c | 7

[PATCH V8 11/12] tests/qtest: precopy migration with suspend

2023-12-13 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly during live migration precopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu --- tests/qtest/migration-helpers.c | 3 ++ tests

[PATCH V8 01/12] cpus: vm_was_suspended

2023-12-13 Thread Steve Sistare
Add a state variable to remember if a vm previously transitioned into a suspended state. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 2 ++ system/cpus.c | 15 +++ 2 files changed, 17 insertions(+) diff --git a/include/sysemu

[PATCH V8 07/12] migration: preserve suspended for snapshot

2023-12-13 Thread Steve Sistare
vm_stop to RUN_STATE_SAVE_VM and RUN_STATE_RESTORE_VM did not change runstate if the current state was suspended, but now it does, so allow these transitions. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/migration/snapshot.h | 7 +++ migration/migration-hmp-cmds.c | 8

[PATCH V8 09/12] tests/qtest: migration events

2023-12-13 Thread Steve Sistare
Define a state object to capture events seen by migration tests, to allow more events to be captured in a subsequent patch, and simplify event checking in wait_for_migration_pass. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas Reviewed-by: Daniel P. Berrangé

[PATCH V8 04/12] cpus: vm_resume

2023-12-13 Thread Steve Sistare
Define the vm_resume helper, for use in subsequent patches. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu/runstate.h | 9 + system/cpus.c | 9 + 2 files changed, 18 insertions(+) diff --git a/include/sysemu/runstate.h b/include/sysemu

[PATCH V8 00/12] fix migration of suspended runstate

2023-12-13 Thread Steve Sistare
/qtest: bootfile per vm tests/qtest: background migration with suspend * rename runstate_is_started to runstate_is_live * move wait_for_suspend in tests Changes in V8: * rebase to tip * add RB's * add comment for runstate_is_live * simplify global_state - the needed function,

[PATCH V8 06/12] migration: preserve suspended runstate

2023-12-13 Thread Steve Sistare
running. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- migration/migration.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3ce04b2..8124811 100644 --- a/migration/migration.c +++ b/migration/migration.c

[PATCH V8 10/12] tests/qtest: option to suspend during migration

2023-12-13 Thread Steve Sistare
suspend_me offset is known. Generate the bootblock for each test, because suspend_me may differ for each. Signed-off-by: Steve Sistare Acked-by: Peter Xu Reviewed-by: Fabiano Rosas --- tests/migration/i386/Makefile| 5 ++-- tests/migration/i386/a-b-bootblock.S | 50

[PATCH V8 12/12] tests/qtest: postcopy migration with suspend

2023-12-13 Thread Steve Sistare
Add a test case to verify that the suspended state is handled correctly by live migration postcopy. The test suspends the src, migrates, then wakes the dest. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 20 +++- 1 file changed, 19

[PATCH V8 02/12] cpus: stop vm in suspended runstate

2023-12-13 Thread Steve Sistare
: Unable to wake up: guest is not in suspended state (qemu) cont (qemu) info status VM status: paused (suspended) (qemu) system_wakeup (qemu) info status VM status: running Suggested-by: Peter Xu Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/sysemu

[PATCH V1 3/3] vfio: allow cpr-reboot migration if suspended

2023-12-13 Thread Steve Sistare
ch as by issuing guest-suspend-ram to the qemu guest agent. Relax the vfio blocker so it does not apply to cpr, and add a notifier that verifies the guest is suspended. Skip dirty page tracking, which is N/A for cpr, to avoid ioctl errors. Signed-off-by: Steve Sistare ---

[PATCH V1 2/3] migration: notifier error reporting

2023-12-13 Thread Steve Sistare
After calling notifiers, check if an error has been reported via migrate_set_error, and halt the migration. None of the notifiers call migrate_set_error at this time, so no functional change. Signed-off-by: Steve Sistare --- include/migration/misc.h | 2 +- migration/migration.c| 26

[PATCH V1 1/3] migration: check mode in notifiers

2023-12-13 Thread Steve Sistare
The existing notifiers should only apply to normal mode. No functional change. Signed-off-by: Steve Sistare --- hw/net/virtio-net.c | 4 hw/vfio/migration.c | 3 +++ include/migration/misc.h | 1 + migration/migration.c| 5 + net/vhost-vdpa.c | 4 ui/spice

[PATCH V1 0/3] allow cpr-reboot for vfio

2023-12-13 Thread Steve Sistare
ch as by issuing guest-suspend-ram to the qemu guest agent. This series depends on the series [PATCH V8 00/12] fix migration of suspended runstate Steve Sistare (3): migration: check mode in notifiers migration: notifier error reporting vfio: allow cpr-reboot migration if suspended h

[PATCH V5] migration: simplify blockers

2023-10-18 Thread Steve Sistare
allow one Error object to be registered for multiple modes. No functional change. Signed-off-by: Steve Sistare Tested-by: Michael Galaxy Reviewed-by: Michael Galaxy Reviewed-by: Peter Xu --- backends/tpm/tpm_emulator.c | 10 ++ block/parallels.c| 8 +++- block/qcow.c

[PATCH V4] migration: simplify notifiers

2023-10-18 Thread Steve Sistare
migration_call_notifiers, and make it externally visible so future live update code can call it. No functional change. Signed-off-by: Steve Sistare Tested-by: Michael Galaxy Reviewed-by: Michael Galaxy Reviewed-by: Peter Xu --- hw/net/virtio-net.c | 6 +++--- hw/vfio/migration.c

[PATCH V5 02/12] cpus: stop vm in suspended state

2023-11-13 Thread Steve Sistare
live migration and snapshots. Suggested-by: Peter Xu Signed-off-by: Steve Sistare --- system/cpus.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/cpus.c b/system/cpus.c index f72c4be..c772708 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -255,6 +255,8

[PATCH V5 00/12] fix migration of suspended runstate

2023-11-13 Thread Steve Sistare
"preserve cpu ticks if suspended". stop ticks in vm_stop_force_state instead. * deleted patch "add runstate function". defined new helper function migrate_new_runstate in "preserve suspended runstate" * Added some RB's, but removed other RB

[PATCH V5 01/12] cpus: refactor vm_stop

2023-11-13 Thread Steve Sistare
Refactor the vm_stop functions into one common subroutine do_vm_stop called with options. No functional change. Signed-off-by: Steve Sistare --- system/cpus.c | 44 +--- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/system/cpus.c b

[PATCH V5 03/12] cpus: pass runstate to vm_prepare_start

2023-11-13 Thread Steve Sistare
to pass the new state to vm_prepare_start, rather than assume the new state is RUN_STATE_RUNNING. Modify vm state change handlers that check RUN_STATE_RUNNING to instead use the running parameter. No functional change. Suggested-by: Peter Xu Signed-off-by: Steve Sistare Reviewed-by: Peter Xu

[PATCH V5 05/12] migration: preserve suspended runstate

2023-11-13 Thread Steve Sistare
runstate_restore, which will partially resume the vm if the state is suspended. A future system_wakeup monitor request will cause the vm to resume running. On the incoming side for postcopy, apply the the same restore logic found in precopy. Signed-off-by: Steve Sistare --- migration/migration.c | 33

[PATCH V5 06/12] migration: preserve suspended for snapshot

2023-11-13 Thread Steve Sistare
. Prior to these changes, the vm_stop to RUN_STATE_SAVE_VM and RUN_STATE_RESTORE_VM did not change runstate if the current state was paused, suspended, or prelaunch, but now vm_stop_force_state forces these transitions, so allow them. Signed-off-by: Steve Sistare --- include/migration/snapshot.h

<    1   2   3   4   5   6   7   >