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
icount, if no vm_clock timer was set, qemu_clock_deadline
would return INT32_MAX and always set an icount clock expiry
about 2 seconds ahead.

NB: thread safety - when different timerlists sit on different
threads, this will need some locking.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Alex Bligh 2013-08-21 16:02:57 +01:00 committed by Stefan Hajnoczi
parent a3a726ae09
commit ac70aafc28
4 changed files with 67 additions and 10 deletions

View file

@ -103,6 +103,7 @@ int64_t qemu_clock_deadline(QEMUClock *clock);
* @clock: the clock to operate on
*
* Calculate the timeout of the earliest expiring timer
* on the default timer list associated with the clock
* in nanoseconds, or -1 if no timer is set to expire.
*
* Returns: time until expiry in nanoseconds or -1
@ -125,6 +126,18 @@ int64_t qemu_clock_deadline_ns(QEMUClock *clock);
*/
bool qemu_clock_use_for_deadline(QEMUClock *clock);
/**
* qemu_clock_use_for_deadline:
* @clock: the clock to operate on
*
* Calculate the deadline across all timer lists associated
* with a clock (as opposed to just the default one)
* in nanoseconds, or -1 if no timer is set to expire.
*
* Returns: time until expiry in nanoseconds or -1
*/
int64_t qemu_clock_deadline_ns_all(QEMUClock *clock);
/**
* qemu_clock_get_main_loop_timerlist:
* @clock: the clock to operate on