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

From: Jonas Oberhauser
Date: Tue Jan 24 2023 - 10:55:34 EST




On 1/19/2023 5:41 PM, Alan Stern wrote:
On Thu, Jan 19, 2023 at 12:22:50PM +0100, Jonas Oberhauser wrote:

On 1/19/2023 3:28 AM, Alan Stern wrote:
This is a permanent error; I've given up. Sorry it didn't
work out.
[It seems the e-mail still reached me through the mailing list]
[For everyone else, Jonas is referring to the fact that the last two
emails I sent to his huaweicloud.com address could not be delivered, so
I copied them off-list to his huawei.com address.]

I consider that a hack though and don't like it.
It _is_ a bit of a hack, but not a huge one. srcu_read_lock() really
is a lot like a load, in that it returns a value obtained by reading
something from memory (along with some other operations, though, so it
isn't a simple straightforward read -- perhaps more like an
atomic_inc_return_relaxed).
The issue I have with this is that it might create accidental ordering. How
does it behave when you throw fences in the mix?
I think this isn't going to be a problem. Certainly any real
implementation of scru_read_lock() is going to involve some actual load
operations, so any unintentional ordering caused by fences will also
apply to real executions. Likewise for srcu_read_unlock and store
operations.

Note that there may indeed be reads in the implementation, but most likely not from the srcu_read_unlock()s of other threads. Most probably from the synchronize_srcu() calls. So the rfe edges being added are probably not corresponding to any rfe edges in the implementation.

That said, I believe there may indeed not be any restrictions in behavior caused by this, because any code that relies on the order being a certain thing would need to use some other ordering mechanism, and that would probably restrict the behavior anyways.

It does have the negative side-effect of creating an explosion of permutations though, by ordering all unlocks() in a total way and also sometimes allowing multiple options for each lock() (e.g., lock();unlock() || lock();unlock()  has 4 executions instead of 1).

Anyways, not much to be done about it right now.

best wishes, jonas