Re: [PATCH bpf-next v1 6/8] bpf: Introduce bpf_per_cpu_ptr()

2020-08-24 Thread Hao Luo
On Sat, Aug 22, 2020 at 12:55 AM Andrii Nakryiko wrote: > > On Sat, Aug 22, 2020 at 12:49 AM Hao Luo wrote: > > > > On Fri, Aug 21, 2020 at 8:31 PM Andrii Nakryiko > > wrote: > > > > > > On Fri, Aug 21, 2020 at 8:26 PM Andrii Nakryiko > > > wrote: > > > > > > > > On Wed, Aug 19, 2020 at 3:42

Re: [PATCH bpf-next v1 6/8] bpf: Introduce bpf_per_cpu_ptr()

2020-08-22 Thread Andrii Nakryiko
On Sat, Aug 22, 2020 at 12:49 AM Hao Luo wrote: > > On Fri, Aug 21, 2020 at 8:31 PM Andrii Nakryiko > wrote: > > > > On Fri, Aug 21, 2020 at 8:26 PM Andrii Nakryiko > > wrote: > > > > > > On Wed, Aug 19, 2020 at 3:42 PM Hao Luo wrote: > > > > > > > > Add bpf_per_cpu_ptr() to help bpf programs

Re: [PATCH bpf-next v1 6/8] bpf: Introduce bpf_per_cpu_ptr()

2020-08-22 Thread Hao Luo
On Fri, Aug 21, 2020 at 8:31 PM Andrii Nakryiko wrote: > > On Fri, Aug 21, 2020 at 8:26 PM Andrii Nakryiko > wrote: > > > > On Wed, Aug 19, 2020 at 3:42 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

Re: [PATCH bpf-next v1 6/8] bpf: Introduce bpf_per_cpu_ptr()

2020-08-21 Thread Andrii Nakryiko
On Fri, Aug 21, 2020 at 8:26 PM Andrii Nakryiko wrote: > > On Wed, Aug 19, 2020 at 3:42 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

Re: [PATCH bpf-next v1 6/8] bpf: Introduce bpf_per_cpu_ptr()

2020-08-21 Thread Andrii Nakryiko
On Wed, Aug 19, 2020 at 3:42 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

[PATCH bpf-next v1 6/8] bpf: Introduce bpf_per_cpu_ptr()

2020-08-19 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. Signed-off-by: Hao Luo ---