# 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_socrates_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- 85xx/socrates_defconfig # < make -s -j 160 ARCH=powerpc O=/kisskb/build/powerpc-next_85xx_socrates_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_socrates_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_socrates_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- Completed OK # rm -rf /kisskb/build/powerpc-next_85xx_socrates_defconfig_powerpc-gcc5 # Build took: 0:00:31.397932