> From: Paolo Bonzini [mailto:pbonz...@redhat.com] > On 26/11/2014 11:40, Pavel Dovgalyuk wrote: > > This patch introduces new QEMU_CLOCK_VIRTUAL_RT clock, which > > should be used for icount warping. Separate timer is needed > > for replaying the execution, because warping callbacks should > > be deterministic. We cannot make realtime clock deterministic > > because it is used for screen updates and other simulator-specific > > actions. That is why we added new clock which is recorded and > > replayed when needed. > > > > Signed-off-by: Pavel Dovgalyuk <pavel.dovga...@ispras.ru> > > --- > > include/qemu/timer.h | 7 +++++++ > > qemu-timer.c | 2 ++ > > replay/replay.h | 4 +++- > > 3 files changed, 12 insertions(+), 1 deletions(-) > > > > diff --git a/include/qemu/timer.h b/include/qemu/timer.h > > index 7b43331..df27157 100644 > > --- a/include/qemu/timer.h > > +++ b/include/qemu/timer.h > > @@ -37,12 +37,19 @@ > > * is suspended, and it will reflect system time changes the host may > > * undergo (e.g. due to NTP). The host clock has the same precision as > > * the virtual clock. > > + * > > + * @QEMU_CLOCK_VIRTUAL_RT: realtime clock used for icount warp > > + * > > + * This clock runs as a realtime clock, but is used for icount warp > > + * and thus should be traced with record/replay to make warp function > > + * behave deterministically. > > */ > > I think it should also stop/restart across "stop" and "cont" commands, > similar to QEMU_CLOCK_VIRTUAL. This is as simple as changing > get_clock() to cpu_get_clock().
Ok, then I'll have to remove !use_icount check from here and retest the series. void cpu_enable_ticks(void) { /* Here, the really thing protected by seqlock is cpu_clock_offset. */ seqlock_write_lock(&timers_state.vm_clock_seqlock); if (!timers_state.cpu_ticks_enabled) { if (!use_icount) { timers_state.cpu_ticks_offset -= cpu_get_real_ticks(); timers_state.cpu_clock_offset -= get_clock(); } timers_state.cpu_ticks_enabled = 1; } seqlock_write_unlock(&timers_state.vm_clock_seqlock); } > This way, QEMU_CLOCK_VIRTUAL_RT is "what QEMU_CLOCK_VIRTUAL does without > -icount". This makes a lot of sense and can be merged in 2.3 > independent of the rest of the series. Pavel Dovgalyuk