aboutsummaryrefslogtreecommitdiff
path: root/util/qemu-timer.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-03-14 16:52:17 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-03-14 16:52:17 +0000
commit64c358a33ad984c9c4348b64f9507676f6c9db26 (patch)
tree09d050b767e9fc6c24c9fbc21fae00fbe786da06 /util/qemu-timer.c
parent5e2fb7c598c6ae2481ca65d3a730b7fc29fdefbb (diff)
parent2563c9c6b8670400c48e562034b321a7cf3d9a85 (diff)
downloadqemu-64c358a33ad984c9c4348b64f9507676f6c9db26.zip
qemu-64c358a33ad984c9c4348b64f9507676f6c9db26.tar.gz
qemu-64c358a33ad984c9c4348b64f9507676f6c9db26.tar.bz2
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* "x" monitor command fix for KVM (Christian) * MemoryRegion name documentation (David) * mem-prealloc optimization (Jitendra) * -icount/MTTCG fixes (me) * "info mtree" niceness (Peter) * NBD drop_sync buffer overflow (Vladimir/Eric) * small cleanups and bugfixes (Li, Lin, Suramya, Thomas) * fix for "-device kvmclock" w/TCG (Eduardo) * debug output before crashing on KVM_{GET,SET}_MSRS (Eduardo) # gpg: Signature made Tue 14 Mar 2017 13:42:05 GMT # gpg: using RSA key 0xBFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # 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: nbd/client: fix drop_sync [CVE-2017-2630] memory: info mtree check mr range overflow icount: process QEMU_CLOCK_VIRTUAL timers in vCPU thread main-loop: remove now unnecessary optimization cpus: define QEMUTimerListNotifyCB for QEMU system emulation qemu-timer: do not include sysemu/cpus.h from util/qemu-timer.h qemu-timer: fix off-by-one target/nios2: take BQL around interrupt check scsi: mptsas: fix the wrong reading size in fetch request util: Removed unneeded header from path.c configure: add the missing help output for optional features scripts/dump-guest-memory.py: fix int128_get64 on recent gcc kvmclock: Don't crash QEMU if KVM is disabled kvm: Print MSR information if KVM_{GET,SET}_MSRS failed exec: add cpu_synchronize_state to cpu_memory_rw_debug mem-prealloc: reduce large guest start-up and migration time. docs: Add a note about mixing bootindex with "-boot order" memory_region: Fix name comments Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/qemu-timer.c')
-rw-r--r--util/qemu-timer.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index 6cf70b9..82d5650 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -27,6 +27,7 @@
#include "qemu/timer.h"
#include "sysemu/replay.h"
#include "sysemu/sysemu.h"
+#include "sysemu/cpus.h"
#ifdef CONFIG_POSIX
#include <pthread.h>
@@ -121,7 +122,7 @@ void timerlist_free(QEMUTimerList *timer_list)
g_free(timer_list);
}
-static void qemu_clock_init(QEMUClockType type)
+static void qemu_clock_init(QEMUClockType type, QEMUTimerListNotifyCB *notify_cb)
{
QEMUClock *clock = qemu_clock_ptr(type);
@@ -133,7 +134,7 @@ static void qemu_clock_init(QEMUClockType type)
clock->last = INT64_MIN;
QLIST_INIT(&clock->timerlists);
notifier_list_init(&clock->reset_notifiers);
- main_loop_tlg.tl[type] = timerlist_new(type, NULL, NULL);
+ main_loop_tlg.tl[type] = timerlist_new(type, notify_cb, NULL);
}
bool qemu_clock_use_for_deadline(QEMUClockType type)
@@ -199,7 +200,7 @@ bool timerlist_expired(QEMUTimerList *timer_list)
expire_time = timer_list->active_timers->expire_time;
qemu_mutex_unlock(&timer_list->active_timers_lock);
- return expire_time < qemu_clock_get_ns(timer_list->clock->type);
+ return expire_time <= qemu_clock_get_ns(timer_list->clock->type);
}
bool qemu_clock_expired(QEMUClockType type)
@@ -277,7 +278,7 @@ QEMUTimerList *qemu_clock_get_main_loop_timerlist(QEMUClockType type)
void timerlist_notify(QEMUTimerList *timer_list)
{
if (timer_list->notify_cb) {
- timer_list->notify_cb(timer_list->notify_opaque);
+ timer_list->notify_cb(timer_list->notify_opaque, timer_list->clock->type);
} else {
qemu_notify_event();
}
@@ -634,11 +635,11 @@ void qemu_clock_unregister_reset_notifier(QEMUClockType type,
notifier_remove(notifier);
}
-void init_clocks(void)
+void init_clocks(QEMUTimerListNotifyCB *notify_cb)
{
QEMUClockType type;
for (type = 0; type < QEMU_CLOCK_MAX; type++) {
- qemu_clock_init(type);
+ qemu_clock_init(type, notify_cb);
}
#ifdef CONFIG_PRCTL_PR_SET_TIMERSLACK
@@ -657,7 +658,9 @@ bool qemu_clock_run_all_timers(void)
QEMUClockType type;
for (type = 0; type < QEMU_CLOCK_MAX; type++) {
- progress |= qemu_clock_run_timers(type);
+ if (qemu_clock_use_for_deadline(type)) {
+ progress |= qemu_clock_run_timers(type);
+ }
}
return progress;