Sometimes virtual timer callbacks depend on order of virtual timer processing and warping of virtual clock. Therefore every callback should be logged to make replay deterministic. This patch creates a checkpoint before every virtual timer callback. With these checkpoints virtual timers processing and clock warping events order is completely deterministic.
Signed-off-by: Pavel Dovgalyuk <pavel.dovga...@ispras.ru> --- util/qemu-timer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/qemu-timer.c b/util/qemu-timer.c index d548d3c1ad..47833f338f 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -588,6 +588,11 @@ bool timerlist_run_timers(QEMUTimerList *timer_list) qemu_mutex_lock(&timer_list->active_timers_lock); progress = true; + /* + * Callback may insert new checkpoints, therefore add new checkpoint + * for the virtual timers. + */ + need_replay_checkpoint = timer_list->clock->type == QEMU_CLOCK_VIRTUAL; } qemu_mutex_unlock(&timer_list->active_timers_lock);