Hi Andrii, I love your patch! Yet something to improve: [auto build test ERROR on bpf-next/master] url: https://github.com/0day-ci/linux/commits/Andrii-Nakryiko/BPF-perf-link-and-user-provided-context-value/20210726-014304 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master config: powerpc64-randconfig-s032-20210725 (attached as .config) compiler: powerpc-linux-gcc (GCC) 10.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.3-341-g8af24329-dirty # https://github.com/0day-ci/linux/commit/aebdacfee760371d78456f088ddcc6c5450ce5f5 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Andrii-Nakryiko/BPF-perf-link-and-user-provided-context-value/20210726-014304 git checkout aebdacfee760371d78456f088ddcc6c5450ce5f5 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): kernel/bpf/syscall.c: In function 'bpf_perf_link_release': >> kernel/bpf/syscall.c:2919:2: error: implicit declaration of function 'perf_event_free_bpf_prog'; did you mean 'perf_event_detach_bpf_prog'? [-Werror=implicit-function-declaration] 2919 | perf_event_free_bpf_prog(event); | ^~~~~~~~~~~~~~~~~~~~~~~~ | perf_event_detach_bpf_prog kernel/bpf/syscall.c: In function 'bpf_perf_link_attach': >> kernel/bpf/syscall.c:2965:8: error: implicit declaration of function 'perf_event_set_bpf_prog'; did you mean 'perf_event_detach_bpf_prog'? [-Werror=implicit-function-declaration] 2965 | err = perf_event_set_bpf_prog(event, prog); | ^~~~~~~~~~~~~~~~~~~~~~~ | perf_event_detach_bpf_prog cc1: some warnings being treated as errors vim +2919 kernel/bpf/syscall.c 2913 2914 static void bpf_perf_link_release(struct bpf_link *link) 2915 { 2916 struct bpf_perf_link *perf_link = container_of(link, struct bpf_perf_link, link); 2917 struct perf_event *event = perf_link->perf_file->private_data; 2918 > 2919 perf_event_free_bpf_prog(event); 2920 fput(perf_link->perf_file); 2921 } 2922 2923 static void bpf_perf_link_dealloc(struct bpf_link *link) 2924 { 2925 struct bpf_perf_link *perf_link = container_of(link, struct bpf_perf_link, link); 2926 2927 kfree(perf_link); 2928 } 2929 2930 static const struct bpf_link_ops bpf_perf_link_lops = { 2931 .release = bpf_perf_link_release, 2932 .dealloc = bpf_perf_link_dealloc, 2933 }; 2934 2935 static int bpf_perf_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) 2936 { 2937 struct bpf_link_primer link_primer; 2938 struct bpf_perf_link *link; 2939 struct perf_event *event; 2940 struct file *perf_file; 2941 int err; 2942 2943 if (attr->link_create.flags) 2944 return -EINVAL; 2945 2946 perf_file = perf_event_get(attr->link_create.target_fd); 2947 if (IS_ERR(perf_file)) 2948 return PTR_ERR(perf_file); 2949 2950 link = kzalloc(sizeof(*link), GFP_USER); 2951 if (!link) { 2952 err = -ENOMEM; 2953 goto out_put_file; 2954 } 2955 bpf_link_init(&link->link, BPF_LINK_TYPE_PERF_EVENT, &bpf_perf_link_lops, prog); 2956 link->perf_file = perf_file; 2957 2958 err = bpf_link_prime(&link->link, &link_primer); 2959 if (err) { 2960 kfree(link); 2961 goto out_put_file; 2962 } 2963 2964 event = perf_file->private_data; > 2965 err = perf_event_set_bpf_prog(event, prog); 2966 if (err) { 2967 bpf_link_cleanup(&link_primer); 2968 goto out_put_file; 2969 } 2970 /* perf_event_set_bpf_prog() doesn't take its own refcnt on prog */ 2971 bpf_prog_inc(prog); 2972 2973 return bpf_link_settle(&link_primer); 2974 2975 out_put_file: 2976 fput(perf_file); 2977 return err; 2978 } 2979 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org