Re: Internal vs. external barriers (was: Re: Interesting LKMM litmus test)

From: Alan Stern
Date: Fri Jan 13 2023 - 11:40:55 EST


On Thu, Jan 12, 2023 at 01:57:16PM -0800, Paul E. McKenney wrote:

> I will risk sharing the intuition behind the rcu-order counting rule.
>
> In the code, an RCU read-side critical section begins with rcu_read_lock()
> and ends with the matching rcu_read_unlock(). RCU read-side critical
> section may be nested, in which case RCU cares only about the outermost
> of the nested set.
>
> An RCU grace period includes at least one moment in time during which
> each and every process/CPU/task/whatever is not within an RCU read-side
> critical section.

Strictly speaking, this is not right. It should say: For each
process/CPU/task/whatever, an RCU grace period includes at least one
moment in time during which that process is not within an RCU read-side
critical section. There does not have to be any single moment during
which no processes are executing a critical section.

For example, the following is acceptable:

CPU 0: start of synchronize_rcu()......end
CPU 1: rcu_lock().....................rcu_unlock()
CPU 2: rcu_lock().......................rcu_unlock()

Alan