Re: [rcu:rcu/next 35/35] kernel/rcu/tree.c:251:8: error: implicit declaration of function 'arch_atomic_add_return'; did you mean

From: Marco Elver
Date: Thu Jun 25 2020 - 15:35:43 EST


On Thu, Jun 25, 2020 at 04:11PM +0200, Peter Zijlstra wrote:
> On Thu, Jun 25, 2020 at 01:29:26PM +0200, Peter Zijlstra wrote:
> > I fear the same. Let me see if I can quickly modify the atomic scripts
> > to generate the required fallbacks.
>
> Something like so ought to work, I suppose.
>
> ---
> Subject: locking/atomics: Provide the arch_atomic_ interface to generic code
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Date: Thu Jun 25 15:55:14 CEST 2020
>
> Architectures with instrumented (KASAN/KCSAN) atomic operations
> natively provide arch_atomic_ variants that are not instrumented.
>
> It turns out that some generic code also requires arch_atomic_ in
> order to avoid instrumentation, so provide the arch_atomic_ interface
> as a direct map into the regular atomic_ interface for
> non-instrumented architectures.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> include/linux/atomic-fallback.h | 236 +++++++++++++++++++++++++++++++++-
> scripts/atomic/gen-atomic-fallback.sh | 31 ++++
> 2 files changed, 266 insertions(+), 1 deletion(-)

Thanks, looks reasonable!

If noinstr becomes important on architectures that don't implement
atomics using arch_ themselves, there might be a problem with
CONFIG_TRACE_BRANCH_PROFILING, because unlikely() is used throughout
this file. Probably not something to worry about now.

Thanks,
-- Marco