[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 2/2] rcu: add uninit destructor for rcu
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH v4 2/2] rcu: add uninit destructor for rcu |
Date: |
Wed, 9 Sep 2020 19:23:30 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
On 09/09/20 10:41, Stefan Hajnoczi wrote:
> On Tue, Sep 08, 2020 at 11:10:52PM +0800, Yonggang Luo wrote:
>> This is necessary if the pending rcu calls are closing and removing
>> temp files. This also provide a function
>> void rcu_wait_finished(void);
>> to fixes test-logging.c test failure on msys2/mingw.
>> On windows if the file doesn't closed, you can not remove it.
>>
>> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
>> ---
>> include/qemu/rcu.h | 5 +++++
>> tests/test-logging.c | 2 ++
>> util/rcu.c | 37 ++++++++++++++++++++++++++++++++++++-
>> 3 files changed, 43 insertions(+), 1 deletion(-)
> Can the new drain_call_rcu() function be used? Maxim recently posted the
> following patch:
> https://patchew.org/QEMU/20200831150124.206267-1-mlevitsk@redhat.com/20200831150124.206267-3-mlevitsk@redhat.com/
>
> Whether drain_call_rcu() or rcu_wait_finished() is used, please include
> a comment in the code that documents why the wait is necessary. For
> example, "qemu_log_close() uses RCU for its FILE pointer but Windows
> cannot remove open files, so we need to wait for RCU here".
>
> Another option is to wait for RCU inside qemu_log_close() so that
> callers don't need to worry about this implementation detail:
>
> #ifdef _WIN32
> /* Windows cannot remove open files so we need to wait for RCU here */
> drain_call_rcu();
> #endif
>
In this case even synchronize_rcu() should be okay.
Paolo
signature.asc
Description: OpenPGP digital signature