qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 03/12] rcu: add rcu library


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 03/12] rcu: add rcu library
Date: Fri, 17 May 2013 09:35:15 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

Il 17/05/2013 06:36, liu ping fan ha scritto:
>> > +    /* Mark the writer thread offline to make sure we don't wait for
>> > +     * our own quiescent state. This allows using synchronize_rcu()
>> > +     * in threads registered as readers.
>> > +     *
>> > +     * rcu_thread_offline() and rcu_thread_online() include a
>> > +     * memory barrier.
>> > +     */
>> > +    if (was_online) {
>> > +        rcu_thread_offline();
> Encourage the user to call synchronize_rcu() in reader?

Not in a read-side critical section, but in a *thread registered as
reader*.  And in QEMU, all threads actually are registered as readers.

> I think the caller should ensure it is outside read-section.

That would be possible by adding a small overhead to rcu_read_lock/unlock.

> Also online can be
> nested which make the situation even worse.

It's not online that can be nested, only offline.  So:

- if the thread is already marked as offline, there will be no effect.

- if the thread is not marked as offline, it will be.

Paolo



reply via email to

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