diff options
author | Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> | 2018-09-12 11:19:45 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-10-02 19:08:51 +0200 |
commit | 0c08185f8fe1eb20edec1a2bf32b4d219cc023f0 (patch) | |
tree | dab130711a48942f7179666888316612a1e725c0 /replay/replay.c | |
parent | 0a7fa00a13f0852ec6fa83ab987a5ee7978d9867 (diff) |
replay: wake up vCPU when replaying
In record/replay icount mode vCPU thread and iothread synchronize
the execution using the checkpoints.
vCPU thread processes the virtual timers and iothread processes all others.
When iothread wants to wake up sleeping vCPU thread, it sends dummy queued
work. Therefore it could be the following sequence of the events in
record mode:
- IO: sending dummy work
- IO: processing timers
- CPU: wakeup
- CPU: clearing dummy work
- CPU: processing virtual timers
But due to the races in replay mode the sequence may change:
- IO: sending dummy work
- CPU: wakeup
- CPU: clearing dummy work
- CPU: sleeping again because nothing to do
- IO: Processing timers
- CPU: zzzz
In this case vCPU will not wake up, because dummy work is not to be set up
again.
This patch tries to wake up the vCPU when it sleeps and the icount warp
checkpoint isn't met. It means that vCPU has something to do, because
there are no other reasons of non-matching warp checkpoint.
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
--
v5: improve checking that vCPU is still sleeping
Message-Id: <20180912081945.3228.19776.stgit@pasha-VirtualBox>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'replay/replay.c')
-rw-r--r-- | replay/replay.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/replay/replay.c b/replay/replay.c index 8228261401..379b51ab46 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -224,6 +224,18 @@ out: return res; } +bool replay_has_checkpoint(void) +{ + bool res = false; + if (replay_mode == REPLAY_MODE_PLAY) { + g_assert(replay_mutex_locked()); + replay_account_executed_instructions(); + res = EVENT_CHECKPOINT <= replay_state.data_kind + && replay_state.data_kind <= EVENT_CHECKPOINT_LAST; + } + return res; +} + static void replay_enable(const char *fname, int mode) { const char *fmode = NULL; |