Re: [PATCH] add delay between port write and port read
From: Linus Torvalds (torvalds@xxxxxxxxxxxxxxxxxxxx)
Date: Wed Feb 27 2019 - 12:34:32 EST
On Wed, Feb 27, 2019 at 9:26 AM Will Deacon <will.deacon@xxxxxxx> wrote:
> I suppose you might need the mb() before *and* after the I/O access in the
> read case. The idea with readX()/ioreadX() is that you should be able to
> do something like:
Yeah, that sounds reasonable.
You might relax the barrier after the readX() to just a rmb(), which
might make the performance impact slightly less noticeable and might
be sufficient in practice. But I guess once you do IO, it's not like
the CPU barrier will be the limiting case.
That said, excessively weakly ordered CPU's are horrible for a reason,
and the barrier model was broken and made them even more so. And
alpha is a posted boy for "don't let hw people design a memory odering
just to make it easy for them".
So maybe just a full mb() and see if anybody notices. Better to have
working code than random failures.