[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/26] cpus: vm_was_suspended
|
From: |
peterx |
|
Subject: |
[PULL 03/26] cpus: vm_was_suspended |
|
Date: |
Thu, 4 Jan 2024 12:31:48 +0800 |
From: Steve Sistare <steven.sistare@oracle.com>
Add a state variable to remember if a vm previously transitioned into a
suspended state.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link:
1704312341-66640-2-git-send-email-steven.sistare@oracle.com">https://lore.kernel.org/r/1704312341-66640-2-git-send-email-steven.sistare@oracle.com
Signed-off-by: Peter Xu <peterx@redhat.com>
---
include/sysemu/runstate.h | 2 ++
system/cpus.c | 15 +++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
index c8c2bd8a61..88a67e22b0 100644
--- a/include/sysemu/runstate.h
+++ b/include/sysemu/runstate.h
@@ -51,6 +51,8 @@ int vm_prepare_start(bool step_pending);
int vm_stop(RunState state);
int vm_stop_force_state(RunState state);
int vm_shutdown(void);
+void vm_set_suspended(bool suspended);
+bool vm_get_suspended(void);
typedef enum WakeupReason {
/* Always keep QEMU_WAKEUP_REASON_NONE = 0 */
diff --git a/system/cpus.c b/system/cpus.c
index a444a747f0..9f631ab734 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -259,6 +259,21 @@ void cpu_interrupt(CPUState *cpu, int mask)
}
}
+/*
+ * True if the vm was previously suspended, and has not been woken or reset.
+ */
+static int vm_was_suspended;
+
+void vm_set_suspended(bool suspended)
+{
+ vm_was_suspended = suspended;
+}
+
+bool vm_get_suspended(void)
+{
+ return vm_was_suspended;
+}
+
static int do_vm_stop(RunState state, bool send_stop)
{
int ret = 0;
--
2.41.0
- [PULL 00/26] Migration 20240104 patches, peterx, 2024/01/03
- [PULL 01/26] MAINTAINERS: Leaving Migration, peterx, 2024/01/03
- [PULL 02/26] MAINTAINERS: Remove myself as reviewer from Live Migration, peterx, 2024/01/03
- [PULL 03/26] cpus: vm_was_suspended,
peterx <=
- [PULL 04/26] cpus: stop vm in suspended runstate, peterx, 2024/01/03
- [PULL 05/26] cpus: check running not RUN_STATE_RUNNING, peterx, 2024/01/03
- [PULL 06/26] cpus: vm_resume, peterx, 2024/01/03
- [PULL 07/26] migration: propagate suspended runstate, peterx, 2024/01/03
- [PULL 08/26] migration: preserve suspended runstate, peterx, 2024/01/03
- [PULL 09/26] migration: preserve suspended for snapshot, peterx, 2024/01/03
- [PULL 10/26] migration: preserve suspended for bg_migration, peterx, 2024/01/03
- [PULL 11/26] tests/qtest: migration events, peterx, 2024/01/03
- [PULL 12/26] tests/qtest: option to suspend during migration, peterx, 2024/01/03
- [PULL 13/26] tests/qtest: precopy migration with suspend, peterx, 2024/01/03