aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2018-09-27 18:17:24 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-02 19:09:14 +0200
commit1926ab273b374372e5108a9e360b9e9366d9acf7 (patch)
tree1d8c299817974341c2d416f649ff64e847c50d14 /cpus.c
parent687ac05d71bbb3172e0546248e40483ef43a4813 (diff)
downloadqemu-1926ab273b374372e5108a9e360b9e9366d9acf7.zip
qemu-1926ab273b374372e5108a9e360b9e9366d9acf7.tar.gz
qemu-1926ab273b374372e5108a9e360b9e9366d9acf7.tar.bz2
cpus: fix TCG kick timer leak
This is an alternative fix to Marc-André's original patch. Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20180927171724.30128-1-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cpus.c b/cpus.c
index 68f08f5..361678e 100644
--- a/cpus.c
+++ b/cpus.c
@@ -983,6 +983,8 @@ static void start_tcg_kick_timer(void)
if (!tcg_kick_vcpu_timer && CPU_NEXT(first_cpu)) {
tcg_kick_vcpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
kick_tcg_thread, NULL);
+ }
+ if (tcg_kick_vcpu_timer && !timer_pending(tcg_kick_vcpu_timer)) {
timer_mod(tcg_kick_vcpu_timer, qemu_tcg_next_kick());
}
}
@@ -990,9 +992,8 @@ static void start_tcg_kick_timer(void)
static void stop_tcg_kick_timer(void)
{
assert(!mttcg_enabled);
- if (tcg_kick_vcpu_timer) {
+ if (tcg_kick_vcpu_timer && timer_pending(tcg_kick_vcpu_timer)) {
timer_del(tcg_kick_vcpu_timer);
- tcg_kick_vcpu_timer = NULL;
}
}