Statistics
| Branch: | Revision:

root / qemu-timer.c @ 753d11f2

History | View | Annotate | Download (30.5 kB)

# Date Author Comment
1dfb4dd9 09/15/2011 10:39 pm Luiz Capitulino

Replace the VMSTOP macros with a proper state type

Today, when notifying a VM state change with vm_state_notify(),
we pass a VMSTOP macro as the 'reason' argument. This is not ideal
because the VMSTOP macros tell why qemu stopped and not exactly
what the current VM state is....

1354869c 09/15/2011 10:39 pm Luiz Capitulino

Drop the vm_running global variable

Use runstate_is_running() instead, which is introduced by this commit.

Signed-off-by: Luiz Capitulino <>

12d4536f 09/02/2011 06:34 pm Anthony Liguori

main: force enabling of I/O thread

Enabling the I/O thread by default seems like an important part of declaring
1.0. Besides allowing true SMP support with KVM, the I/O thread means that the
TCG VCPU doesn't have to multiplex itself with the I/O dispatch routines which...

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

691a0c9c 07/23/2011 07:26 pm Jan Kiszka

qemu-timer: Introduce clock reset notifier

QEMU_CLOCK_HOST is based on the system time which may jump backward in
case the admin or NTP adjusts it. RTC emulations and other device models
can suffer in this case as timers will stall for the period the clock...

d25f89c9 07/23/2011 07:26 pm Jan Kiszka

Register Linux dyntick timer as per-thread signal

Derived from kvm-tool patch
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/74309

Ingo Molnar pointed out that sending the timer signal to the whole
process, just blocking it everywhere, is suboptimal with an increasing...

84682834 07/23/2011 07:18 pm Paolo Bonzini

qemu-timer: change unix timer to dynticks

A timer that wakes up every millisecond puts a lot of stress on the
iothread. The large amount of IPIs causes very high context switch
activity, making emulation slow and the UI unusable. This is by the
way the same reason why the Windows timers were switched to dynticks....

25f3151e 06/06/2011 04:54 pm Anthony Liguori

timer: drop HPET and RTC

dynticks will provide equally good timer granularity on all modern Linux
systems. This is more or less dead code these days.

Signed-off-by: Anthony Liguori <>

45c7b37f 04/27/2011 02:30 pm Stefan Weil

qemu-timer: Add and use new function qemu_timer_expired_ns

This simply moves code which is used three times
into a new function thus improving readability.

Signed-off-by: Stefan Weil <>

cd0544ee 04/27/2011 02:30 pm Stefan Weil

qemu-timer: Avoid type casts

The type casts are no longer needed after some small changes
in struct qemu_alarm_timer. This also improves readability
of the code.

Signed-off-by: Stefan Weil <>

2f9cba0c 04/27/2011 02:30 pm Stefan Weil

qemu-timer: Fix timers for w32

Commit 68c23e5520e8286d79d96ab47c0ea722ceb75041 removed the
multimedia timer, but this timer is needed for certain
Linux kernels. Otherwise Linux boot stops with this error:

MP-BIOS bug: 8254 timer not connected to IO-APIC...
ab33fcda 04/15/2011 10:27 am Paolo Bonzini

enable vm_clock to "warp" in the iothread+icount case

The previous patch however is not enough, because if the virtual CPU
goes to sleep waiting for a future timer interrupt to wake it up, qemu
deadlocks. The timer interrupt never comes because time is driven by...

1ece93a9 04/15/2011 10:27 am Paolo Bonzini

Revert wrong fixes for -icount in the iothread case

This reverts commits 225d02cd and c9f7383c. While some parts of
the latter could be saved, I preferred a smooth, complete revert.

Signed-off-by: Paolo Bonzini <>
Tested-by: Edgar E. Iglesias <>...

cb842c90 04/15/2011 10:27 am Paolo Bonzini

qemu_next_deadline should not consider host-time timers

It is purely for icount-based virtual timers. And now that we got the
code right, rename the function to clarify the intended scope.

Signed-off-by: Paolo Bonzini <>
Tested-by: Edgar E. Iglesias <>...

7bd427d8 03/21/2011 10:23 am Paolo Bonzini

change all rt_clock references to use millisecond resolution accessors

This was done with:

sed -i '/get_clock\>.*rt_clock/s/get_clock\>/get_clock_ms/' \
$(git grep -l 'get_clock\>.*rt_clock' )
sed -i '/new_timer\>.*rt_clock/s/new_timer\>/new_timer_ms/' \...
74475455 03/21/2011 10:23 am Paolo Bonzini

