Re: New resources - pls, explain :-(

Linus Torvalds (torvalds@transmeta.com)
Fri, 13 Aug 1999 10:48:56 -0700 (PDT)


On Fri, 13 Aug 1999, Paul Mackerras wrote:
>
> In your opinion, should there be a guarantee that accesses initiated
> by readl/writel/etc. will not be reordered?

I think it should be guaranteed.

There are certainly cases where performance really suffers for that, but
they tend to be very localized and usually fairly easy to pinpoint. In
contrast, if you do the reverse and say "no ordering guaranteed", you will
end up with tons of subtle bugs all over the place. So the logical thing
is definitely to make the default the common and safe case (no
re-ordering), and then see what the specific issues for some specific
region are (ie we may end up having something like

- writel() - strict ordering
- __writel() - only to be used for people who REALLY know that they don't
care about ordering.

> Alternatively, should device driver writers be required to put in an
> explicit statement (mb() or something similar) when they use
> readl/writel/etc. and want to prevent the accesses being reordered?

I really don't think we should make driver writing any harder than
necessary. The defaults should be simple and safe, and should not have any
subtle cases. So no mb() required by default, and only if you want to be
clever can you then perhaps bypass the ordering by doing

__writel
__writel
__writel
mb()
__writel
__writel
__writel
mb()

when you have partial ordering constraints. But then it is the _clever_
persons responsibility to get it right, and if people have problems they
can just say "ok, the clever person was actually a real idiot who just
_thought_ he was being clever, let's just change every __writel to a
writel".

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/