[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 4/4] ppc: dont overwrite initialized idle_timer

From: Shivaprasad G Bhat
Subject: [Qemu-devel] [PATCH v2 4/4] ppc: dont overwrite initialized idle_timer
Date: Wed, 17 Jul 2019 03:20:55 -0500
User-agent: StGit/0.17.1-dirty

The check to see if the idle_timer is already initialized is
missing. Every vcpu thread would call kvm_arch_init_vcpu()
and overwrite the idle_timer resulting in a memory leak.
Patch fixes that.

Signed-off-by: Shivaprasad G Bhat <address@hidden>
 target/ppc/kvm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 8a06d3171e..498ca6d53b 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -491,7 +491,8 @@ int kvm_arch_init_vcpu(CPUState *cs)
         return ret;
-    idle_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, kvm_kick_cpu, cpu);
+    if (!idle_timer)
+        idle_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, kvm_kick_cpu, cpu);
     switch (cenv->mmu_model) {
     case POWERPC_MMU_BOOKE206:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]