On Thu, Sep 10, 2020 at 1:23 AM Paolo Bonzini <pbonz...@redhat.com> wrote:
> 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 <luoyongg...@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-mlevi...@redhat.com/20200831150124.206267-3-mlevi...@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. > > Tried and not working. > Paolo > > -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo