qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] AioContext locking vs. coroutines (was: [PATCH] mirror


From: Paolo Bonzini
Subject: Re: [Qemu-block] AioContext locking vs. coroutines (was: [PATCH] mirror dead-lock)
Date: Fri, 30 Nov 2018 12:22:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

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



reply via email to

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