From: Paolo Bonzini <pbonzini@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com,
den@openvz.org, dplotnikov@virtuozzo.com, jcody@redhat.com
Subject: Re: [Qemu-devel] AioContext locking vs. coroutines (was: [PATCH] mirror dead-lock)
Date: Fri, 30 Nov 2018 12:22:09 +0100 [thread overview]
Message-ID: <bee3fa2f-67dc-0948-5ffc-97949e96a0cc@redhat.com> (raw)
In-Reply-To: <20181129104255.GC4797@linux.fritz.box>
On 29/11/18 11:42, Kevin Wolf wrote:
> I guess in this specific instance we can just remove the locking from
> mirror_read/write_complete becasue it's only locking an AioContext whose
> lock we already hold anyway because we're in a Coroutine owned by the
> AioContext, so yielding will release the lock and avoid the deadlock.
>
> But more generally, does this mean that it is never correct to have an
> explicit aio_context_acquire/release() pair in coroutine context, at
> least for all practical cases where you call things that could yield?
Yes. In fact, I remember asking Max to drop aio_context_acquire/release
from mirror.c when he converted it to coroutines, but that must have
fallen through the cracks.
> And if you're inside a coroutine and want to access something in a
> different AioContext, you need to drop out of the coroutine first?
> If so, should aio_context_acquire() then assert that it's not called
> from coroutine context?
I'm not sure about that; there could be legitimate case in which the
main thread acquires another context's lock.
> Paolo, will this restriction of coroutines be solved for good when you
> get your patches merged that remove the AioContext lock?
Yes.
Paolo
prev parent reply other threads:[~2018-11-30 11:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-28 20:13 [Qemu-devel] [PATCH] mirror dead-lock Vladimir Sementsov-Ogievskiy
2018-11-29 10:42 ` [Qemu-devel] AioContext locking vs. coroutines (was: [PATCH] mirror dead-lock) Kevin Wolf
2018-11-29 12:15 ` [Qemu-devel] AioContext locking vs. coroutines Vladimir Sementsov-Ogievskiy
2018-11-30 11:22 ` Paolo Bonzini [this message]
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=bee3fa2f-67dc-0948-5ffc-97949e96a0cc@redhat.com \
--to=pbonzini@redhat.com \
--cc=den@openvz.org \
--cc=dplotnikov@virtuozzo.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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).