[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: |
Thu, 17 Jul 2014 13:56:44 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, Jul 15, 2014 at 05:21:21PM +0200, Paolo Bonzini wrote:
> Il 15/07/2014 16:37, Stefan Hajnoczi ha scritto:
> >>> 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.
>
> Ah, I missed this remark.
>
> Then you could add qemu_bh_cancel at the end of the BH handler.
No, because a worker thread could be completing a work item just as we
leave the BH handler. Then the BH would be cancelled and the work item
completion would never get executed (until the next work item
completes).
This is why I needed the atomic completion_token. That way I could
check whether more requests completed while we were in the BH handler.
Stefan
pgpCVXl6qgQe7.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