From: Paolo Bonzini <pbonzini@redhat.com>
To: "Marcin Gibuła" <m.gibula@beyond.pl>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Stefan Hajnoczi <stefanha@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] thread-pool: fix deadlock when callbacks depends on each other
Date: Mon, 02 Jun 2014 17:32:30 +0200 [thread overview]
Message-ID: <538C990E.1080308@redhat.com> (raw)
In-Reply-To: <538B78A9.8060804@beyond.pl>
Il 01/06/2014 21:02, Marcin Gibuła ha scritto:
>> Good catch! The main problem with the patch is that you need to use
>> atomic_inc/atomic_dec to increment and decrement
>> pool->pending_completions.
>
> Ok.
>
>> Secondarily, event_notifier_set is pretty heavy-weight, does it work if
>> you wrap the loop like this?
>>
>> restart:
>> QLIST_FOREACH_SAFE(elem, &pool->head, all, next) {
>> ...
>> }
>> if (pool->pending_completions) {
>> goto restart;
>> }
>> event_notifier_test_and_clear(notifier);
>> if (pool->pending_completions) {
>> event_notifier_set(notifier);
>> goto restart;
>> }
>
> I'll test it tomorrow. I assume you want to avoid calling
> event_notifier_set() until function is reentered via aio_pool?
Yes. But actually, I need to check if it's possible to fix
bdrv_drain_all. If you're in coroutine context, you can defer the
draining to a safe point using a bottom half. If you're not in
coroutine context, perhaps bdrv_drain_all has to be made illegal. Which
means a bunch of code auditing...
Paolo
>> Finally, the same bug is also in block/linux-aio.c and
>> block/win32-aio.c.
>
> I can try with linux-aio, but my knowledge of windows api is zero...
>
next prev parent reply other threads:[~2014-06-02 15:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <538A1F71.4080203@beyond.pl>
2014-06-01 18:12 ` [Qemu-devel] [PATCH] thread-pool: fix deadlock when callbacks depends on each other Paolo Bonzini
2014-06-01 19:02 ` Marcin Gibuła
2014-06-02 15:32 ` Paolo Bonzini [this message]
2014-06-02 15:57 ` Marcin Gibuła
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=538C990E.1080308@redhat.com \
--to=pbonzini@redhat.com \
--cc=m.gibula@beyond.pl \
--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 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).