[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
- [Qemu-devel] [RFC PATCH 00/12] RCU implementation for QEMU, Paolo Bonzini, 2013/05/15
- [Qemu-devel] [PATCH 02/12] qemu-thread: add QemuEvent, Paolo Bonzini, 2013/05/15
- [Qemu-devel] [PATCH 03/12] rcu: add rcu library, Paolo Bonzini, 2013/05/15
- [Qemu-devel] [PATCH 04/12] qemu-thread: register threads with RCU, Paolo Bonzini, 2013/05/15
- [Qemu-devel] [PATCH 05/12] rcu: add call_rcu, Paolo Bonzini, 2013/05/15
- [Qemu-devel] [PATCH 06/12] rcu: add rcutorture, Paolo Bonzini, 2013/05/15
- [Qemu-devel] [PATCH 09/12] event loop: report RCU quiescent states, Paolo Bonzini, 2013/05/15
- [Qemu-devel] [PATCH 08/12] qemu-thread: report RCU quiescent states, Paolo Bonzini, 2013/05/15
- [Qemu-devel] [PATCH 10/12] cpus: report RCU quiescent states, Paolo Bonzini, 2013/05/15
- [Qemu-devel] [PATCH 01/12] add a header file for atomic operations, Paolo Bonzini, 2013/05/15