Re: [PATCH bpf-next v2 5/6] bpf: specify the old and new poke_type for bpf_arch_text_poke

From: kernel test robot
Date: Mon Nov 17 2025 - 15:56:12 EST


Hi Menglong,

kernel test robot noticed the following build errors:

[auto build test ERROR on bpf-next/master]

url: https://github.com/intel-lab-lkp/linux/commits/Menglong-Dong/ftrace-introduce-FTRACE_OPS_FL_JMP/20251117-115243
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20251117034906.32036-6-dongml2%40chinatelecom.cn
patch subject: [PATCH bpf-next v2 5/6] bpf: specify the old and new poke_type for bpf_arch_text_poke
config: powerpc64-randconfig-002-20251118 (https://download.01.org/0day-ci/archive/20251118/202511180431.JVOEm6SO-lkp@xxxxxxxxx/config)
compiler: powerpc64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251118/202511180431.JVOEm6SO-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511180431.JVOEm6SO-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

arch/powerpc/net/bpf_jit_comp.c: In function 'bpf_arch_text_poke':
>> arch/powerpc/net/bpf_jit_comp.c:1135:7: error: 'poke_type' undeclared (first use in this function); did you mean 'probe_type'?
if (poke_type != BPF_MOD_JUMP) {
^~~~~~~~~
probe_type
arch/powerpc/net/bpf_jit_comp.c:1135:7: note: each undeclared identifier is reported only once for each function it appears in


vim +1135 arch/powerpc/net/bpf_jit_comp.c

d243b62b7bd3d5 Naveen N Rao 2024-10-30 1070
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1071 /*
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1072 * A 3-step process for bpf prog entry:
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1073 * 1. At bpf prog entry, a single nop/b:
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1074 * bpf_func:
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1075 * [nop|b] ool_stub
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1076 * 2. Out-of-line stub:
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1077 * ool_stub:
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1078 * mflr r0
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1079 * [b|bl] <bpf_prog>/<long_branch_stub>
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1080 * mtlr r0 // CONFIG_PPC_FTRACE_OUT_OF_LINE only
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1081 * b bpf_func + 4
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1082 * 3. Long branch stub:
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1083 * long_branch_stub:
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1084 * .long <branch_addr>/<dummy_tramp>
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1085 * mflr r11
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1086 * bcl 20,31,$+4
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1087 * mflr r12
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1088 * ld r12, -16(r12)
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1089 * mtctr r12
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1090 * mtlr r11 // needed to retain ftrace ABI
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1091 * bctr
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1092 *
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1093 * dummy_tramp is used to reduce synchronization requirements.
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1094 *
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1095 * When attaching a bpf trampoline to a bpf prog, we do not need any
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1096 * synchronization here since we always have a valid branch target regardless
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1097 * of the order in which the above stores are seen. dummy_tramp ensures that
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1098 * the long_branch stub goes to a valid destination on other cpus, even when
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1099 * the branch to the long_branch stub is seen before the updated trampoline
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1100 * address.
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1101 *
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1102 * However, when detaching a bpf trampoline from a bpf prog, or if changing
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1103 * the bpf trampoline address, we need synchronization to ensure that other
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1104 * cpus can no longer branch into the older trampoline so that it can be
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1105 * safely freed. bpf_tramp_image_put() uses rcu_tasks to ensure all cpus
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1106 * make forward progress, but we still need to ensure that other cpus
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1107 * execute isync (or some CSI) so that they don't go back into the
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1108 * trampoline again.
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1109 */
7cc5910294285d Menglong Dong 2025-11-17 1110 int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t,
7cc5910294285d Menglong Dong 2025-11-17 1111 enum bpf_text_poke_type new_t, void *old_addr,
7cc5910294285d Menglong Dong 2025-11-17 1112 void *new_addr)
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1113 {
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1114 unsigned long bpf_func, bpf_func_end, size, offset;
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1115 ppc_inst_t old_inst, new_inst;
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1116 int ret = 0, branch_flags;
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1117 char name[KSYM_NAME_LEN];
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1118
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1119 if (IS_ENABLED(CONFIG_PPC32))
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1120 return -EOPNOTSUPP;
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1121
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1122 bpf_func = (unsigned long)ip;
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1123
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1124 /* We currently only support poking bpf programs */
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1125 if (!__bpf_address_lookup(bpf_func, &size, &offset, name)) {
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1126 pr_err("%s (0x%lx): kernel/modules are not supported\n", __func__, bpf_func);
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1127 return -EOPNOTSUPP;
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1128 }
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1129
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1130 /*
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1131 * If we are not poking at bpf prog entry, then we are simply patching in/out
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1132 * an unconditional branch instruction at im->ip_after_call
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1133 */
d243b62b7bd3d5 Naveen N Rao 2024-10-30 1134 if (offset) {
d243b62b7bd3d5 Naveen N Rao 2024-10-30 @1135 if (poke_type != BPF_MOD_JUMP) {

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki