From: Paolo Bonzini <pbonzini@redhat.com>
To: "Aníbal Limón" <anibal.limon@linux.intel.com>,
qemu-devel@nongnu.org, qemu-stable <qemu-stable@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] cpus.c: qemu_mutex_lock_iothread fix race condition at cpu thread init
Date: Fri, 4 Sep 2015 10:15:10 +0200 [thread overview]
Message-ID: <55E9530E.7020600@redhat.com> (raw)
In-Reply-To: <1441313313-3040-1-git-send-email-anibal.limon@linux.intel.com>
On 03/09/2015 22:48, Aníbal Limón wrote:
> When QEMU starts the RCU thread executes qemu_mutex_lock_thread
> causing error "qemu:qemu_cpu_kick_thread: No such process" and exits.
>
> This isn't occur frequently but in glibc the thread id can exist and
> this not guarantee that the thread is on active/running state. If is
> inserted a sleep(1) after newthread assignment [1] the issue appears.
>
> So not make assumption that thread exist if first_cpu->thread is set
> then change the validation of cpu to created that is set into cpu
> threads (kvm, tcg, dummy).
>
> [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_create.c;h=d10f4ea8004e1d8f3a268b95cc0f8d93b8d89867;hb=HEAD#l621
>
> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Cc: qemu-stable@nongnu.org
Paolo
> ---
> cpus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cpus.c b/cpus.c
> index 7e4786e..05e5400 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1171,7 +1171,7 @@ void qemu_mutex_lock_iothread(void)
> * TCG code execution.
> */
> if (!tcg_enabled() || qemu_in_vcpu_thread() ||
> - !first_cpu || !first_cpu->thread) {
> + !first_cpu || !first_cpu->created) {
> qemu_mutex_lock(&qemu_global_mutex);
> atomic_dec(&iothread_requesting_mutex);
> } else {
>
next prev parent reply other threads:[~2015-09-04 8:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-03 20:48 [Qemu-devel] [PATCH] cpus.c: qemu_mutex_lock_iothread fix race condition at cpu thread init Aníbal Limón
2015-09-04 8:15 ` Paolo Bonzini [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-09-03 19:24 Aníbal Limón
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55E9530E.7020600@redhat.com \
--to=pbonzini@redhat.com \
--cc=anibal.limon@linux.intel.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).