#
cd1bd53a |
| 24-Dec-2014 |
Paolo Bonzini <pbonzini@redhat.com> |
qemu-timer: introduce timer_deinit
In some cases, a timer was set to NULL so that we could check if it is initialized. Use the timer_list field instead, and add a timer_deinit function that NULLs i
qemu-timer: introduce timer_deinit
In some cases, a timer was set to NULL so that we could check if it is initialized. Use the timer_list field instead, and add a timer_deinit function that NULLs it.
It then makes sense that timer_del be a no-op (instead of a crasher) on such a de-initialized timer. It avoids the need to poke at the timerlist field to check if the timers are initialized.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
f186aa97 |
| 23-Dec-2014 |
Paolo Bonzini <pbonzini@redhat.com> |
qemu-timer: rename timer_init to timer_init_tl
timer_init is not called that often. Free the name for an equivalent of timer_new.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
dfa9c2a0 |
| 15-Dec-2014 |
Peter Maydell <peter.maydell@linaro.org> |
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
- Migration and linuxboot fixes for 2.2 regressions - valgrind/KVM support - small i386 patches - PCI SD host controller
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
- Migration and linuxboot fixes for 2.2 regressions - valgrind/KVM support - small i386 patches - PCI SD host controller support - malloc/free cleanups from Markus (x86/scsi) - IvyBridge model - XSAVES support for KVM - initial patches from record/replay
# gpg: Signature made Mon 15 Dec 2014 16:35:08 GMT using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83
* remotes/bonzini/tags/for-upstream: (47 commits) sdhci: Support SDHCI devices on PCI sdhci: Define SDHCI PCI ids sdhci: Add "sysbus" to sdhci QOM types and methods sdhci: Remove class "virtual" methods sdhci: Set a default frequency clock serial: only resample THR interrupt on rising edge of IER.THRI serial: update LSR on enabling/disabling FIFOs serial: clean up THRE/TEMT handling serial: reset thri_pending on IER writes with THRI=0 linuxboot: fix loading old kernels kvm/apic: fix 2.2->2.1 migration target-i386: add Ivy Bridge CPU model target-i386: add f16c and rdrand to Haswell and Broadwell target-i386: add VME to all CPUs pc: add 2.3 machine types i386: do not cross the pages boundaries in replay mode cpus: make icount warp behave well with respect to stop/cont timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock cpu-exec: invalidate nocache translation if they are interrupted icount: introduce cpu_get_icount_raw ...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
show more ...
|
#
4e7fa73e |
| 26-Nov-2014 |
Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> |
timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock
This patch introduces new QEMU_CLOCK_VIRTUAL_RT clock, which should be used for icount warping. In the next patch, it will be used to avoid a huge i
timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock
This patch introduces new QEMU_CLOCK_VIRTUAL_RT clock, which should be used for icount warping. In the next patch, it will be used to avoid a huge icount warp when a virtual machine is stopped for a long time.
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
490309fc |
| 25-Nov-2014 |
Peter Maydell <peter.maydell@linaro.org> |
qemu-timer: Avoid overflows when converting timeout to struct timespec
In qemu_poll_ns(), when we convert an int64_t nanosecond timeout into a struct timespec, we may accidentally run into overflow
qemu-timer: Avoid overflows when converting timeout to struct timespec
In qemu_poll_ns(), when we convert an int64_t nanosecond timeout into a struct timespec, we may accidentally run into overflow problems if the timeout is very long. This happens because the tv_sec field is a time_t, which is signed, so we might end up setting it to a negative value by mistake. This will result in what was intended to be a near-infinite timeout turning into an instantaneous timeout, and we'll busy loop. Cap the maximum timeout at INT32_MAX seconds (about 68 years) to avoid this problem.
This specifically manifested on ARM hosts as an extreme slowdown on guest shutdown (when the guest reprogrammed the PL031 RTC to not generate alarms using a very long timeout) but could happen on other hosts and guests too.
Reported-by: Christoffer Dall <christoffer.dall@linaro.org> Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1416939705-1272-1-git-send-email-peter.maydell@linaro.org
show more ...
|
#
02ce232c |
| 06-May-2014 |
Kirill Batuzov <batuzovk@ispras.ru> |
vl.c: remove init_clocks call from main
Clocks are initialized in qemu_init_main_loop. They are not needed before it. Initializing them twice is not only unnecessary but is harmful: it results in me
vl.c: remove init_clocks call from main
Clocks are initialized in qemu_init_main_loop. They are not needed before it. Initializing them twice is not only unnecessary but is harmful: it results in memory leak and potentially can lead to a situation where different parts of QEMU use different sets of timers.
To avoid it remove init_clocks call from main and add an assertion to qemu_clock_init that corresponding clock has not been initialized yet.
Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
fbdb664c |
| 03-May-2014 |
Stefan Weil <sw@weilnetz.de> |
qemu-timer: Add missing 'static' attribute
This fixes a warning from the static code analysis (smatch).
Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
#
add40e97 |
| 03-Oct-2013 |
Paolo Bonzini <pbonzini@redhat.com> |
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
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 <alex@alex.org.uk> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
0f809e5f |
| 03-Oct-2013 |
Paolo Bonzini <pbonzini@redhat.com> |
timer: extract timer_mod_ns_locked and timerlist_rearm
These will be reused in timer_mod_anticipate functions.
Reviewed-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Paolo Bonzini <pbonzini@redh
timer: extract timer_mod_ns_locked and timerlist_rearm
These will be reused in timer_mod_anticipate functions.
Reviewed-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
3c053411 |
| 25-Sep-2013 |
Liu Ping Fan <qemulist@gmail.com> |
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
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 timerlist.
Note, qemu_clock_enable(foo,false) can _not_ be called from timer's cb. Also, the callers of qemu_clock_enable() should be protected by the BQL.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
3db1ee7c |
| 12-Sep-2013 |
Paolo Bonzini <pbonzini@redhat.com> |
qemu-timer: do not take the lock in timer_pending
We can deduce the result from expire_time, by making it always -1 if the timer is not in the active_timers list. We need to check against negative
qemu-timer: do not take the lock in timer_pending
We can deduce the result from expire_time, by making it always -1 if the timer is not in the active_timers list. We need to check against negative times passed to timer_mod_ns; clamping them to zero is not a problem because the only clock that has a zero value at VM startup is QEMU_CLOCK_VIRTUAL, and it is monotonic so it cannot be non-zero. QEMU_CLOCK_HOST, instead, is not monotonic but it cannot go to negative values unless the host time is seriously screwed up and points to the 1960s.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
978f2205 |
| 12-Sep-2013 |
Stefan Hajnoczi <stefanha@redhat.com> |
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
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 qemu_clock_has_timers() works fine today but is also not thread-safe.
The purpose of this patch is to eventually let device models set or cancel timers from a vcpu thread without holding the global mutex.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
da718ceb |
| 12-Sep-2013 |
Stefan Hajnoczi <stefanha@redhat.com> |
qemu-timer: drop outdated signal safety comments
host_alarm_handler() is invoked from the signal processing thread (currently the iothread). Previously we did processing in a real signal handler wi
qemu-timer: drop outdated signal safety comments
host_alarm_handler() is invoked from the signal processing thread (currently the iothread). Previously we did processing in a real signal handler with signalfd and therefore needed signal-safe timer code.
Today host_alarm_handler() just marks the alarm timer as expired/pending and notifies the main loop using qemu_notify_event().
Therefore these outdated comments about signal safety can be dropped.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
b4049b74 |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
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 <alex@alex.org.uk> Signed-off
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 <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
7bf8fbde |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
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 si
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 <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
40daca54 |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
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.
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 <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
63111b69 |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
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 Bl
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 <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
6d327171 |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
aio / timers: Remove alarm timers
Remove alarm timers from qemu-timers.c now we use g_poll / ppoll instead.
Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@red
aio / timers: Remove alarm timers
Remove alarm timers from qemu-timers.c now we use g_poll / ppoll instead.
Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
ac70aafc |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
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 al
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>
show more ...
|
#
b1bbfe72 |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
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 q
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 all QEMUTimerLists attached to the QEMUClock.
Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
d5541d86 |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
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 <alex@alex.org.uk> Signed-off-by:
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 <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
754d6a54 |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
aio / timers: Add QEMUTimerListGroup and helper functions
Add QEMUTimerListGroup and helper functions, to represent a QEMUTimerList associated with each clock. Add a default QEMUTimerListGroup repre
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. an AioContext as added by future patches).
Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
ff83c66e |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
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.
Intro
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 call the relevant QEMUTimerList implementations, using the clock's default timerlist. This vastly reduces the invasiveness of this change and means the API stays constant for existing users.
Introduce a list of QEMUTimerLists associated with each clock so that reenabling the clock can cause all the notifiers to be called. Note the code to do the notifications is added in a later patch.
Switch QEMUClockType to an enum. Remove global variables vm_clock, host_clock and rt_clock and add compatibility defines. Do not fix qemu_next_alarm_deadline as it's going to be deleted.
Add qemu_clock_use_for_deadline to indicate whether a particular clock should be used for deadline calculations. When use_icount is true, vm_clock should not be used for deadline calculations as it does not contain a nanosecond count. Instead, icount timeouts come from the execution thread doing aio_notify or qemu_notify as appropriate. This function is used in the next patch.
Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
f9a976b7 |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
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 r
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 <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
cd758dd0 |
| 21-Aug-2013 |
Alex Bligh <alex@alex.org.uk> |
aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack
Where supported, called prctl(PR_SET_TIMERSLACK, 1, ...) to set one nanosecond timer slack to increase precision of timer cal
aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack
Where supported, called prctl(PR_SET_TIMERSLACK, 1, ...) to set one nanosecond timer slack to increase precision of timer calls.
Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|