Subject: Re: RFC on writel and writel_relaxed

From: Benjamin Herrenschmidt <[email-masked]>
Date: Tue, 27 Mar 2018 09:42:31 +1100

On Tue, 2018-03-27 at 09:36 +1100, Benjamin Herrenschmidt wrote:
> I don't kow, it used to be the case, at least that's what drove us to
> define things the way we did.
> 
> Maybe things changed, but if that's the case, nobody knows for sure,
> and we probably want to get Linus POV on the matter.
> 
> I know I still write drivers that do not add a wmb in that case because
> I expect things to work without it.
> 
> If that has changed, we probably can relax some of the barriers in our
> implementations of writel on a number of architectures, but not before
> auditing a bunch more drivers to make sure they have the write wmb()'s

Note also that this was the entire point behind the definition of
the _relaxed() accessors, to lift that specific ordering guarantee.

If you now says that memory + writel requires a wmb() in between
then you made writel be identical to writel_relaxed.

You might notice that Documentation/driver-api/device-io.rst makes no
mention of wmb() at all.

Cheers,
Ben.