[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V6 05/14] migration: propagate suspended runstate
|
From: |
Steve Sistare |
|
Subject: |
[PATCH V6 05/14] migration: propagate suspended runstate |
|
Date: |
Thu, 30 Nov 2023 13:37:18 -0800 |
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, define
the new field in a zero'd hole in the GlobalState struct.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
migration/global_state.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/migration/global_state.c b/migration/global_state.c
index 4e2a9d8..de2532c 100644
--- a/migration/global_state.c
+++ b/migration/global_state.c
@@ -25,6 +25,7 @@ typedef struct {
uint8_t runstate[100];
RunState state;
bool received;
+ bool vm_was_suspended;
} GlobalState;
static GlobalState global_state;
@@ -35,6 +36,7 @@ static void global_state_do_store(RunState state)
assert(strlen(state_str) < sizeof(global_state.runstate));
strpadcpy((char *)global_state.runstate, sizeof(global_state.runstate),
state_str, '\0');
+ global_state.vm_was_suspended = vm_get_suspended();
}
void global_state_store(void)
@@ -68,6 +70,12 @@ static bool global_state_needed(void *opaque)
return true;
}
+ /* If the suspended state must be remembered, it is needed */
+
+ if (vm_get_suspended()) {
+ return true;
+ }
+
/* If state is running or paused, it is not needed */
if (strcmp(runstate, "running") == 0 ||
@@ -109,6 +117,7 @@ static int global_state_post_load(void *opaque, int
version_id)
return -EINVAL;
}
s->state = r;
+ vm_set_suspended(s->vm_was_suspended || r == RUN_STATE_SUSPENDED);
return 0;
}
@@ -134,6 +143,7 @@ static const VMStateDescription vmstate_globalstate = {
.fields = (VMStateField[]) {
VMSTATE_UINT32(size, GlobalState),
VMSTATE_BUFFER(runstate, GlobalState),
+ VMSTATE_BOOL(vm_was_suspended, GlobalState),
VMSTATE_END_OF_LIST()
},
};
--
1.8.3.1
- [PATCH V6 00/14] fix migration of suspended runstate, Steve Sistare, 2023/11/30
- [PATCH V6 02/14] cpus: vm_was_suspended, Steve Sistare, 2023/11/30
- [PATCH V6 03/14] cpus: stop vm in suspended runstate, Steve Sistare, 2023/11/30
- [PATCH V6 01/14] cpus: pass runstate to vm_prepare_start, Steve Sistare, 2023/11/30
- [PATCH V6 06/14] migration: preserve suspended runstate, Steve Sistare, 2023/11/30
- [PATCH V6 05/14] migration: propagate suspended runstate,
Steve Sistare <=
- [PATCH V6 04/14] cpus: vm_resume, Steve Sistare, 2023/11/30
- [PATCH V6 07/14] migration: preserve suspended for snapshot, Steve Sistare, 2023/11/30
- [PATCH V6 09/14] tests/qtest: migration events, Steve Sistare, 2023/11/30
- [PATCH V6 12/14] tests/qtest: postcopy migration with suspend, Steve Sistare, 2023/11/30
- [PATCH V6 08/14] migration: preserve suspended for bg_migration, Steve Sistare, 2023/11/30
- [PATCH V6 13/14] tests/qtest: bootfile per vm, Steve Sistare, 2023/11/30
- [PATCH V6 10/14] tests/qtest: option to suspend during migration, Steve Sistare, 2023/11/30
- [PATCH V6 11/14] tests/qtest: precopy migration with suspend, Steve Sistare, 2023/11/30
- [PATCH V6 14/14] tests/qtest: background migration with suspend, Steve Sistare, 2023/11/30