# git rev-parse -q --verify bb86adc4825afb5a01be747f451317c4a29a3607^{commit} bb86adc4825afb5a01be747f451317c4a29a3607 already have revision, skipping fetch # git checkout -q -f -B kisskb bb86adc4825afb5a01be747f451317c4a29a3607 # git clean -qxdf # < git log -1 # commit bb86adc4825afb5a01be747f451317c4a29a3607 # Author: Naveen N Rao # Date: Fri Oct 18 23:06:32 2024 +0530 # # powerpc64/bpf: Add support for bpf trampolines # # Add support for bpf_arch_text_poke() and arch_prepare_bpf_trampoline() # for 64-bit powerpc. While the code is generic, BPF trampolines are only # enabled on 64-bit powerpc. 32-bit powerpc will need testing and some # updates. # # BPF Trampolines adhere to the existing ftrace ABI utilizing a # two-instruction profiling sequence, as well as the newer ABI utilizing a # three-instruction profiling sequence enabling return with a 'blr'. The # trampoline code itself closely follows x86 implementation. # # BPF prog JIT is extended to mimic 64-bit powerpc approach for ftrace # having a single nop at function entry, followed by the function # profiling sequence out-of-line and a separate long branch stub for calls # to trampolines that are out of range. A dummy_tramp is provided to # simplify synchronization similar to arm64. # # When attaching a bpf trampoline to a bpf prog, we can patch up to three # things: # - the nop at bpf prog entry to go to the out-of-line stub # - the instruction in the out-of-line stub to either call the bpf trampoline # directly, or to branch to the long_branch stub. # - the trampoline address before the long_branch stub. # # We do not need any synchronization here since we always have a valid # branch target regardless of the order in which the above stores are # seen. dummy_tramp ensures that the long_branch stub goes to a valid # destination on other cpus, even when the branch to the long_branch stub # is seen before the updated trampoline address. # # However, when detaching a bpf trampoline from a bpf prog, or if changing # the bpf trampoline address, we need synchronization to ensure that other # cpus can no longer branch into the older trampoline so that it can be # safely freed. bpf_tramp_image_put() uses rcu_tasks to ensure all cpus # make forward progress, but we still need to ensure that other cpus # execute isync (or some CSI) so that they don't go back into the # trampoline again. While here, update the stale comment that describes # the redzone usage in ppc64 BPF JIT. # # Signed-off-by: Naveen N Rao # Signed-off-by: Hari Bathini # Signed-off-by: Michael Ellerman # Link: https://patch.msgid.link/20241018173632.277333-18-hbathini@linux.ibm.com # < /opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld --version # < git log --format=%s --max-count=1 bb86adc4825afb5a01be747f451317c4a29a3607 # make -s -j 160 ARCH=powerpc O=/kisskb/build/powerpc-next_85xx_ge_imp3a_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- 85xx/ge_imp3a_defconfig # < make -s -j 160 ARCH=powerpc O=/kisskb/build/powerpc-next_85xx_ge_imp3a_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- help # make -s -j 160 ARCH=powerpc O=/kisskb/build/powerpc-next_85xx_ge_imp3a_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- olddefconfig # make -s -j 160 ARCH=powerpc O=/kisskb/build/powerpc-next_85xx_ge_imp3a_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- /kisskb/src/kernel/locking/spinlock.c:68:17: warning: no previous prototype for '__raw_spin_lock' [-Wmissing-prototypes] void __lockfunc __raw_##op##_lock(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:126:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(spin, raw_spinlock); ^ /kisskb/src/kernel/locking/spinlock.c:80:26: warning: no previous prototype for '__raw_spin_lock_irqsave' [-Wmissing-prototypes] unsigned long __lockfunc __raw_##op##_lock_irqsave(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:126:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(spin, raw_spinlock); ^ /kisskb/src/kernel/locking/spinlock.c:98:17: warning: no previous prototype for '__raw_spin_lock_irq' [-Wmissing-prototypes] void __lockfunc __raw_##op##_lock_irq(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:126:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(spin, raw_spinlock); ^ /kisskb/src/kernel/locking/spinlock.c:103:17: warning: no previous prototype for '__raw_spin_lock_bh' [-Wmissing-prototypes] void __lockfunc __raw_##op##_lock_bh(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:126:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(spin, raw_spinlock); ^ /kisskb/src/kernel/locking/spinlock.c:68:17: warning: no previous prototype for '__raw_read_lock' [-Wmissing-prototypes] void __lockfunc __raw_##op##_lock(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:129:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(read, rwlock); ^ /kisskb/src/kernel/locking/spinlock.c:80:26: warning: no previous prototype for '__raw_read_lock_irqsave' [-Wmissing-prototypes] unsigned long __lockfunc __raw_##op##_lock_irqsave(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:129:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(read, rwlock); ^ /kisskb/src/kernel/locking/spinlock.c:98:17: warning: no previous prototype for '__raw_read_lock_irq' [-Wmissing-prototypes] void __lockfunc __raw_##op##_lock_irq(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:129:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(read, rwlock); ^ /kisskb/src/kernel/locking/spinlock.c:103:17: warning: no previous prototype for '__raw_read_lock_bh' [-Wmissing-prototypes] void __lockfunc __raw_##op##_lock_bh(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:129:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(read, rwlock); ^ /kisskb/src/kernel/locking/spinlock.c:68:17: warning: no previous prototype for '__raw_write_lock' [-Wmissing-prototypes] void __lockfunc __raw_##op##_lock(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:130:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(write, rwlock); ^ /kisskb/src/kernel/locking/spinlock.c:80:26: warning: no previous prototype for '__raw_write_lock_irqsave' [-Wmissing-prototypes] unsigned long __lockfunc __raw_##op##_lock_irqsave(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:130:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(write, rwlock); ^ /kisskb/src/kernel/locking/spinlock.c:98:17: warning: no previous prototype for '__raw_write_lock_irq' [-Wmissing-prototypes] void __lockfunc __raw_##op##_lock_irq(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:130:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(write, rwlock); ^ /kisskb/src/kernel/locking/spinlock.c:103:17: warning: no previous prototype for '__raw_write_lock_bh' [-Wmissing-prototypes] void __lockfunc __raw_##op##_lock_bh(locktype##_t *lock) \ ^ /kisskb/src/kernel/locking/spinlock.c:130:1: note: in expansion of macro 'BUILD_LOCK_OPS' BUILD_LOCK_OPS(write, rwlock); ^ cc1: warning: unrecognized command line option '-Wno-shift-negative-value' cc1: warning: unrecognized command line option '-Wno-stringop-overflow' Completed OK # rm -rf /kisskb/build/powerpc-next_85xx_ge_imp3a_defconfig_powerpc-gcc5 # Build took: 0:00:41.940463