change all other clock references to use nanosecond resolution accessors

This was done with:

sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \
$(git grep -l 'qemu_get_clock\>' )
sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \
$(git grep -l 'qemu_new_timer\>' )...
4a998740 03/21/2011 10:23 am Paolo Bonzini

add a generic scaling mechanism for timers

This enables rt_clock timers to use nanosecond resolution, just by
using the _ns functions; there is really no reason to forbid that.

Migrated timers are all using vm_clock (of course; but I checked that
anyway) so the timers in the savevm files are already in nanosecond...

6d5ad9bf 03/21/2011 10:23 am Paolo Bonzini

remove qemu_get_clock

These patches are already not doing a great service to out-of-tree
modifications to QEMU. However, at least we can warn them by getting
rid of the old confusing functions, or otherwise causing compilation
errors. This patch removes qemu_get_clock; the previous one changed...

cfced5b2 03/13/2011 04:44 pm Paolo Bonzini

implement win32 dynticks timer

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Blue Swirl <>

68c23e55 03/13/2011 04:44 pm Paolo Bonzini

use win32 timer queues

Multimedia timers are only useful for compatibility with Windows NT 4.0
and earlier. Plus, the implementation in Wine is extremely heavyweight.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Blue Swirl <>

c9f7383c 02/23/2011 11:42 am Paolo Bonzini

do not use qemu_icount_delta in the !use_icount case

The !use_icount code is the same for iothread and non-iothread,
except that the timeout is different. Since the timeout might as
well be infinite and is only masking bugs, use the higher value.
With this change the !use_icount code is handled equivalently...

f26e5a54 02/07/2011 09:50 pm Stefan Weil

qemu-timer: Fix compilation of new timer code for w32, w64

qemu_next_alarm_deadline() is needed by MinGW, too.

Cc: Paolo Bonzini <>
Cc: Anthony Liguori <>
Acked-by: Paolo Bonzini <>
Signed-off-by: Stefan Weil <>...

9c13246a 02/04/2011 02:33 pm Paolo Bonzini

use nanoseconds everywhere for timeout computation

Suggested by Aurelien Jarno.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

6ad0a1ed 02/04/2011 02:33 pm Paolo Bonzini

Correct alarm deadline computation

When the QEMU_CLOCK_HOST clock was added, computation of its
deadline was added to qemu_next_deadline, which is correct but
incomplete.

I noticed this by reading the very convoluted rules whereby
qemu_next_deadline_dyntick is computed, which miss QEMU_CLOCK_HOST...

4c3d45eb 02/04/2011 02:33 pm Paolo Bonzini

Unify alarm deadline computation

This patch shows how using the correct formula for
qemu_next_deadline_dyntick can simplify the code of
host_alarm_handler and eliminate useless duplication.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

225d02cd 01/23/2011 05:44 am Edgar E. Iglesias

Avoid deadlock whith iothread and icount

When using the iothread together with icount, make sure the
qemu_icount counter makes forward progress when the vcpu is
idle to avoid deadlocks.

Signed-off-by: Edgar E. Iglesias <>

c57c846a 10/23/2010 06:24 pm Blue Swirl

qemu-timer: move commonly used timer code to qemu-timer-common

Move timer init functions to a new file, qemu-timer-common.c. Make other
critical timer functions inlined to preserve performance in
qemu-timer.c, also move muldiv64() (used by the inline functions)...

0be71e32 07/06/2010 06:36 pm Alex Williamson

savevm: Add DeviceState param

When available, we'd like to be able to access the DeviceState
when registering a savevm. For buses with a get_dev_path()
function, this will allow us to create more unique savevm
id strings.

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

29e922b6 03/29/2010 10:24 pm Blue Swirl

Compile qemu-timer only once

Arrange various declarations so that also non-CPU code can access
them, adjust users.

Move CPU specific code to cpus.c.

Signed-off-by: Blue Swirl <>

44459349 03/27/2010 03:38 pm Juergen Lock

Add a missing #include for FreeBSD hosts

Signed-off-by: Juergen Lock <>
Signed-off-by: Aurelien Jarno <>

ca5a2a4b 03/27/2010 03:05 pm Paolo Bonzini

fix race between timer firing vs. alarm_timer->pending = 0

The period for Win32 timers is very short and always the same
independent of dynticks, so it's possible that the timer fires
before qemu_run_all_timers has reset alarm_timer->pending to zero.
Reset alarm_timer->pending before rearming....

db1a4972 03/17/2010 06:16 pm Paolo Bonzini

split out qemu-timer.c

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>