Re: [PATCH v3 bpf-next 2/3] bpf: introduce helper bpf_get_branch_snapshot

From: kernel test robot
Date: Tue Aug 31 2021 - 07:17:03 EST


Hi Song,

I love your patch! Yet something to improve:

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

url: https://github.com/0day-ci/linux/commits/Song-Liu/bpf-introduce-bpf_get_branch_snapshot/20210831-054455
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: x86_64-randconfig-a003-20210831 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/09548da8ea3e9a75d0d969b18c148ce17ed1c97d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Song-Liu/bpf-introduce-bpf_get_branch_snapshot/20210831-054455
git checkout 09548da8ea3e9a75d0d969b18c148ce17ed1c97d
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

ld: kernel/bpf/trampoline.o: in function `__bpf_prog_enter':
>> kernel/bpf/trampoline.c:578: undefined reference to `bpf_perf_branch_snapshot'


vim +578 kernel/bpf/trampoline.c

551
552 /* The logic is similar to bpf_prog_run(), but with an explicit
553 * rcu_read_lock() and migrate_disable() which are required
554 * for the trampoline. The macro is split into
555 * call __bpf_prog_enter
556 * call prog->bpf_func
557 * call __bpf_prog_exit
558 *
559 * __bpf_prog_enter returns:
560 * 0 - skip execution of the bpf prog
561 * 1 - execute bpf prog
562 * [2..MAX_U64] - execute bpf prog and record execution time.
563 * This is start time.
564 */
565 u64 notrace __bpf_prog_enter(struct bpf_prog *prog)
566 __acquires(RCU)
567 {
568 #ifdef CONFIG_PERF_EVENTS
569 /* Calling migrate_disable costs two entries in the LBR. To save
570 * some entries, we call perf_snapshot_branch_stack before
571 * migrate_disable to save some entries. This is OK because we
572 * care about the branch trace before entering the BPF program.
573 * If migrate happens exactly here, there isn't much we can do to
574 * preserve the data.
575 */
576 if (prog->call_get_branch)
577 static_call(perf_snapshot_branch_stack)(
> 578 this_cpu_ptr(&bpf_perf_branch_snapshot));
579 #endif
580 rcu_read_lock();
581 migrate_disable();
582 if (unlikely(__this_cpu_inc_return(*(prog->active)) != 1)) {
583 inc_misses_counter(prog);
584 return 0;
585 }
586 return bpf_prog_start_time();
587 }
588

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip