]> git.ipfire.org Git - people/arne_f/kernel.git/commit
bpf, arm64: use more scalable stadd over ldxr / stxr loop in xadd
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 26 Apr 2019 19:48:22 +0000 (21:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jul 2019 11:16:03 +0000 (13:16 +0200)
commit889b96a2a9450f1169c3cb5bdb0bb31372d76800
treec673a3dc09350fbd8a29ddfd68cd979b921a0a17
parent9a53f4f87109ddb1a1a5a29d41d5e540dbafb969
bpf, arm64: use more scalable stadd over ldxr / stxr loop in xadd

commit 34b8ab091f9ef57a2bb3c8c8359a0a03a8abf2f9 upstream.

Since ARMv8.1 supplement introduced LSE atomic instructions back in 2016,
lets add support for STADD and use that in favor of LDXR / STXR loop for
the XADD mapping if available. STADD is encoded as an alias for LDADD with
XZR as the destination register, therefore add LDADD to the instruction
encoder along with STADD as special case and use it in the JIT for CPUs
that advertise LSE atomics in CPUID register. If immediate offset in the
BPF XADD insn is 0, then use dst register directly instead of temporary
one.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/insn.h
arch/arm64/kernel/insn.c
arch/arm64/net/bpf_jit.h
arch/arm64/net/bpf_jit_comp.c