|
From: | Emanuele Giuseppe Esposito |
Subject: | Re: [PATCH v2 5/7] block-copy: add QemuMutex lock for BlockCopyCallState list |
Date: | Tue, 25 May 2021 12:58:52 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
On 21/05/2021 17:01, Paolo Bonzini wrote:
On 20/05/21 17:30, Vladimir Sementsov-Ogievskiy wrote:18.05.2021 13:07, Emanuele Giuseppe Esposito wrote:As for BlockCopyTask, add a lock to protect BlockCopyCallState ret and sleep_state fields. Also move ret, finished and cancelled in the OUT fields of BlockCopyCallState. Here a QemuMutex is used to protect QemuCoSleep field, since it can be concurrently invoked also from outside threads.
Actually I don't even protect it here, I should have deleted the above line. I left a TODO for the QemuCoSleep field.
.finished, .cancelled and reads to .ret and .error_is_read will be protected in the following patch. .sleep state is handled in the series "coroutine: new sleep/wake API"Could we live with one mutex for all needs? Why to add one more?This patch should just go away; the QemuMutex will not be needed once QemuCoSleep is thread safe, while right now it is still racy.
At this point, I would just rename the other lock (tasks_lock) in "lock" or "state_lock", and substitute it in the calls_lock usages of this patch. Depending on how it comes out, I may merge this with the previous patch.
Thank you, Emanuele
[Prev in Thread] | Current Thread | [Next in Thread] |