summaryrefslogtreecommitdiff
path: root/qemu-timer.c
AgeCommit message (Collapse)AuthorFilesLines
2011-03-21remove qemu_get_clockPaolo Bonzini1-17/+0
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 qemu_new_timer's signature. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21add a generic scaling mechanism for timersPaolo Bonzini1-8/+17
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 resolution. So this patch makes no change to the migration format. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21change all other clock references to use nanosecond resolution accessorsPaolo Bonzini1-6/+6
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\>' ) after checking that get_clock and new_timer never occur twice on the same line. There were no missed occurrences; however, even if there had been, they would have been caught by the compiler. There was exactly one false positive in qemu_run_timers: - current_time = qemu_get_clock (clock); + current_time = qemu_get_clock_ns (clock); which is of course not in this patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21change all rt_clock references to use millisecond resolution accessorsPaolo Bonzini1-3/+3
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/' \ $(git grep -l 'new_timer\>.*rt_clock' ) after checking that get_clock and new_timer never occur twice on the same line. There were no missed occurrences; however, even if there had been, they would have been caught by the compiler. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-13use win32 timer queuesPaolo Bonzini1-51/+35
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 <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-13implement win32 dynticks timerPaolo Bonzini1-1/+6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-23do not use qemu_icount_delta in the !use_icount casePaolo Bonzini1-34/+25
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 in qemu_icount_delta and qemu_calculate_timeout, and we rip it out of the former. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2011-02-07qemu-timer: Fix compilation of new timer code for w32, w64Stefan Weil1-2/+2
qemu_next_alarm_deadline() is needed by MinGW, too. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Anthony Liguori <aliguori@us.ibm.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-04Unify alarm deadline computationPaolo Bonzini1-17/+11
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 <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-04Correct alarm deadline computationPaolo Bonzini1-4/+11
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 when use_icount is true. This patch inlines qemu_next_deadline into qemu_next_deadline_dyntick, and then corrects the logic to skip only QEMU_CLOCK_VIRTUAL when use_icount is true. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-04use nanoseconds everywhere for timeout computationPaolo Bonzini1-16/+16
Suggested by Aurelien Jarno. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-01-23Avoid deadlock whith iothread and icountEdgar E. Iglesias1-6/+9
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 <edgar.iglesias@gmail.com>
2010-10-23qemu-timer: move commonly used timer code to qemu-timer-commonBlue Swirl1-73/+0
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) to qemu-timer.h. Adjust block/raw-posix.c and simpletrace.c to use get_clock() directly. Remove a similar/duplicate definition in qemu-tool.c. Adjust hw/omap_clk.c to include qemu-timer.h because muldiv64() is used there. After this change, tracing can be used also for user code and simpletrace on Win32. Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-06savevm: Add DeviceState paramAlex Williamson1-1/+1
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 <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-29Compile qemu-timer only onceBlue Swirl1-18/+2
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 <blauwirbel@gmail.com>
2010-03-27Add a missing #include for FreeBSD hostsJuergen Lock1-0/+3
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-27fix race between timer firing vs. alarm_timer->pending = 0Paolo Bonzini1-2/+2
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. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-17split out qemu-timer.cPaolo Bonzini1-0/+1203
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>