From: "Alex Bennée" <alex.bennee@linaro.org>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: qemu-devel@nongnu.org,
"Pavel Dovgalyuk" <Pavel.Dovgalyuk@ispras.ru>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"John Snow" <jsnow@redhat.com>, "Cleber Rosa" <crosa@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Beraldo Leal" <bleal@redhat.com>
Subject: Re: [PATCH v3 4/9] replay: allow runstate shutdown->running when replaying trace
Date: Tue, 27 Feb 2024 19:28:00 +0000 [thread overview]
Message-ID: <87a5nld7wf.fsf@draig.linaro.org> (raw)
In-Reply-To: <20240226082945.1452499-5-npiggin@gmail.com> (Nicholas Piggin's message of "Mon, 26 Feb 2024 18:29:40 +1000")
Nicholas Piggin <npiggin@gmail.com> writes:
> 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.
>
> This can be tested by making a recording of a machine that shuts down,
> then using -action shutdown=pause when replaying it. Continuing to the
> end of the trace then reverse-stepping in gdb crashes due to invalid
> runstate transition.
>
> Just permitting the transition seems to be all that's necessary for
> reverse-debugging to work well in such a state.
>
> Reviewed-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> include/sysemu/runstate.h | 1 +
> replay/replay.c | 2 ++
> system/runstate.c | 19 +++++++++++++++++++
> 3 files changed, 22 insertions(+)
>
> diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
> index 0117d243c4..fe25eed3c0 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 3fd241a4fc..2951eed3bd 100644
> --- a/replay/replay.c
> +++ b/replay/replay.c
> @@ -383,6 +383,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/system/runstate.c b/system/runstate.c
> index d6ab860eca..bd0fed8657 100644
> --- a/system/runstate.c
> +++ b/system/runstate.c
> @@ -182,6 +182,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)
> @@ -189,6 +195,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);
> +
As the bellow is common to runstate_init it could be
re-factored into a helper taking the runstate_transitions_def pointer.
> + 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;
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2024-02-27 19:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 8:29 [PATCH v3 0/9] replay: fixes and new test cases Nicholas Piggin
2024-02-26 8:29 ` [PATCH v3 1/9] scripts/replay-dump.py: Update to current rr record format Nicholas Piggin
2024-02-27 15:57 ` Alex Bennée
2024-02-26 8:29 ` [PATCH v3 2/9] scripts/replay-dump.py: rejig decoders in event number order Nicholas Piggin
2024-02-27 15:57 ` Alex Bennée
2024-02-26 8:29 ` [PATCH v3 3/9] tests/avocado: excercise scripts/replay-dump.py in replay tests Nicholas Piggin
2024-02-27 19:21 ` Alex Bennée
2024-02-29 3:10 ` Nicholas Piggin
2024-02-26 8:29 ` [PATCH v3 4/9] replay: allow runstate shutdown->running when replaying trace Nicholas Piggin
2024-02-27 19:28 ` Alex Bennée [this message]
2024-02-26 8:29 ` [PATCH v3 5/9] Revert "replay: stop us hanging in rr_wait_io_event" Nicholas Piggin
2024-02-26 8:29 ` [PATCH v3 6/9] chardev: set record/replay on the base device of a muxed device Nicholas Piggin
2024-02-26 8:29 ` [PATCH v3 7/9] replay: Fix migration use of clock Nicholas Piggin
2024-02-26 8:29 ` [PATCH v3 8/9] replay: Fix migration replay_mutex locking Nicholas Piggin
2024-02-26 8:29 ` [PATCH v3 9/9] tests/avocado/reverse_debugging.py: mark aarch64 and pseries as not flaky Nicholas Piggin
2024-02-27 19:36 ` Alex Bennée
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=87a5nld7wf.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=Pavel.Dovgalyuk@ispras.ru \
--cc=bleal@redhat.com \
--cc=crosa@redhat.com \
--cc=jsnow@redhat.com \
--cc=npiggin@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.