qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Steve Sistare <steven.sistare@oracle.com>
To: qemu-devel@nongnu.org
Cc: "Juan Quintela" <quintela@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Leonardo Bras" <leobras@redhat.com>,
	"Steve Sistare" <steven.sistare@oracle.com>
Subject: [PATCH 03/14] cpus: vm_was_suspended
Date: Wed,  6 Dec 2023 09:12:32 -0800	[thread overview]
Message-ID: <1701882772-356078-7-git-send-email-steven.sistare@oracle.com> (raw)
In-Reply-To: <1701882772-356078-1-git-send-email-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>
---
 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 c8c2bd8..88a67e2 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 0848e0d..9baf096 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -252,6 +252,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;
-- 
1.8.3.1



  parent reply	other threads:[~2023-12-06 17:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 17:12 [PATCH V7 00/12] fix migration of suspended runstate Steve Sistare
2023-12-06 17:12 ` [PATCH V7 01/12] cpus: vm_was_suspended Steve Sistare
2023-12-06 17:12 ` [PATCH 01/14] temporary: define CLONE_NEWCGROUP qemu-8.2.0 Steve Sistare
2023-12-06 17:12 ` [PATCH V7 02/12] cpus: stop vm in suspended runstate Steve Sistare
2023-12-06 17:12 ` [PATCH 02/14] temp: allow python 3.6 qemu-8.2 Steve Sistare
2023-12-06 17:12 ` [PATCH V7 03/12] cpus: check running not RUN_STATE_RUNNING Steve Sistare
2023-12-06 17:12 ` Steve Sistare [this message]
2023-12-06 17:12 ` [PATCH 04/14] cpus: stop vm in suspended runstate Steve Sistare
2023-12-06 17:12 ` [PATCH V7 04/12] cpus: vm_resume Steve Sistare
2023-12-06 17:12 ` [PATCH 05/14] cpus: check running not RUN_STATE_RUNNING Steve Sistare
2023-12-06 17:12 ` [PATCH V7 05/12] migration: propagate suspended runstate Steve Sistare
2023-12-06 17:12 ` [PATCH 06/14] cpus: vm_resume Steve Sistare
2023-12-06 17:12 ` [PATCH V7 06/12] migration: preserve suspended runstate Steve Sistare
2023-12-06 17:12 ` [PATCH V7 07/12] migration: preserve suspended for snapshot Steve Sistare
2023-12-06 17:12 ` [PATCH 07/14] migration: propagate suspended runstate Steve Sistare
2023-12-06 17:12 ` [PATCH V7 08/12] migration: preserve suspended for bg_migration Steve Sistare
2023-12-06 17:12 ` [PATCH 08/14] migration: preserve suspended runstate Steve Sistare
2023-12-06 17:12 ` [PATCH 09/14] migration: preserve suspended for snapshot Steve Sistare
2023-12-06 17:12 ` [PATCH V7 09/12] tests/qtest: migration events Steve Sistare
2023-12-06 17:12 ` [PATCH 10/14] migration: preserve suspended for bg_migration Steve Sistare
2023-12-06 17:12 ` [PATCH V7 10/12] tests/qtest: option to suspend during migration Steve Sistare
2023-12-06 17:12 ` [PATCH 11/14] tests/qtest: migration events Steve Sistare
2023-12-06 17:12 ` [PATCH V7 11/12] tests/qtest: precopy migration with suspend Steve Sistare
2023-12-06 17:12 ` [PATCH 12/14] tests/qtest: option to suspend during migration Steve Sistare
2023-12-06 17:12 ` [PATCH V7 12/12] tests/qtest: postcopy migration with suspend Steve Sistare
2023-12-06 17:12 ` [PATCH 13/14] tests/qtest: precopy " Steve Sistare
2023-12-06 17:12 ` [PATCH 14/14] tests/qtest: postcopy " Steve Sistare
2023-12-06 17:16 ` [PATCH V7 00/12] fix migration of suspended runstate Steven Sistare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1701882772-356078-7-git-send-email-steven.sistare@oracle.com \
    --to=steven.sistare@oracle.com \
    --cc=berrange@redhat.com \
    --cc=farosas@suse.de \
    --cc=leobras@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).