From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Pavel Dovgalyuk" <pavel.dovgalyuk@ispras.ru>,
"Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>
Cc: <qemu-devel@nongnu.org>, <qemu-ppc@nongnu.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [RFC v2 PATCH] record-replay: support SMP target machine
Date: Fri, 25 Aug 2023 18:22:48 +1000 [thread overview]
Message-ID: <CV1HBDIQZEBS.3FH95D6WMLXV0@wheely> (raw)
In-Reply-To: <48d32058-dd1b-a2ed-42f2-e21c099bc0e3@ispras.ru>
On Tue Aug 22, 2023 at 2:44 PM AEST, Pavel Dovgalyuk wrote:
> On 11.08.2023 04:47, Nicholas Piggin wrote:
> > RR CPU switching is driven by timers and events so it is deterministic
> > like everything else. Record a CPU switch event and use that to drive
> > the CPU switch on replay.
> >
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> > This is still in RFC phase because so far I've only really testd ppc
> > pseries, and only with patches that are not yet upstream (but posted
> > to list).
> >
> > It works with smp 2, can step, reverse-step, reverse-continue, etc.
> > throughout a Linux boot.
>
> I still didn't have time to test it, but here are some comments.
That's okay, I got a little further, mainly adding vmstate to
migrate it (otherwise we can only use the initial snapshot).
Unless there is more interest, I will focus on getting ppc fixes
upstream first. Let me know if you have more time to look, I can
send you the latest.
[snip]
> > @@ -294,9 +346,9 @@ static void *rr_cpu_thread_fn(void *arg)
> > qatomic_set_mb(&cpu->exit_request, 0);
> > }
> >
> > - if (all_cpu_threads_idle()) {
> > - rr_stop_kick_timer();
> > + qatomic_set(&rr_next_cpu, cpu);
>
> This does not seem to be in the mainline.
Sorry I meant to sqush that in or send it out. The kick timer
init vs start needed to be moved to make it work.
[snip]
> > -bool replay_exception(void)
> > +bool replay_switch_cpu(void)
> > +{
> > + if (replay_mode == REPLAY_MODE_RECORD) {
> > + g_assert(replay_mutex_locked());
> > + replay_save_instructions();
> > + replay_put_event(EVENT_SWITCH_CPU);
> > + return true;
> > + } else if (replay_mode == REPLAY_MODE_PLAY) {
> > + bool res = replay_has_switch_cpu();
> > + if (res) {
> > + replay_finish_event();
> > + } else {
> > + g_assert_not_reached();
> > + }
> > + return res;
> > + }
> > +
> > + return true;
> > +}
> > +
> > +bool replay_has_switch_cpu(void)
>
> Is this function really needed?
I found it was easier to fit in the way the CPU scheduling is done
in rr.
I think that main scheduling loop could be refactored a bit that
could then avoid the need for this (e.g., a helper function to
return the next CPU and all the selection code including rr is
in there). But that became non-trivial and looks like the code is
a bit delicate. I might try to tackle that afterwards.
Thanks,
Nick
prev parent reply other threads:[~2023-08-25 8:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 1:47 [RFC v2 PATCH] record-replay: support SMP target machine Nicholas Piggin
2023-08-22 4:44 ` Pavel Dovgalyuk
2023-08-25 8:22 ` Nicholas Piggin [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=CV1HBDIQZEBS.3FH95D6WMLXV0@wheely \
--to=npiggin@gmail.com \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pavel.dovgalyuk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).