From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org,
Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>,
Richard Henderson <richard.henderson@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [RFC PATCH] replay: stop us hanging in rr_wait_io_event
Date: Tue, 05 Dec 2023 15:15:59 +0000 [thread overview]
Message-ID: <871qc0fzo0.fsf@draig.linaro.org> (raw)
In-Reply-To: <CAFEAcA85p9C=D8QZ9Ew8xMSVZgtVAOgQ0h7xBkPAKMZFci5uPQ@mail.gmail.com> (Peter Maydell's message of "Tue, 5 Dec 2023 14:10:56 +0000")
Peter Maydell <peter.maydell@linaro.org> writes:
> On Tue, 5 Dec 2023 at 12:15, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> A lot of the hang I see are when we end up spinning in
>> rr_wait_io_event for an event that will never come in playback. As a
>> new check functions which can see if we are in PLAY mode and kick us
>> us the wait function so the event can be processed.
>>
>> This fixes most of the failures in replay_kernel.py
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Cc: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
>> ---
>> include/sysemu/replay.h | 5 +++++
>> accel/tcg/tcg-accel-ops-rr.c | 2 +-
>> replay/replay.c | 24 ++++++++++++++++++++++++
>> 3 files changed, 30 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
>> index 08aae5869f..83995ae4bd 100644
>> --- a/include/sysemu/replay.h
>> +++ b/include/sysemu/replay.h
>> @@ -70,6 +70,11 @@ int replay_get_instructions(void);
>> /*! Updates instructions counter in replay mode. */
>> void replay_account_executed_instructions(void);
>>
>> +/**
>> + * replay_can_wait: check if we should pause for wait-io
>> + */
>> +bool replay_can_wait(void);
>> +
>> /* Processing clocks and other time sources */
>>
>> /*! Save the specified clock */
>> diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
>> index 611932f3c3..825e35b3dc 100644
>> --- a/accel/tcg/tcg-accel-ops-rr.c
>> +++ b/accel/tcg/tcg-accel-ops-rr.c
>> @@ -109,7 +109,7 @@ static void rr_wait_io_event(void)
>> {
>> CPUState *cpu;
>>
>> - while (all_cpu_threads_idle()) {
>> + while (all_cpu_threads_idle() && replay_can_wait()) {
>> rr_stop_kick_timer();
>> qemu_cond_wait_iothread(first_cpu->halt_cond);
>> }
>> diff --git a/replay/replay.c b/replay/replay.c
>> index 0f7d766efe..e71cdbf819 100644
>> --- a/replay/replay.c
>> +++ b/replay/replay.c
>> @@ -338,6 +338,30 @@ void replay_start(void)
>> replay_enable_events();
>> }
>>
>> +/*
>> + * For none/record the answer is yes.
>> + */
>> +bool replay_can_wait(void)
>> +{
>> + if (replay_mode == REPLAY_MODE_PLAY) {
>> + /*
>> + * For playback we shouldn't ever be at a point we wait. If
>
> This comment sounds like "this can't happen, but it does for
> some reason we don't understand" ... Is there some bug somewhere
> that we're papering over here ?
I don't think so - it really is just a difference in behaviour needed
here between record and playback. If we short cut earlier then that
would make the code harder to follow and introduce another potential
point of divergence.
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
prev parent reply other threads:[~2023-12-05 15:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 12:14 [RFC PATCH] replay: stop us hanging in rr_wait_io_event Alex Bennée
2023-12-05 14:10 ` Peter Maydell
2023-12-05 15:15 ` Alex Bennée [this message]
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=871qc0fzo0.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).