Re: [PATCH bpf-next v3 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-29 Thread Hao Luo
On Mon, Sep 21, 2020 at 11:11 AM Andrii Nakryiko wrote: > > On Thu, Sep 17, 2020 at 12:14 PM Hao Luo wrote: > > > > I need to cast the pointer to "const void __percpu *" before passing > > into per_cpu_ptr. I will update and resend. > > You can try just declaring it as __percpu in BPF_CALL_2 macr

Re: [PATCH bpf-next v3 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-29 Thread Hao Luo
Hi, Andrii, Thanks for taking a look. Sorry for the late reply. Spent some time on rebasing and fixing a build issue in my development environment that started happening in v5.9. On Mon, Sep 21, 2020 at 11:09 AM Andrii Nakryiko wrote: > > On Wed, Sep 16, 2020 at 3:39 PM Hao Luo wrote: > > > > A

Re: [PATCH bpf-next v3 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-21 Thread Andrii Nakryiko
On Thu, Sep 17, 2020 at 12:14 PM Hao Luo wrote: > > I need to cast the pointer to "const void __percpu *" before passing > into per_cpu_ptr. I will update and resend. You can try just declaring it as __percpu in BPF_CALL_2 macro. That might work, or not, depending on how exactly BPF_CALL macros a

Re: [PATCH bpf-next v3 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-21 Thread Andrii Nakryiko
On Wed, Sep 16, 2020 at 3:39 PM Hao Luo wrote: > > Add bpf_per_cpu_ptr() to help bpf programs access percpu vars. > bpf_per_cpu_ptr() has the same semantic as per_cpu_ptr() in the kernel > except that it may return NULL. This happens when the cpu parameter is > out of range. So the caller must che

Re: [PATCH bpf-next v3 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-17 Thread Hao Luo
I need to cast the pointer to "const void __percpu *" before passing into per_cpu_ptr. I will update and resend. On Wed, Sep 16, 2020 at 6:14 PM kernel test robot wrote: > > Hi Hao, > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on bpf-next/master] > > url

Re: [PATCH bpf-next v3 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-16 Thread kernel test robot
Hi Hao, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on bpf-next/master] url: https://github.com/0day-ci/linux/commits/Hao-Luo/bpf-BTF-support-for-ksyms/20200917-064052 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master config:

[PATCH bpf-next v3 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-16 Thread Hao Luo
Add bpf_per_cpu_ptr() to help bpf programs access percpu vars. bpf_per_cpu_ptr() has the same semantic as per_cpu_ptr() in the kernel except that it may return NULL. This happens when the cpu parameter is out of range. So the caller must check the returned value. Acked-by: Andrii Nakryiko Signed-