From: "Marcin Gibuła" <m.gibula@beyond.pl>
To: Paolo Bonzini <pbonzini@redhat.com>,
"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: Sun, 01 Jun 2014 21:02:01 +0200 [thread overview]
Message-ID: <538B78A9.8060804@beyond.pl> (raw)
In-Reply-To: <538B6D25.8030106@redhat.com>
> 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?
> 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...
--
mg
next prev parent reply other threads:[~2014-06-01 19:02 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 [this message]
2014-06-02 15:32 ` Paolo Bonzini
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=538B78A9.8060804@beyond.pl \
--to=m.gibula@beyond.pl \
--cc=pbonzini@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 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).