cpus: join thread when removing a vCPU
If no one joins the thread, its associated memory is leaked. Reported-by: CheneyLin <linzc@zju.edu.cn> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
8178e6376f
commit
dbadee4ff4
13
cpus.c
13
cpus.c
@ -1752,19 +1752,14 @@ void resume_all_vcpus(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpu_remove(CPUState *cpu)
|
void cpu_remove_sync(CPUState *cpu)
|
||||||
{
|
{
|
||||||
cpu->stop = true;
|
cpu->stop = true;
|
||||||
cpu->unplug = true;
|
cpu->unplug = true;
|
||||||
qemu_cpu_kick(cpu);
|
qemu_cpu_kick(cpu);
|
||||||
}
|
qemu_mutex_unlock_iothread();
|
||||||
|
qemu_thread_join(cpu->thread);
|
||||||
void cpu_remove_sync(CPUState *cpu)
|
qemu_mutex_lock_iothread();
|
||||||
{
|
|
||||||
cpu_remove(cpu);
|
|
||||||
while (cpu->created) {
|
|
||||||
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For temporary buffers for forming a name */
|
/* For temporary buffers for forming a name */
|
||||||
|
Loading…
Reference in New Issue
Block a user