All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Laszlo Ersek <lersek@redhat.com>, John Snow <jsnow@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] thread-pool.c race condition?
Date: Thu, 02 Apr 2015 18:43:43 +0200	[thread overview]
Message-ID: <551D71BF.6050601@redhat.com> (raw)
In-Reply-To: <CAJSP0QU3XK82fpKjkO0T=6eM+_Ow0vAjX2nJ1hRF6ora4VzTpw@mail.gmail.com>



On 02/04/2015 18:26, Stefan Hajnoczi wrote:
> John Snow has reported that qemu-io can hang when the host is under
> heavy load.  He made the following observations in gdb:
> 
> 1. The program is sitting in aio_poll() (called by bdrv_prwv_co())
> waiting for request completion.
> 
> 2. The thread pool has a ThreadPoolElement with ->state == THREAD_DONE.
> 
> The ThreadPoolElement should have been reaped by
> thread_pool_completion_bh() and its callback invoked.  For some reason
> this didn't happen and the program is blocked in poll(2) waiting.
> 
> This suggests a race condition in thread-pool.c or qemu_bh_schedule()
> (used to complete ThreadPoolElement from a QEMU event loop).
> 
> I don't have a good theory why this happens yet.  Just wanted to share
> in case someone else hits this problem.

Laszlo hit something very similar fairly easily with virtio-scsi (but
not virtio-blk!) on aarch64 hosts.  Any attempt to debug it (ranging
from compilation with -O0 to tracing) made it disappear.  A reliable
reproducer with qemu-io would be a dream...

Paolo

  reply	other threads:[~2015-04-02 16:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 16:26 [Qemu-devel] thread-pool.c race condition? Stefan Hajnoczi
2015-04-02 16:43 ` Paolo Bonzini [this message]
2015-04-02 16:44   ` Stefan Hajnoczi
2015-04-02 16:46   ` John Snow
2015-04-02 16:47   ` Stefan Hajnoczi
2015-04-02 17:00     ` Paolo Bonzini

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=551D71BF.6050601@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=lersek@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.