Re: [Qemu-devel] [PATCH] vcpu: create vcpu thread with QEMU_THREAD_DETACHED mode

2018-01-30 Thread Paolo Bonzini
On 28/01/2018 05:14, CheneyLin wrote: >> This is dangerous, it risks introducing use-after-free bugs in the vCPU >> thread. Can you instead add a qemu_thread_join call where the vCPU goes >> away (e.g. unrealize, I'm not sure)? > > 1. If another thread calls qemu_thread_join, it will block until

Re: [Qemu-devel] [PATCH] vcpu: create vcpu thread with QEMU_THREAD_DETACHED mode

2018-01-27 Thread CheneyLin
> -原始邮件- > 发件人: "Paolo Bonzini" <pbonz...@redhat.com> > 发送时间: 2018-01-25 17:59:03 (星期四) > 收件人: linzhecheng <li...@zju.edu.cn>, qemu-devel@nongnu.org > 抄送: crosthwaite.pe...@gmail.com, r...@twiddle.net > 主题: Re: [Qemu-devel] [PATCH] vcpu: create

Re: [Qemu-devel] [PATCH] vcpu: create vcpu thread with QEMU_THREAD_DETACHED mode

2018-01-25 Thread Paolo Bonzini
On 20/01/2018 08:54, linzhecheng wrote: > 1. If we create vcpu thread with QEMU_THREAD_JOINABLE mode, > we will get memory leak when vcpu thread exits, which will happen > when hot-unplug vcpus. > 2. We should use QLIST_FOREACH_SAFE instead of QLIST_FOREACH > if we need to remove the entry in

[Qemu-devel] [PATCH] vcpu: create vcpu thread with QEMU_THREAD_DETACHED mode

2018-01-19 Thread linzhecheng
1. If we create vcpu thread with QEMU_THREAD_JOINABLE mode, we will get memory leak when vcpu thread exits, which will happen when hot-unplug vcpus. 2. We should use QLIST_FOREACH_SAFE instead of QLIST_FOREACH if we need to remove the entry in QLIST. Signed-off-by: linzhecheng