> From: Paolo Bonzini [mailto:pbonz...@redhat.com]
> On 17/02/2015 09:43, Pavel Dovgaluk wrote:
> >> >      int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
> >> >      if (deadline == 0) {
> >> >          qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
> >> >      }
> >> >
> >> > instead of qemu_notify_event(), and remove these lines from
> >> > qemu_tcg_cpu_thread_fn.
> > I tried this one. But there is one problem.
> > Expiring of the virtual timers is not the only reason of icount expiration 
> > in replay mode.
> > It may be caused by host timers deadline or poll timeout in record mode. In 
> > this case
> > qemu_clock_notify(QEMU_CLOCK_VIRTUAL) will not be called in replay mode and 
> > we'll waste time
> for iothread sleeping.
> 
> Sure, but unconditional qemu_notify_event() is also wrong.  So, to sum up:
> 
> - it's okay to move code from qemu_tcg_cpu_thread_fn to cpu-exec.c
> 
> - it's okay to add more qemu_clock_notify calls than just
> qemu_clock_notify(QEMU_CLOCK_VIRTUAL), each with its own condition
> 
> - it's better if all these, after being moved to cpu-exec.c, are also
> extracted in a separate function
> 
> - it's not okay to do an unconditional qemu_notify_event() in
> cpu-exec.c, even if it's under "if (replay_mode != NONE)".

How can I wake up iothread if there are no pending timers?
deadline will (almost) never become zero in my case, because there is 
another kind of event in the log (not the timer one).
Should I fetch the event and call qemu_notify_event() from replay module?

> 
> Thanks for your understanding! :)

Pavel Dovgalyuk


Reply via email to