Statistics
| Branch: | Revision:

root / include / qemu / timer.h @ a5c82852

History | View | Annotate | Download (22.8 kB)

# Date Author Comment
dc9fc1ca 01/15/2014 09:34 pm Namhyung Kim

Fix typo of tiemr in timer.h

Signed-off-by: Namhyung Kim <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Michael Tokarev <>

add40e97 10/17/2013 06:31 pm Paolo Bonzini

timer: add timer_mod_anticipate and timer_mod_anticipate_ns

These let a user anticipate the deadline of a timer, atomically with
other sites that call the function. This helps avoiding complicated
lock hierarchies.

Reviewed-by: Alex Bligh <>...

3c053411 10/17/2013 06:30 pm Liu Ping Fan

timer: make qemu_clock_enable sync between disable and timer's cb

After disabling the QemuClock, we should make sure that no QemuTimers
are still in flight. To implement that with light overhead, we resort
to QemuEvent. The caller of disabling will wait on QemuEvent of each...

cb365646 10/17/2013 06:30 pm Liu Ping Fan

timer: protect timers_state's clock with seqlock

QEMU_CLOCK_VIRTUAL may be read outside BQL. This will make its
foundation, i.e. cpu_clock_offset exposed to race condition.
Using private lock to protect it.

After this patch, reading QEMU_CLOCK_VIRTUAL is thread safe...

978f2205 09/18/2013 04:48 pm Stefan Hajnoczi

qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe

Introduce QEMUTimerList->active_timers_lock to protect the linked list
of active timers. This allows qemu_timer_mod_ns() to be called from any
thread.

Note that vm_clock is not thread-safe and its use of...

40daca54 08/22/2013 08:14 pm Alex Bligh

aio / timers: Rearrange timer.h & make legacy functions call non-legacy

Rearrange timer.h so it is in order by function type.

Make legacy functions call non-legacy functions rather than vice-versa.

Convert cpus.c to use new API.

Signed-off-by: Alex Bligh <>...

7bf8fbde 08/22/2013 08:14 pm Alex Bligh

aio / timers: Remove main_loop_timerlist

Now we have timerlistgroups implemented and main_loop_tlg, we
no longer need the concept of a default timer list associated
with each clock. Remove it and simplify initialisation of
clocks and timer lists.

Signed-off-by: Alex Bligh <>...

b4049b74 08/22/2013 08:14 pm Alex Bligh

aio / timers: Remove legacy interface

Remove the legacy interface from include/qemu/timers.h.

Ensure struct QEMUClock is not exposed at all.

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

6d327171 08/22/2013 08:10 pm Alex Bligh

aio / timers: Remove alarm timers

Remove alarm timers from qemu-timers.c now we use g_poll / ppoll
instead.

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

63111b69 08/22/2013 08:10 pm Alex Bligh

aio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline

Remove qemu_clock_deadline and qemu_timerlist_deadline now we are using
the ns functions throughout.

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

55a197da 08/22/2013 08:10 pm Alex Bligh

aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms

Add utility functions qemu_clock_get_ms and qemu_clock_get_us

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

54904d2a 08/22/2013 08:10 pm Alex Bligh

aio / timers: Add documentation and new format calls

Add documentation for existing qemu timer calls. Add new format
calls of the format timer_XXX rather than qemu_XXX_timer
for consistency.

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

d5541d86 08/22/2013 08:10 pm Alex Bligh

aio / timers: Add a notify callback to QEMUTimerList

Add a notify pointer to QEMUTimerList so it knows what to notify
on a timer change.

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

b1bbfe72 08/22/2013 08:10 pm Alex Bligh

aio / timers: On timer modification, qemu_notify or aio_notify

On qemu_mod_timer_ns, ensure qemu_notify or aio_notify is called to
end the appropriate poll(), irrespective of use_icount value.

On qemu_clock_enable, ensure qemu_notify or aio_notify is called for...

a3a726ae 08/22/2013 08:10 pm Alex Bligh

aio / timers: Introduce new API timer_new and friends

Introduce new API for creating timers - timer_new and
_ns, _ms, _us derivatives.

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

ac70aafc 08/22/2013 08:10 pm Alex Bligh

aio / timers: Use all timerlists in icount warp calculations

Notify all timerlists derived from vm_clock in icount warp
calculations.

When calculating timer delay based on vm_clock deadline, use
all timerlists.

For compatibility, maintain an apparent bug where when using...

f9a976b7 08/22/2013 08:10 pm Alex Bligh

aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress

Make qemu_run_timers and qemu_run_all_timers return progress
so that aio_poll etc. can determine whether a timer has been
run.

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

ff83c66e 08/22/2013 08:10 pm Alex Bligh

aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList

Split QEMUClock into QEMUClock and QEMUTimerList so that we can
have more than one QEMUTimerList associated with the same clock.

Introduce a main_loop_timerlist concept and make existing
qemu_clock_* calls that actually should operate on a QEMUTimerList...

6a1751b7 08/22/2013 08:10 pm Alex Bligh

aio / timers: Untangle include files

include/qemu/timer.h has no need to include main-loop.h and
doing so causes an issue for the next patch. Unfortunately
various files assume including timers.h will pull in main-loop.h.
Untangle this mess.

Signed-off-by: Alex Bligh <>...

754d6a54 08/22/2013 08:10 pm Alex Bligh

aio / timers: Add QEMUTimerListGroup and helper functions

Add QEMUTimerListGroup and helper functions, to represent
a QEMUTimerList associated with each clock. Add a default
QEMUTimerListGroup representing the default timer lists
which are not associated with any other object (e.g....

4e0c6529 08/22/2013 08:10 pm Alex Bligh

aio / timers: add ppoll support with qemu_poll_ns

Add qemu_poll_ns which works like g_poll but takes a nanosecond
timeout.

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

e93379b0 08/22/2013 04:58 pm Alex Bligh

aio / timers: Rename qemu_timer_* functions

Rename four functions in preparation for new API.

Rename qemu_timer_expired to timer_expired
Rename qemu_timer_expire_time_ns to timer_expire_time_ns
Rename qemu_timer_pending to timer_pending
Rename qemu_timer_expired_ns to timer_expired_ns...

58ac56b9 08/22/2013 04:58 pm Alex Bligh

aio / timers: Rename qemu_new_clock and expose clock types

Rename qemu_new_clock to qemu_clock_new.

Expose clock types.

Signed-off-by: Alex Bligh <>
Signed-off-by: Stefan Hajnoczi <>

02a03a9f 08/22/2013 04:58 pm Alex Bligh

aio / timers: add qemu-timer.c utility functions

Add utility functions to qemu-timer.c for nanosecond timing.

Add qemu_clock_deadline_ns to calculate deadlines to
nanosecond accuracy.

Add utility function qemu_soonest_timeout to calculate soonest deadline....

e4dcd8ac 04/25/2013 10:45 pm Ed Maste

Remove unnecessary FreeBSD #include

sys/param.h was included to define __FreeBSD_version, but the conditional
using it was removed by commit d05ef160453e98546a4197496dc8a3cb2defac53
(Brad Smith, "Allow clock_gettime() monotonic clock to be utilized on more...

d05ef160 04/05/2013 04:22 am Brad Smith

Allow clock_gettime() monotonic clock to be utilized on more OS's

Allow the clock_gettime() code using monotonic clock to be utilized on
more POSIX compliannt OS's. This started as a fix for OpenBSD which was
listed in one function as part of the previous hard coded list of OS's...

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>