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

Paul E. McKenney
2023-01-13T19:54:51Z

On Fri, Jan 13, 2023 at 11:38:17AM -0500, Alan Stern wrote:
> 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()

You are quite right, thank you! Yes, the time outside of an RCU
read-side critical section for a given process/CPU/task/whatever need
not be simultaneous with any other process/CPU/task/whatever.

Thanx, Paul