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