[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202007170909.3hwaFrr9%lkp@intel.com>
Date: Fri, 17 Jul 2020 09:07:57 +0800
From: kernel test robot <lkp@...el.com>
To: Song Liu <songliubraving@...com>, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org, netdev@...r.kernel.org
Cc: kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
ast@...nel.org, daniel@...earbox.net, kernel-team@...com,
john.fastabend@...il.com, kpsingh@...omium.org, brouer@...hat.com,
peterz@...radead.org
Subject: Re: [PATCH v2 bpf-next 1/2] bpf: separate bpf_get_[stack|stackid]
for perf events BPF
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-fix-stackmap-on-perf_events-with-PEBS/20200715-133118
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: arm64-randconfig-r004-20200716 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ed6b578040a85977026c93bf4188f996148f3218)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
>> kernel/bpf/stackmap.c:698:26: error: incompatible pointer types passing 'bpf_user_pt_regs_t *' (aka 'struct user_pt_regs *') to parameter of type 'struct pt_regs *' [-Werror,-Wincompatible-pointer-types]
return __bpf_get_stack(ctx->regs, NULL, NULL, buf, size, flags);
^~~~~~~~~
kernel/bpf/stackmap.c:581:45: note: passing argument to parameter 'regs' here
static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,
^
kernel/bpf/stackmap.c:726:26: error: incompatible pointer types passing 'bpf_user_pt_regs_t *' (aka 'struct user_pt_regs *') to parameter of type 'struct pt_regs *' [-Werror,-Wincompatible-pointer-types]
ret = __bpf_get_stack(ctx->regs, NULL, trace, buf,
^~~~~~~~~
kernel/bpf/stackmap.c:581:45: note: passing argument to parameter 'regs' here
static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,
^
kernel/bpf/stackmap.c:740:26: error: incompatible pointer types passing 'bpf_user_pt_regs_t *' (aka 'struct user_pt_regs *') to parameter of type 'struct pt_regs *' [-Werror,-Wincompatible-pointer-types]
ret = __bpf_get_stack(ctx->regs, NULL, trace, buf,
^~~~~~~~~
kernel/bpf/stackmap.c:581:45: note: passing argument to parameter 'regs' here
static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,
^
kernel/bpf/stackmap.c:745:25: error: incompatible pointer types passing 'bpf_user_pt_regs_t *' (aka 'struct user_pt_regs *') to parameter of type 'struct pt_regs *' [-Werror,-Wincompatible-pointer-types]
return __bpf_get_stack(ctx->regs, NULL, trace, buf, size, flags);
^~~~~~~~~
kernel/bpf/stackmap.c:581:45: note: passing argument to parameter 'regs' here
static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,
^
4 errors generated.
vim +698 kernel/bpf/stackmap.c
687
688 BPF_CALL_4(bpf_get_stack_pe, struct bpf_perf_event_data_kern *, ctx,
689 void *, buf, u32, size, u64, flags)
690 {
691 struct perf_event *event = ctx->event;
692 struct perf_callchain_entry *trace;
693 bool has_kernel, has_user;
694 bool kernel, user;
695 int err = -EINVAL;
696
697 if (!(event->attr.sample_type & __PERF_SAMPLE_CALLCHAIN_EARLY))
> 698 return __bpf_get_stack(ctx->regs, NULL, NULL, buf, size, flags);
699
700 if (unlikely(flags & ~(BPF_F_SKIP_FIELD_MASK | BPF_F_USER_STACK |
701 BPF_F_USER_BUILD_ID)))
702 goto clear;
703
704 user = flags & BPF_F_USER_STACK;
705 kernel = !user;
706
707 has_kernel = !event->attr.exclude_callchain_kernel;
708 has_user = !event->attr.exclude_callchain_user;
709
710 if ((kernel && !has_kernel) || (user && !has_user))
711 goto clear;
712
713 err = -EFAULT;
714 trace = ctx->data->callchain;
715 if (!trace || (!has_kernel && !has_user))
716 goto clear;
717
718 if (has_kernel && has_user) {
719 __u64 nr_kernel = count_kernel_ip(trace);
720 int ret;
721
722 if (kernel) {
723 __u64 nr = trace->nr;
724
725 trace->nr = nr_kernel;
726 ret = __bpf_get_stack(ctx->regs, NULL, trace, buf,
727 size, flags);
728
729 /* restore nr */
730 trace->nr = nr;
731 } else { /* user */
732 u64 skip = flags & BPF_F_SKIP_FIELD_MASK;
733
734 skip += nr_kernel;
735 if (skip > ~BPF_F_SKIP_FIELD_MASK)
736 goto clear;
737
738 flags = (flags & ~BPF_F_SKIP_FIELD_MASK) |
739 (skip & BPF_F_SKIP_FIELD_MASK);
740 ret = __bpf_get_stack(ctx->regs, NULL, trace, buf,
741 size, flags);
742 }
743 return ret;
744 }
745 return __bpf_get_stack(ctx->regs, NULL, trace, buf, size, flags);
746 clear:
747 memset(buf, 0, size);
748 return err;
749
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (38706 bytes)
Powered by blists - more mailing lists