Re: [PATCH v2 perf,bpf 1/3] perf, bpf: Introduce PERF_RECORD_BPF_EVENT
From: kbuild test robot
Date: Thu Dec 06 2018 - 20:34:32 EST
Hi Song,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.20-rc5 next-20181206]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Song-Liu/perf-bpf-Introduce-PERF_RECORD_BPF_EVENT/20181207-083615
config: i386-randconfig-x070-201848 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (new ones prefixed by >>):
kernel/events/core.c: In function 'perf_event_bpf_output':
>> kernel/events/core.c:7694:2: error: implicit declaration of function 'bpf_get_prog_name'; did you mean 'bpf_prog_free'? [-Werror=implicit-function-declaration]
bpf_get_prog_name(bpf_event->prog, name);
^~~~~~~~~~~~~~~~~
bpf_prog_free
kernel/events/core.c: In function 'perf_event_bpf_event_subprog':
>> kernel/events/core.c:7737:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
.addr = (u64)prog->bpf_func,
^
cc1: some warnings being treated as errors
vim +7694 kernel/events/core.c
7679
7680 static void perf_event_bpf_output(struct perf_event *event,
7681 void *data)
7682 {
7683 struct perf_bpf_event *bpf_event = data;
7684 struct perf_output_handle handle;
7685 struct perf_sample_data sample;
7686 char name[KSYM_NAME_LEN];
7687 int name_len;
7688 int ret;
7689
7690 if (!perf_event_bpf_match(event))
7691 return;
7692
7693 /* get prog name and round up to 64 bit aligned */
> 7694 bpf_get_prog_name(bpf_event->prog, name);
7695 name_len = strlen(name) + 1;
7696 while (!IS_ALIGNED(name_len, sizeof(u64)))
7697 name[name_len++] = '\0';
7698 bpf_event->event_id.len += name_len;
7699
7700 perf_event_header__init_id(&bpf_event->event_id.header, &sample, event);
7701 ret = perf_output_begin(&handle, event,
7702 bpf_event->event_id.header.size);
7703 if (ret)
7704 return;
7705
7706 perf_output_put(&handle, bpf_event->event_id);
7707
7708 __output_copy(&handle, name, name_len);
7709
7710 perf_event__output_id_sample(event, &handle, &sample);
7711
7712 perf_output_end(&handle);
7713 }
7714
7715 static void perf_event_bpf(struct perf_bpf_event *bpf_event)
7716 {
7717 perf_iterate_sb(perf_event_bpf_output,
7718 bpf_event,
7719 NULL);
7720 }
7721
7722 static void perf_event_bpf_event_subprog(
7723 enum perf_bpf_event_type type,
7724 struct bpf_prog *prog, u32 id, u32 sub_id)
7725 {
7726 struct perf_bpf_event bpf_event = (struct perf_bpf_event){
7727 .prog = prog,
7728 .event_id = {
7729 .header = {
7730 .type = PERF_RECORD_BPF_EVENT,
7731 .size = sizeof(bpf_event.event_id),
7732 },
7733 .type = type,
7734 /* .flags = 0 */
7735 .id = id,
7736 .sub_id = sub_id,
> 7737 .addr = (u64)prog->bpf_func,
7738 .len = prog->jited_len,
7739 },
7740 };
7741
7742 memcpy(bpf_event.event_id.tag, prog->tag, BPF_TAG_SIZE);
7743 perf_event_bpf(&bpf_event);
7744 }
7745
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip