Thread (45 messages) 45 messages, 7 authors, 2020-06-08

Re: [PATCH v5] alpha: fix memory barriers so that they conform to the specification

From: Arnd Bergmann <arnd@arndb.de>
Date: 2020-05-25 14:07:38
Also in: linux-alpha, linux-rtc

On Mon, May 25, 2020 at 3:56 PM Mikulas Patocka [off-list ref] wrote:
On Sun, 24 May 2020, Maciej W. Rozycki wrote:
quoted
respectively, with corresponding out-of-line entry points available, so
that there is no extra inline code produced where the call to the relevant
MMIO accessor is going to end up with an actual function call, as this
would not help performance in any way and would expand code unnecessarily
at all call sites.

 Therefore I suggest that your new `static inline' functions follow the
pattern, perhaps by grouping them with the corresponding ordinary accessor
functions in arch/alpha/include/asm/io.h within the relevant existing
#ifdef, and then by making them `extern inline' and providing out-of-line
implementations in arch/alpha/kernel/io.c, with the individual symbols
exported.  Within arch/alpha/kernel/io.c the compiler will still inline
code as it sees fit as it already does, e.g. `__raw_readq' might get
inlined in `readq' if it turns out cheaper than arranging for an actual
call, including all the stack frame preparation for `ra' preservation;
it's less likely with say `writeq' which probably always ends with a tail
call to `__raw_writeq' as no stack frame is required in that case.

 That for the read accessors.
I think that making the read*_relaxed functions extern inline just causes
source code bloat with no practical gain - if we make them extern inline,
we would need two implementations (one in the include file, the other in
the C file) - and it is not good practice to duplicate code.

The functions __raw_read* are already extern inline, so the compiler will
inline/noinline them depending on the macros trivial_io_bw and
trivial_io_lq - so we can just call them from read*_relaxed without
repeating the extern inline pattern.
You could consider using the helpers in include/asm-generic/io.h
to provide some of the wrappers and only provide the ones that
don't fit in that scheme already.

       Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help