|
From: | Paolo Bonzini |
Subject: | Re: [RFC PATCH 0/5] Removal of AioContext lock, bs->parents and ->children: proof of concept |
Date: | Wed, 13 Apr 2022 22:43:54 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 |
On 4/13/22 18:29, Kevin Wolf wrote:
A reader does not have to be a coroutine. AIO_WAIT_WHILE is not mandatory to allow it to finish, it helps to ensure progress in case some reader is waiting for something, but other than that is not necessary IMO.When it's outside of a coroutine, how would you implement waiting for a writer to finish if not with AIO_WAIT_WHILE()?
In the main thread a non-coroutine can always read the graph though, because the only writer can be the main thread.
If the critical sections are large enough, I don't think rdlock needs to be taken outside a coroutine in the iothread, e.g. in a bottom half.
No I think if we focus on small pieces of code we end up having a million lock/unlock pairs.Yes, I agree. On the other hand, if we're taking the locks in high-level outer operations, avoiding to take the lock recursively might become harder. I guess we'll see how it works out when we actually introduce callers.
My "hope" is that taking the locks in blk_* functions covers most of the calls, and then only a few (dozens) direct uses of bdrv_* remain.
Unfortunately, adding assertions is not easy because "is there a reader" cannot be easily answered. But I think Emanuele has a debug mode that can enable the assertions at a performance cost.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |