[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/6] cpus: join thread when removing a vCPU
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 6/6] cpus: join thread when removing a vCPU |
Date: |
Thu, 1 Feb 2018 09:44:30 -0500 |
If no one joins the thread, its associated memory is leaked.
Reported-by: CheneyLin <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpus.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/cpus.c b/cpus.c
index 03b4533b7d..e8c3ba064c 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1795,19 +1795,14 @@ void resume_all_vcpus(void)
}
}
-void cpu_remove(CPUState *cpu)
+void cpu_remove_sync(CPUState *cpu)
{
cpu->stop = true;
cpu->unplug = true;
qemu_cpu_kick(cpu);
-}
-
-void cpu_remove_sync(CPUState *cpu)
-{
- cpu_remove(cpu);
- while (cpu->created) {
- qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
- }
+ qemu_mutex_unlock_iothread();
+ qemu_thread_join(cpu->thread);
+ qemu_mutex_lock_iothread();
}
/* For temporary buffers for forming a name */
--
2.14.3
- [Qemu-devel] [PATCH 0/6] cpus: fix various issues with vCPU unplug, Paolo Bonzini, 2018/02/01
- [Qemu-devel] [PATCH 1/6] cpus: hax: register/unregister thread with RCU, exit loop on unplug, Paolo Bonzini, 2018/02/01
- [Qemu-devel] [PATCH 3/6] cpus: dummy: unregister thread with RCU, exit loop on unplug, Paolo Bonzini, 2018/02/01
- [Qemu-devel] [PATCH 2/6] cpus: kvm: unregister thread with RCU, Paolo Bonzini, 2018/02/01
- [Qemu-devel] [PATCH 4/6] cpus: tcg: unregister thread with RCU, fix exiting of loop on unplug, Paolo Bonzini, 2018/02/01
- [Qemu-devel] [PATCH 6/6] cpus: join thread when removing a vCPU,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 5/6] cpus: hvf: unregister thread with RCU, Paolo Bonzini, 2018/02/01