From: Nicholas Piggin <npiggin@gmail.com>
To: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Cc: "Nicholas Piggin" <npiggin@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"John Snow" <jsnow@redhat.com>, "Cleber Rosa" <crosa@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Beraldo Leal" <bleal@redhat.com>,
qemu-devel@nongnu.org
Subject: [PATCH 3/4] replay: allow runstate shutdown->running when replaying trace
Date: Tue, 15 Aug 2023 02:31:34 +1000 [thread overview]
Message-ID: <20230814163135.187882-4-npiggin@gmail.com> (raw)
In-Reply-To: <20230814163135.187882-1-npiggin@gmail.com>
When replaying a trace, it is possible to go from shutdown to
running with a reverse-debugging step. This can be useful if the
problem being debugged triggers a reset or shutdown.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
include/sysemu/runstate.h | 1 +
replay/replay.c | 2 ++
softmmu/runstate.c | 19 +++++++++++++++++++
3 files changed, 22 insertions(+)
diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
index 7beb29c2e2..85a1167ccb 100644
--- a/include/sysemu/runstate.h
+++ b/include/sysemu/runstate.h
@@ -9,6 +9,7 @@ void runstate_set(RunState new_state);
RunState runstate_get(void);
bool runstate_is_running(void);
bool runstate_needs_reset(void);
+void runstate_replay_enable(void);
typedef void VMChangeStateHandler(void *opaque, bool running, RunState state);
diff --git a/replay/replay.c b/replay/replay.c
index 0f7d766efe..e64f71209a 100644
--- a/replay/replay.c
+++ b/replay/replay.c
@@ -272,6 +272,8 @@ static void replay_enable(const char *fname, int mode)
/* go to the beginning */
fseek(replay_file, HEADER_SIZE, SEEK_SET);
replay_fetch_data_kind();
+
+ runstate_replay_enable();
}
replay_init_events();
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index f3bd862818..9fd3e57485 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -174,6 +174,12 @@ static const RunStateTransition runstate_transitions_def[] = {
{ RUN_STATE__MAX, RUN_STATE__MAX },
};
+static const RunStateTransition replay_runstate_transitions_def[] = {
+ { RUN_STATE_SHUTDOWN, RUN_STATE_RUNNING},
+
+ { RUN_STATE__MAX, RUN_STATE__MAX },
+};
+
static bool runstate_valid_transitions[RUN_STATE__MAX][RUN_STATE__MAX];
bool runstate_check(RunState state)
@@ -181,6 +187,19 @@ bool runstate_check(RunState state)
return current_run_state == state;
}
+void runstate_replay_enable(void)
+{
+ const RunStateTransition *p;
+
+ assert(replay_mode == REPLAY_MODE_PLAY);
+
+ for (p = &replay_runstate_transitions_def[0]; p->from != RUN_STATE__MAX;
+ p++) {
+ runstate_valid_transitions[p->from][p->to] = true;
+ }
+
+}
+
static void runstate_init(void)
{
const RunStateTransition *p;
--
2.40.1
next prev parent reply other threads:[~2023-08-14 16:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 16:31 [PATCH for-8.2 0/4] Assorted replay patches Nicholas Piggin
2023-08-14 16:31 ` [PATCH 1/4] scripts/replay_dump.sh: Update to current rr record format Nicholas Piggin
2023-08-18 4:19 ` Pavel Dovgalyuk
2023-08-14 16:31 ` [PATCH 2/4] tests/avocado: replay_linux.py add replay-dump.py test Nicholas Piggin
2023-08-18 4:23 ` Pavel Dovgalyuk
2023-08-14 16:31 ` Nicholas Piggin [this message]
2023-08-18 4:25 ` [PATCH 3/4] replay: allow runstate shutdown->running when replaying trace Pavel Dovgalyuk
2023-08-14 16:31 ` [PATCH 4/4] replay: simple auto-snapshot mode for record Nicholas Piggin
2023-08-18 4:36 ` Pavel Dovgalyuk
2024-02-26 7:36 ` Nicholas Piggin
2024-02-28 5:07 ` Pavel Dovgalyuk
2024-02-29 6:32 ` Nicholas Piggin
2024-03-04 16:33 ` Nicholas Piggin
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=20230814163135.187882-4-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=bleal@redhat.com \
--cc=crosa@redhat.com \
--cc=jsnow@redhat.com \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@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).