]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commit
timers: fix stop/cont with -icount
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 28 Oct 2013 16:32:18 +0000 (17:32 +0100)
committerAnthony Liguori <aliguori@amazon.com>
Thu, 7 Nov 2013 05:47:05 +0000 (21:47 -0800)
commit5f3e31012e334f3410e04abae7f88565df17c91a
tree75930e80e1a4fa885717c3528054d15cbda51704
parentcd5be5829c1ce87aa6b3a7806524fac07ac9a757
timers: fix stop/cont with -icount

Stop/cont commands are broken with -icount due to a deadlock.  The
real problem is that the computation of timers_state.cpu_ticks_offset
makes no sense with -icount enabled: we set it to an icount clock value
in cpu_disable_ticks, and subtract a TSC (or similar, whatever
cpu_get_real_ticks happens to return) value in cpu_enable_ticks.

The fix is simple.  timers_state.cpu_ticks_offset is only used
together with cpu_get_real_ticks, so we can use cpu_get_real_ticks
in cpu_disable_ticks.  There is no need to update cpu_ticks_prev
at the time cpu_disable_ticks is called; instead, we can do it
the next time cpu_get_ticks is called.

The change to cpu_disable_ticks is the important part of the patch.
The rest modifies the code to always check timers_state.cpu_ticks_prev,
even when the ticks are not advancing (i.e. the VM is stopped).  It also
makes a similar change to cpu_get_clock_locked, so that the code remains
similar for cpu_get_ticks and cpu_get_clock_locked.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1382977938-13844-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
cpus.c