[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.1? 2/2] thread-pool: avoid deadlock in nes
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH for-2.1? 2/2] thread-pool: avoid deadlock in nested aio_poll() calls |
Date: |
Tue, 15 Jul 2014 16:37:19 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, Jul 14, 2014 at 12:49:38PM +0200, Paolo Bonzini wrote:
> Il 14/07/2014 10:36, Paolo Bonzini ha scritto:
> >
> >
> >to
> >
> > /* In case elem->common.cb() makes a nested aio_poll() call,
> > * next may become invalid as well. Instead of just
> > * restarting the QLIST_FOREACH_SAFE, go through the BH
> > * once more, which also avoids deadlock if element A's
> > * callback waits for element B and both completed at the
> > * same time.
> > */
> > qemu_bh_schedule(pool->completion_bh);
> > elem->common.cb(elem->common.opaque, elem->ret);
> > qemu_aio_release(elem);
>
> This is of course missing here:
>
> break;
Let's keep goto restart so we don't use the BH for each completion
callback. We just need the BH scheduled once to protect against the
deadlock.
Stefan
pgp7bcbnUB_wO.pgp
Description: PGP signature
Re: [Qemu-devel] [PATCH for-2.1? 0/2] thread-pool: avoid fd usage and fix nested aio_poll() deadlock, Christian Borntraeger, 2014/07/11