qemu-devel
[Top][All Lists]
Advanced

[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

Attachment: pgp7bcbnUB_wO.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]