[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v2 03/11] docs: new design document multi-thread-t
Re: [Qemu-devel] [RFC v2 03/11] docs: new design document multi-thread-tcg.txt (DRAFTING)
Wed, 25 May 2016 21:13:46 +0300
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0
On 25/05/16 21:03, Paolo Bonzini wrote:
>> The page table seems to be protected by 'mmap_lock' in user mode
>> emulation but by 'tb_lock' in system mode emulation. It may turn to be
>> possible to read it safely even with no lock held.
> Yes, it is possible to at least follow the radix tree safely with no
> lock held. The fields in the leaves can be either lockless or protected
> by a lock.
> The radix tree can be followed without a lock just like you do with RCU.
> The difference with RCU is that:
> 1) the leaves are protected with a lock, so you don't do the "copy";
> instead after reading you lock around updates
> 2) the radix tree is only ever added to, so you don't need to protect
> the reads with rcu_read_lock/rcu_read_unlock. rcu_read_lock and
> rcu_read_unlock are only needed to inform the deleters that something
> cannot yet go away. Without deleters, you don't need rcu_read_lock
> and rcu_read_unlock (but you still need atomic_rcu_read/atomic_rcu_set).
Yes, however looking closer at how the leafs are used I can't see much
point to do this so far...