Re: [PATCH] tools/memory-model: Add details about SRCU read-side critical sections

From: Joel Fernandes
Date: Sun Feb 19 2023 - 12:13:32 EST


On Sun, Feb 19, 2023 at 12:11 PM Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> wrote:
>
> On Sun, Feb 19, 2023 at 11:48 AM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Mon, Feb 13, 2023 at 01:55:06AM +0000, Joel Fernandes (Google) wrote:
[...]
> > + A: idx1 = srcu_read_lock(&s);
> > + B: srcu_read_unlock(&s, idx1);
> > + C: idx2 = srcu_read_lock(&s);
> > + D: srcu_read_unlock(&s, idx2);
> > +
> > +it would appear that B was a store to a temporary variable (i.e., s)
> > +and C was a load from that variable, thereby allowing carry-srcu-data
> > +to extend a data dependency from A to D and giving the impression
> > +that D was the srcu-unlock event matching A's srcu-lock.
>
> Even though it may be redundant: would it be possible to also mention
> (after this paragraph) that this case forms an undesirable "->rf" link
> between B and C, which then causes us to link A and D as a result?
>
> A[srcu-lock] ->data B[once] ->rf C[once] ->data D[srcu-unlock].

Apologies, I meant here, care must be taken to avoid:

A[srcu-lock] ->data B[srcu-unlock] ->rf C[srcu-lock] ->data D[srcu-unlock].

Thanks,

- Joel