Fix: counter-api: always inline counter add function
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 6 Jan 2021 20:07:01 +0000 (15:07 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 19 Jan 2021 16:39:43 +0000 (11:39 -0500)
commit2b8161a4ae82a2438e553eef0828a94fb3e24ace
treedaeaccf903f269910ac833cd67f3d37bb1320bee
parent4a7d870a981874db47b3c3b94f913fdd57bf19d6
Fix: counter-api: always inline counter add function

The counter add function uses cmpxchg() and cmpxchg_local() on 1, 2, 4,
and 8 bytes types.

In libcounter, the 8 bytes type is only supported on 64-bit
architectures, but the 1, 2, 4 byte type code is present for all
architectures, even though only the 4 byte code is currently used by
lttng-modules.

The ARM implementation of cmpxchg uses the "__bad_cmpxchg" linker error
to report use of cmpxchg on an unsupported size.

Considering that "inline" does not strictly mean always inline (depends
on CONFIG_OPTIMIZE_INLINING on some kernels, and does not mean forced
inlining in recent kernels), the compiler is free to generate a function
rather than perform inlining. If that happens, then the __bad_cmpxchg
linker error is generated even if the 1 and 2 bytes types are unused.

Therefore, use __always_inline for functions in counter-api.h to force
inlining, and therefore removal of unused code before linking, which is
required by this Linux kernel __bad_cmpxchg linker error trick.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1adccd1382e71abc5880e0351d976b779245468a
include/counter/counter-api.h
This page took 0.025529 seconds and 4 git commands to generate.