diff options
author | Pavel Dovgalyuk | 2021-02-16 13:51:44 +0100 |
---|---|---|
committer | Paolo Bonzini | 2021-02-16 17:15:39 +0100 |
commit | 366a85e4bb748794b1ae0ca0ccc2d95f316679a0 (patch) | |
tree | ccbf65483b2908cc8ea997c735ca3cebe1510319 /replay/replay.c | |
parent | event_notifier: Set ->initialized earlier in event_notifier_init() (diff) | |
download | qemu-366a85e4bb748794b1ae0ca0ccc2d95f316679a0.tar.gz qemu-366a85e4bb748794b1ae0ca0ccc2d95f316679a0.tar.xz qemu-366a85e4bb748794b1ae0ca0ccc2d95f316679a0.zip |
replay: fix icount request when replaying clock access
Record/replay provides REPLAY_CLOCK_LOCKED macro to access
the clock when vm_clock_seqlock is locked. This macro is
needed because replay internals operate icount. In locked case
replay use icount_get_raw_locked for icount request, which prevents
excess locking which leads to deadlock. But previously only
record code used *_locked function and replay did not.
Therefore sometimes clock access lead to deadlocks.
This patch fixes clock access for replay too and uses *_locked
icount access function.
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Message-Id: <161347990483.1313189.8371838968343494161.stgit@pasha-ThinkPad-X280>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'replay/replay.c')
-rw-r--r-- | replay/replay.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/replay/replay.c b/replay/replay.c index d4c228ab28..c806fec69a 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -94,28 +94,7 @@ void replay_account_executed_instructions(void) if (replay_mode == REPLAY_MODE_PLAY) { g_assert(replay_mutex_locked()); if (replay_state.instruction_count > 0) { - int count = (int)(replay_get_current_icount() - - replay_state.current_icount); - - /* Time can only go forward */ - assert(count >= 0); - - replay_state.instruction_count -= count; - replay_state.current_icount += count; - if (replay_state.instruction_count == 0) { - assert(replay_state.data_kind == EVENT_INSTRUCTION); - replay_finish_event(); - /* Wake up iothread. This is required because - timers will not expire until clock counters - will be read from the log. */ - qemu_notify_event(); - } - /* Execution reached the break step */ - if (replay_break_icount == replay_state.current_icount) { - /* Cannot make callback directly from the vCPU thread */ - timer_mod_ns(replay_break_timer, - qemu_clock_get_ns(QEMU_CLOCK_REALTIME)); - } + replay_advance_current_icount(replay_get_current_icount()); } } } |