Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-06 Thread Song Liu
> On Apr 6, 2021, at 9:48 AM, Cong Wang wrote: > > On Mon, Apr 5, 2021 at 11:18 PM Song Liu wrote: >> >> >> >>> On Apr 5, 2021, at 6:24 PM, Cong Wang wrote: >>> >>> On Mon, Apr 5, 2021 at 6:08 PM Song Liu wrote: >>>&g

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-05 Thread Song Liu
> On Apr 5, 2021, at 6:24 PM, Cong Wang wrote: > > On Mon, Apr 5, 2021 at 6:08 PM Song Liu wrote: >> >> >> >>> On Apr 5, 2021, at 4:49 PM, Cong Wang wrote: >>> >>> On Fri, Apr 2, 2021 at 4:31 PM Song Liu wrote: >>>&g

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-05 Thread Song Liu
> On Apr 5, 2021, at 4:49 PM, Cong Wang wrote: > > On Fri, Apr 2, 2021 at 4:31 PM Song Liu wrote: >> >> >> >>> On Apr 2, 2021, at 1:57 PM, Cong Wang wrote: >>> >>> Ideally I even prefer to create timers in kernel-space too, but a

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Song Liu
> On Apr 2, 2021, at 1:57 PM, Cong Wang wrote: > > On Fri, Apr 2, 2021 at 12:45 PM Song Liu wrote: >> >> >> >>> On Apr 2, 2021, at 12:08 PM, Cong Wang wrote: >>> >>> On Fri, Apr 2, 2021 at 10:57 AM Song Liu wrote: >>>>

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Song Liu
> On Apr 2, 2021, at 12:08 PM, Cong Wang wrote: > > On Fri, Apr 2, 2021 at 10:57 AM Song Liu wrote: >> >> >> >>> On Apr 2, 2021, at 10:34 AM, Cong Wang wrote: >>> >>> On Thu, Apr 1, 2021 at 1:17 PM Song Liu wrote: >>>>

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Song Liu
> On Apr 2, 2021, at 10:34 AM, Cong Wang wrote: > > On Thu, Apr 1, 2021 at 1:17 PM Song Liu wrote: >> >> >> >>> On Apr 1, 2021, at 10:28 AM, Cong Wang wrote: >>> >>> On Wed, Mar 31, 2021 at 11:38 PM Song Liu wrote: >>>>

Re: [PATCH -next] libbpf: remove redundant semi-colon

2021-04-01 Thread Song Liu
On Thu, Apr 1, 2021 at 10:58 AM Yang Yingliang wrote: > > Signed-off-by: Yang Yingliang Please add a short commit log. Thanks, Song > --- > tools/lib/bpf/linker.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c > index 4

Re: [PATCH] linux/bpf.h: Remove repeated struct declaration

2021-04-01 Thread Song Liu
On Thu, Apr 1, 2021 at 12:22 AM Wan Jiabing wrote: > > struct btf_type is declared twice. One is declared at 35th line. > The blew one is not needed. Remove the duplicate. > > Signed-off-by: Wan Jiabing Acked-by: Song Liu

Re: [PATCH bpf-next] cpumap: bulk skb using netif_receive_skb_list

2021-04-01 Thread Song Liu
On Thu, Apr 1, 2021 at 9:49 AM Lorenzo Bianconi wrote: > > > On Thu, Apr 1, 2021 at 1:57 AM Lorenzo Bianconi wrote: > > > > > [...] > > > > - /* Inject into network stack */ > > > - ret = netif_receive_skb_core(skb); > > > - if (re

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-01 Thread Song Liu
> On Apr 1, 2021, at 10:28 AM, Cong Wang wrote: > > On Wed, Mar 31, 2021 at 11:38 PM Song Liu wrote: >> >> >> >>> On Mar 31, 2021, at 9:26 PM, Cong Wang wrote: >>> >>> From: Cong Wang >>> >>> (This patch is still

Re: [PATCH bpf-next] cpumap: bulk skb using netif_receive_skb_list

2021-04-01 Thread Song Liu
On Thu, Apr 1, 2021 at 1:57 AM Lorenzo Bianconi wrote: > > Rely on netif_receive_skb_list routine to send skbs converted from > xdp_frames in cpu_map_kthread_run in order to improve i-cache usage. > The proposed patch has been tested running xdp_redirect_cpu bpf sample > available in the kernel tr

Re: [PATCH] linux/bpf-cgroup.h: Delete repeated struct declaration

2021-03-31 Thread Song Liu
> On Mar 31, 2021, at 11:46 PM, Wan Jiabing wrote: > > struct bpf_prog is declared twice. There is one declaration > which is independent on the MACRO at 18th line. > So the below one is not needed though. Remove the duplicate. > > Signed-off-by: Wan Jiabing

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-03-31 Thread Song Liu
> On Mar 31, 2021, at 9:26 PM, Cong Wang wrote: > > From: Cong Wang > > (This patch is still in early stage and obviously incomplete. I am sending > it out to get some high-level feedbacks. Please kindly ignore any coding > details for now and focus on the design.) Could you please explain

Re: [Patch bpf-next] bpf: remove unused parameter from ___bpf_prog_run

2021-03-31 Thread Song Liu
On Wed, Mar 31, 2021 at 12:14 AM He Fengqing wrote: > > 'stack' parameter is not used in ___bpf_prog_run, > the base address have been set to FP reg. So consequently remove it. > > Signed-off-by: He Fengqing Acked-by: Song Liu

Re: [PATCH bpf-next v2] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-30 Thread Song Liu
> On Mar 30, 2021, at 3:37 PM, Pedro Tammela wrote: > > The current code only checks flags in 'bpf_ringbuf_output()'. > > Signed-off-by: Pedro Tammela Acked-by: Song Liu

Re: [PATCH bpf-next] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-30 Thread Song Liu
> On Mar 30, 2021, at 7:22 AM, Pedro Tammela wrote: > > Em seg., 29 de mar. de 2021 às 13:10, Song Liu > escreveu: >> >> >> >>> On Mar 28, 2021, at 9:10 AM, Pedro Tammela wrote: >>> >>> The current code only checks flags in 

Re: [Patch bpf-next] net: filter: Remove unused bpf_load_pointer

2021-03-30 Thread Song Liu
On Mon, Mar 29, 2021 at 7:11 PM He Fengqing wrote: > > Remove unused bpf_load_pointer function in filter.h > > Signed-off-by: He Fengqing Acked-by: Song Liu [...]

Re: [PATCH bpf-next 2/2] bpf: selftests: Update clang requirement in README.rst for testing kfunc call

2021-03-29 Thread Song Liu
> On Mar 29, 2021, at 10:41 PM, Martin KaFai Lau wrote: > > This patch updates the README.rst to specify the clang requirement > to compile the bpf selftests that call kernel function. > > Signed-off-by: Martin KaFai Lau Acked-by: Song Liu

Re: [PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI

2021-03-29 Thread Song Liu
> On Mar 29, 2021, at 10:41 PM, Martin KaFai Lau wrote: > > This patch updates bpf_design_QA.rst to clarify that the kernel > function callable by bpf program is not an ABI. > > Signed-off-by: Martin KaFai Lau Acked-by: Song Liu

Re: [RFC PATCH bpf-next 4/4] selftests/bpf: Test that module can't be unloaded with attached trampoline

2021-03-29 Thread Song Liu
> On Mar 28, 2021, at 4:26 AM, Jiri Olsa wrote: > > Adding test to verify that once we attach module's trampoline, > the module can't be unloaded. > > Signed-off-by: Jiri Olsa Acked-by: Song Liu [...]

Re: [RFC PATCH bpf-next 2/4] selftests/bpf: Add re-attach test to fentry_test

2021-03-29 Thread Song Liu
> On Mar 28, 2021, at 4:26 AM, Jiri Olsa wrote: > > Adding the test to re-attach (detach/attach again) tracing > fentry programs, plus check that already linked program can't > be attached again. > > Fixing the number of check-ed results, which should be 8. > > Signed-off-by: Jiri Olsa > [

Re: [RFC PATCH bpf-next 1/4] bpf: Allow trampoline re-attach

2021-03-29 Thread Song Liu
ernel program. > > Signed-off-by: Jiri Olsa LGTM. Acked-by: Song Liu [...]

Re: [PATCH v3 bpf-next] tools/resolve_btfids: Fix warnings

2021-03-29 Thread Song Liu
On Mon, Mar 29, 2021 at 3:35 PM Stanislav Fomichev wrote: > > * make eprintf static, used only in main.c > * initialize ret in eprintf > * remove unused *tmp > > v3: > * remove another err (Song Liu) > > v2: > * remove unused 'int err = -1' > > Cc:

Re: [PATCH] selftests/bpf: add LDFLAGS when building test_verifier

2021-03-29 Thread Song Liu
On Mon, Mar 29, 2021 at 11:13 AM Jisheng Zhang wrote: > > From: Jisheng Zhang > > This is useful for cross compile process to point linker to the > correct libelf, libcap, libz path. LGTM: Acked-by: Song Liu btw: Do we also need LDFLAGS for some other binaries, like test_cpp,

Re: [PATCH v2 bpf-next] tools/resolve_btfids: Fix warnings

2021-03-29 Thread Song Liu
On Mon, Mar 29, 2021 at 9:46 AM Stanislav Fomichev wrote: > > * make eprintf static, used only in main.c > * initialize ret in eprintf > * remove unused *tmp > * remove unused 'int err = -1' > > Signed-off-by: Stanislav Fomichev > --- > tools/bpf/resolve_btfids/main.c | 7 +++ > 1 file chang

Re: [PATCH bpf-next] libbpf: Add '_wait()' and '_nowait()' macros for 'bpf_ring_buffer__poll()'

2021-03-29 Thread Song Liu
> On Mar 28, 2021, at 9:10 AM, Pedro Tammela wrote: > > 'bpf_ring_buffer__poll()' abstracts the polling method, so abstract the > constants that make the implementation don't wait or wait indefinetly > for data. > > Signed-off-by: Pedro Tammela > --- > tools/lib/bpf/libbpf.h

Re: [PATCH bpf-next] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-29 Thread Song Liu
> On Mar 28, 2021, at 9:10 AM, Pedro Tammela wrote: > > The current code only checks flags in 'bpf_ringbuf_output()'. > > Signed-off-by: Pedro Tammela > --- > include/uapi/linux/bpf.h | 8 > kernel/bpf/ringbuf.c | 13 +++-- > tools/include/uapi/linux/bpf.h |

Re: [PATCH bpf-next] bpf: add 'BPF_RB_MAY_WAKEUP' flag

2021-03-29 Thread Song Liu
e might notify the consumer if it already caught up in processing, > so let's provide a more descriptive notation for this value. > > Signed-off-by: Pedro Tammela Acked-by: Song Liu

Re: [PATCH bpf-next] libbpf: fix memory leak when emitting final btf_ext

2021-03-29 Thread Song Liu
support") > Signed-off-by: Andrii Nakryiko Acked-by: Song Liu > --- > tools/lib/bpf/linker.c | 24 > 1 file changed, 16 insertions(+), 8 deletions(-) > > diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c > index a29d62ff8041..46b16cb

Re: [PATCH] bpf: remove redundant assignment of variable id

2021-03-26 Thread Song Liu
On Fri, Mar 26, 2021 at 12:45 PM Colin King wrote: > > From: Colin Ian King > > The variable id is being assigned a value that is never > read, the assignment is redundant and can be removed. > > Addresses-Coverity: ("Unused value") > Signed-off-by: Colin I

Re: [PATCH bpf v2 2/2] bpf: program: refuse non-O_RDWR flags in BPF_OBJ_GET

2021-03-26 Thread Song Liu
On Fri, Mar 26, 2021 at 9:07 AM Lorenz Bauer wrote: > > As for bpf_link, refuse creating a non-O_RDWR fd. Since program fds > currently don't allow modifications this is a precaution, not a > straight up bug fix. > > Signed-off-by: Lorenz Bauer > --- > kernel/bpf/inode.c | 2 +- > 1 file changed

Re: [PATCH bpf-next] bpf: Make symbol 'bpf_task_storage_busy' static

2021-03-11 Thread Song Liu
atic? > > This symbol is not used outside of bpf_task_storage.c, so this > commit marks it static. > > Fixes: bc235cdb423a ("bpf: Prevent deadlock from recursive > bpf_task_storage_[get|delete]") > Reported-by: Hulk Robot > Signed-off-by: Wei Yongjun Acked-b

[PATCH v6 bpf-next 5/6] bpf: runqslower: prefer using local vmlimux to generate vmlinux.h

2021-02-25 Thread Song Liu
Update the Makefile to prefer using $(O)/vmlinux, $(KBUILD_OUTPUT)/vmlinux (for selftests) or ../../../vmlinux. These two files should have latest definitions for vmlinux.h. Acked-by: Andrii Nakryiko Signed-off-by: Song Liu --- tools/bpf/runqslower/Makefile | 5 - 1 file changed, 4

[PATCH v6 bpf-next 6/6] bpf: runqslower: use task local storage

2021-02-25 Thread Song Liu
, as those in handle__sched_wakeup, are much faster with task local storage. If we disable hashtab prealloc, task local storage is much faster for all 3 functions. Acked-by: Andrii Nakryiko Signed-off-by: Song Liu --- tools/bpf/runqslower/runqslower.bpf.c | 33 +-- 1 file

[PATCH v6 bpf-next 4/6] selftests/bpf: test deadlock from recursive bpf_task_storage_[get|delete]

2021-02-25 Thread Song Liu
Add a test with recursive bpf_task_storage_[get|delete] from fentry programs on bpf_local_storage_lookup and bpf_local_storage_update. Without proper deadlock prevent mechanism, this test would cause deadlock. Signed-off-by: Song Liu --- .../bpf/prog_tests/task_local_storage.c | 23

[PATCH v6 bpf-next 3/6] selftests/bpf: add non-BPF_LSM test for task local storage

2021-02-25 Thread Song Liu
should not). Signed-off-by: Song Liu --- .../bpf/prog_tests/task_local_storage.c | 69 +++ .../selftests/bpf/progs/task_local_storage.c | 64 + .../bpf/progs/task_local_storage_exit_creds.c | 32 + 3 files changed, 165 insertions(+) create mode 100644

[PATCH v6 bpf-next 2/6] bpf: prevent deadlock from recursive bpf_task_storage_[get|delete]

2021-02-25 Thread Song Liu
le, if bpf_local_storage_map owns the counters, it cannot prevent deadlock on bpf_local_storage->lock when two maps are used. Signed-off-by: Song Liu --- include/linux/bpf_local_storage.h | 3 +- kernel/bpf/bpf_inode_storage.c| 2 +- kernel/bpf/bpf_local_storage.c| 11 +- kernel/bpf/bpf_task_

[PATCH v6 bpf-next 1/6] bpf: enable task local storage for tracing programs

2021-02-25 Thread Song Liu
allocate new storage when the task is not refcounted (task->usage == 0). Acked-by: KP Singh Acked-by: Martin KaFai Lau Signed-off-by: Song Liu --- include/linux/bpf.h| 7 ++ include/linux/bpf_lsm.h| 22 - include/linux/bpf_types.h | 2 +- incl

[PATCH v6 bpf-next 0/6] bpf: enable task local storage for tracing programs

2021-02-25 Thread Song Liu
or a task being freed. 3. Minor changes in runqslower. Song Liu (6): bpf: enable task local storage for tracing programs bpf: prevent deadlock from recursive bpf_task_storage_[get|delete] selftests/bpf: add non-BPF_LSM test for task local storage selftests/bpf: test deadlock

[PATCH v5 bpf-next 6/6] bpf: runqslower: use task local storage

2021-02-23 Thread Song Liu
, as those in handle__sched_wakeup, are much faster with task local storage. If we disable hashtab prealloc, task local storage is much faster for all 3 functions. Acked-by: Andrii Nakryiko Signed-off-by: Song Liu --- tools/bpf/runqslower/runqslower.bpf.c | 33 +-- 1 file

[PATCH v5 bpf-next 3/6] selftests/bpf: add non-BPF_LSM test for task local storage

2021-02-23 Thread Song Liu
should not). Signed-off-by: Song Liu --- .../bpf/prog_tests/task_local_storage.c | 69 +++ .../selftests/bpf/progs/task_local_storage.c | 64 + .../bpf/progs/task_local_storage_exit_creds.c | 32 + 3 files changed, 165 insertions(+) create mode 100644

[PATCH v5 bpf-next 5/6] bpf: runqslower: prefer using local vmlimux to generate vmlinux.h

2021-02-23 Thread Song Liu
Update the Makefile to prefer using $(O)/vmlinux, $(KBUILD_OUTPUT)/vmlinux (for selftests) or ../../../vmlinux. These two files should have latest definitions for vmlinux.h. Acked-by: Andrii Nakryiko Signed-off-by: Song Liu --- tools/bpf/runqslower/Makefile | 5 - 1 file changed, 4

[PATCH v5 bpf-next 4/6] selftests/bpf: test deadlock from recursive bpf_task_storage_[get|delete]

2021-02-23 Thread Song Liu
Add a test with recursive bpf_task_storage_[get|delete] from fentry programs on bpf_local_storage_lookup and bpf_local_storage_update. Without proper deadlock prevent mechanism, this test would cause deadlock. Signed-off-by: Song Liu --- .../bpf/prog_tests/task_local_storage.c | 23

[PATCH v5 bpf-next 0/6] bpf: enable task local storage for tracing programs

2021-02-23 Thread Song Liu
nges with runqslower. (Andrii) 3. Shortern CC list to make it easy for vger. Changes v1 => v2: 1. Do not allocate task local storage when the task is being freed. 2. Revise the selftest and added a new test for a task being freed. 3. Minor changes in runqslower. Song Liu (6): bpf: enable task local

[PATCH v5 bpf-next 1/6] bpf: enable task local storage for tracing programs

2021-02-23 Thread Song Liu
allocate new storage when the task is not refcounted (task->usage == 0). Reported-by: kernel test robot Acked-by: KP Singh Signed-off-by: Song Liu --- include/linux/bpf.h| 7 ++ include/linux/bpf_lsm.h| 22 - include/linux/bpf_types.h |

[PATCH v5 bpf-next 2/6] bpf: prevent deadlock from recursive bpf_task_storage_[get|delete]

2021-02-23 Thread Song Liu
le, if bpf_local_storage_map owns the counters, it cannot prevent deadlock on bpf_local_storage->lock when two maps are used. Signed-off-by: Song Liu --- kernel/bpf/bpf_task_storage.c | 57 ++- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/kernel/bpf/bpf_task_

Re: [PATCH v4 bpf-next 1/6] bpf: enable task local storage for tracing programs

2021-02-23 Thread Song Liu
> On Feb 23, 2021, at 11:23 AM, Martin Lau wrote: > > On Mon, Feb 22, 2021 at 05:20:09PM -0800, Song Liu wrote: > [ ... ] > >> diff --git a/kernel/bpf/bpf_task_storage.c b/kernel/bpf/bpf_task_storage.c >> index e0da0258b732d..2034019966d44 100644 >> --

Re: [PATCH v4 bpf-next 2/6] bpf: prevent deadlock from recursive bpf_task_storage_[get|delete]

2021-02-23 Thread Song Liu
> On Feb 23, 2021, at 3:06 AM, Peter Zijlstra wrote: > > On Mon, Feb 22, 2021 at 05:20:10PM -0800, Song Liu wrote: >> BPF helpers bpf_task_storage_[get|delete] could hold two locks: >> bpf_local_storage_map_bucket->lock and bpf_local_storage->lock. Calling >>

Re: [PATCH v4 bpf-next 2/6] bpf: prevent deadlock from recursive bpf_task_storage_[get|delete]

2021-02-22 Thread Song Liu
> On Feb 22, 2021, at 10:21 PM, Andrii Nakryiko > wrote: > > On Mon, Feb 22, 2021 at 5:23 PM Song Liu wrote: >> >> BPF helpers bpf_task_storage_[get|delete] could hold two locks: >> bpf_local_storage_map_bucket->lock and bpf_local_storage->lock. Callin

[PATCH v4 bpf-next 3/6] selftests/bpf: add non-BPF_LSM test for task local storage

2021-02-22 Thread Song Liu
should not). Signed-off-by: Song Liu --- .../bpf/prog_tests/task_local_storage.c | 69 +++ .../selftests/bpf/progs/task_local_storage.c | 64 + .../bpf/progs/task_local_storage_exit_creds.c | 32 + 3 files changed, 165 insertions(+) create mode 100644

[PATCH v4 bpf-next 4/6] selftests/bpf: test deadlock from recursive bpf_task_storage_[get|delete]

2021-02-22 Thread Song Liu
Add a test with recursive bpf_task_storage_[get|delete] from fentry programs on bpf_local_storage_lookup and bpf_local_storage_update. Without proper deadlock prevent mechanism, this test would cause deadlock. Signed-off-by: Song Liu --- .../bpf/prog_tests/task_local_storage.c | 23

[PATCH v4 bpf-next 6/6] bpf: runqslower: use task local storage

2021-02-22 Thread Song Liu
, as those in handle__sched_wakeup, are much faster with task local storage. If we disable hashtab prealloc, task local storage is much faster for all 3 functions. Acked-by: Andrii Nakryiko Signed-off-by: Song Liu --- tools/bpf/runqslower/runqslower.bpf.c | 33 +-- 1 file

[PATCH v4 bpf-next 5/6] bpf: runqslower: prefer using local vmlimux to generate vmlinux.h

2021-02-22 Thread Song Liu
Update the Makefile to prefer using $(O)/mvlinux, $(KBUILD_OUTPUT)/vmlinux (for selftests) or ../../../vmlinux. These two files should have latest definitions for vmlinux.h. Signed-off-by: Song Liu --- tools/bpf/runqslower/Makefile | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff

[PATCH v4 bpf-next 2/6] bpf: prevent deadlock from recursive bpf_task_storage_[get|delete]

2021-02-22 Thread Song Liu
other lock. For example, if bpf_local_storage_map owns the counters, it cannot prevent deadlock on bpf_local_storage->lock when two maps are used. Signed-off-by: Song Liu --- kernel/bpf/bpf_task_storage.c | 57 ++- 1 file changed, 50 insertions(+), 7 deletions

[PATCH v4 bpf-next 1/6] bpf: enable task local storage for tracing programs

2021-02-22 Thread Song Liu
allocate new storage when the task is not refcounted (task->usage == 0). Acked-by: KP Singh Signed-off-by: Song Liu --- include/linux/bpf.h| 7 +++ include/linux/bpf_lsm.h| 22 -- include/linux/bpf_types.h | 2 +- include/linux/sche

[PATCH v4 bpf-next 0/6] bpf: enable task local storage for tracing programs

2021-02-22 Thread Song Liu
evise the selftest and added a new test for a task being freed. 3. Minor changes in runqslower. Song Liu (6): bpf: enable task local storage for tracing programs bpf: prevent deadlock from recursive bpf_task_storage_[get|delete] selftests/bpf: add non-BPF_LSM test for task local storage self

[PATCH v7 bpf-next 1/3] bpf: introduce task_vma bpf_iter

2021-02-12 Thread Song Liu
p(). Acked-by: Yonghong Song Signed-off-by: Song Liu --- kernel/bpf/task_iter.c | 267 - 1 file changed, 266 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c index 175b7b42bfc46..b68cb5d6d6ebc 100644 --- a

[PATCH v7 bpf-next 3/3] selftests/bpf: add test for bpf_iter_task_vma

2021-02-12 Thread Song Liu
The test dumps information similar to /proc/pid/maps. The first line of the output is compared against the /proc file to make sure they match. Acked-by: Yonghong Song Signed-off-by: Song Liu --- .../selftests/bpf/prog_tests/bpf_iter.c | 118 -- tools/testing/selftests/bpf

[PATCH v7 bpf-next 0/3] introduce bpf_iter for task_vma

2021-02-12 Thread Song Liu
mmap_lock while calling BPF program. This enables the BPF program to access the real vma with BTF. (Alexei) 2. Fix the logic when the control is returned to user space. (Yonghong) 3. Revise commit log and cover letter. (Yonghong) Changes v1 => v2: 1. Small fixes in task_iter.c and

[PATCH v7 bpf-next 2/3] bpf: allow bpf_d_path in bpf_iter program

2021-02-12 Thread Song Liu
task_file and task_vma iter programs have access to file->f_path. Enable bpf_d_path to print paths of these file. Acked-by: Yonghong Song Signed-off-by: Song Liu --- kernel/trace/bpf_trace.c | 4 1 file changed, 4 insertions(+) diff --git a/kernel/trace/bpf_trace.c b/kernel/tr

[PATCH v6 bpf-next 4/4] selftests/bpf: add test for bpf_iter_task_vma

2021-02-11 Thread Song Liu
The test dumps information similar to /proc/pid/maps. The first line of the output is compared against the /proc file to make sure they match. Acked-by: Yonghong Song Signed-off-by: Song Liu --- .../selftests/bpf/prog_tests/bpf_iter.c | 118 -- tools/testing/selftests/bpf

[PATCH v6 bpf-next 3/4] libbpf: introduce section "iter.s/" for sleepable bpf_iter program

2021-02-11 Thread Song Liu
Sleepable iterator program have access to helper functions like bpf_d_path. Acked-by: Yonghong Song Acked-by: KP Singh Signed-off-by: Song Liu --- tools/lib/bpf/libbpf.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index

[PATCH v6 bpf-next 0/4] introduce bpf_iter for task_vma

2021-02-11 Thread Song Liu
exei) 2. Fix the logic when the control is returned to user space. (Yonghong) 3. Revise commit log and cover letter. (Yonghong) Changes v1 => v2: 1. Small fixes in task_iter.c and the selftests. (Yonghong) Song Liu (4): bpf: introduce task_vma bpf_iter bpf: allow bpf_d_path in

[PATCH v6 bpf-next 2/4] bpf: allow bpf_d_path in sleepable bpf_iter program

2021-02-11 Thread Song Liu
ave access to bpf_d_path; non-sleepable programs have access to bpf_spin_lock. Acked-by: Yonghong Song Signed-off-by: Song Liu --- kernel/trace/bpf_trace.c | 5 + 1 file changed, 5 insertions(+) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 6c0018abe68a0..1f3becd443

Re: [PATCH v5 bpf-next 1/4] bpf: introduce task_vma bpf_iter

2021-02-11 Thread Song Liu
> On Feb 10, 2021, at 3:02 PM, Yonghong Song wrote: > > > > On 2/9/21 7:00 PM, Alexei Starovoitov wrote: >> On 2/9/21 2:08 PM, Song Liu wrote: >>> >>> >>>> On Feb 9, 2021, at 1:30 PM, Alexei Starovoitov >>>> wrote: >

[PATCH v6 bpf-next 1/4] bpf: introduce task_vma bpf_iter

2021-02-11 Thread Song Liu
p(). Acked-by: Yonghong Song Signed-off-by: Song Liu --- kernel/bpf/task_iter.c | 267 - 1 file changed, 266 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c index 175b7b42bfc46..b68cb5d6d6ebc 100644 --- a

Re: [PATCH v5 bpf-next 1/4] bpf: introduce task_vma bpf_iter

2021-02-10 Thread Song Liu
> On Feb 9, 2021, at 7:00 PM, Alexei Starovoitov wrote: > > On 2/9/21 2:08 PM, Song Liu wrote: >>> On Feb 9, 2021, at 1:30 PM, Alexei Starovoitov >>> wrote: >>> >>> On Mon, Feb 08, 2021 at 02:52:52PM -0800, Song Liu wrote: >>>> Int

Re: [PATCH v5 bpf-next 1/4] bpf: introduce task_vma bpf_iter

2021-02-09 Thread Song Liu
> On Feb 9, 2021, at 1:30 PM, Alexei Starovoitov > wrote: > > On Mon, Feb 08, 2021 at 02:52:52PM -0800, Song Liu wrote: >> Introduce task_vma bpf_iter to print memory information of a process. It >> can be used to print customized information similar to /proc//ma

[PATCH v5 bpf-next 4/4] selftests/bpf: add test for bpf_iter_task_vma

2021-02-08 Thread Song Liu
The test dumps information similar to /proc/pid/maps. The first line of the output is compared against the /proc file to make sure they match. Signed-off-by: Song Liu --- .../selftests/bpf/prog_tests/bpf_iter.c | 118 -- tools/testing/selftests/bpf/progs/bpf_iter.h | 8

[PATCH v5 bpf-next 1/4] bpf: introduce task_vma bpf_iter

2021-02-08 Thread Song Liu
(). Signed-off-by: Song Liu --- kernel/bpf/task_iter.c | 217 - 1 file changed, 216 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c index 175b7b42bfc46..a0d469f0f481c 100644 --- a/kernel/bpf/task_iter.c +++ b

[PATCH v5 bpf-next 3/4] libbpf: introduce section "iter.s/" for sleepable bpf_iter program

2021-02-08 Thread Song Liu
Sleepable iterator program have access to helper functions like bpf_d_path. Acked-by: Yonghong Song Acked-by: KP Singh Signed-off-by: Song Liu --- tools/lib/bpf/libbpf.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index

[PATCH v5 bpf-next 2/4] bpf: allow bpf_d_path in sleepable bpf_iter program

2021-02-08 Thread Song Liu
ave access to bpf_d_path; non-sleepable programs have access to bpf_spin_lock. Acked-by: Yonghong Song Signed-off-by: Song Liu --- kernel/trace/bpf_trace.c | 5 + 1 file changed, 5 insertions(+) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 6c0018abe68a0..1f3becd443

[PATCH v5 bpf-next 0/4] introduce bpf_iter for task_vma

2021-02-08 Thread Song Liu
og and cover letter. (Yonghong) Changes v1 => v2: 1. Small fixes in task_iter.c and the selftests. (Yonghong) Song Liu (4): bpf: introduce task_vma bpf_iter bpf: allow bpf_d_path in sleepable bpf_iter program libbpf: introduce section "iter.s/" for sleepable bpf_iter program se

Re: [PATCH bpf-next 2/4] tools/resolve_btfids: Check objects before removing

2021-02-04 Thread Song Liu
emove. > > Signed-off-by: Jiri Olsa Acked-by: Song Liu > --- > tools/bpf/resolve_btfids/Makefile | 17 - > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/tools/bpf/resolve_btfids/Makefile > b/tools/bpf/resolve_btfids/Makefile >

Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target

2021-02-04 Thread Song Liu
> On Feb 4, 2021, at 1:18 PM, Jiri Olsa wrote: > > The resolve_btfids tool is used during the kernel build, > so we should clean it on kernel's make clean. > > Invoking the the resolve_btfids clean as part of root > 'make clean'. > > Sig

Re: [PATCH bpf-next 3/4] tools/resolve_btfids: Set srctree variable unconditionally

2021-02-04 Thread Song Liu
solve this by setting current srctree value > directly. > > Also root Makefile does not define the implicit RM variable, > so adding RM initialization. > > Signed-off-by: Jiri Olsa Acked-by: Song Liu > --- > tools/bpf/resolve_btfids/Makefile | 3 +-- > 1 file changed

Re: [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories

2021-02-04 Thread Song Liu
. > > Also there's no need for FEATURE-DUMP.libbpf and bpf_helper_defs.h > files in .gitignore anymore. > > Signed-off-by: Jiri Olsa Acked-by: Song Liu [...]

[PATCH v4 bpf-next 3/4] libbpf: introduce section "iter.s/" for sleepable bpf_iter program

2021-02-04 Thread Song Liu
Sleepable iterator program have access to helper functions like bpf_d_path. Acked-by: Yonghong Song Acked-by: KP Singh Signed-off-by: Song Liu --- tools/lib/bpf/libbpf.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index

[PATCH v4 bpf-next 4/4] selftests/bpf: add test for bpf_iter_task_vma

2021-02-04 Thread Song Liu
The test dumps information similar to /proc/pid/maps. The first line of the output is compared against the /proc file to make sure they match. Signed-off-by: Song Liu --- .../selftests/bpf/prog_tests/bpf_iter.c | 114 -- tools/testing/selftests/bpf/progs/bpf_iter.h | 8

[PATCH v4 bpf-next 2/4] bpf: allow bpf_d_path in sleepable bpf_iter program

2021-02-04 Thread Song Liu
ave access to bpf_d_path; non-sleepable programs have access to bpf_spin_lock. Acked-by: Yonghong Song Signed-off-by: Song Liu --- kernel/trace/bpf_trace.c | 5 + 1 file changed, 5 insertions(+) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 6c0018abe68a0..1f3becd443

[PATCH v4 bpf-next 1/4] bpf: introduce task_vma bpf_iter

2021-02-04 Thread Song Liu
(). Signed-off-by: Song Liu --- kernel/bpf/task_iter.c | 215 - 1 file changed, 214 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c index 175b7b42bfc46..31e63b6c3d718 100644 --- a/kernel/bpf/task_iter.c +++ b

[PATCH v4 bpf-next 0/4] introduce bpf_iter for task_vma

2021-02-04 Thread Song Liu
e calling BPF program. This enables the BPF program to access the real vma with BTF. (Alexei) 2. Fix the logic when the control is returned to user space. (Yonghong) 3. Revise commit log and cover letter. (Yonghong) Changes v1 => v2: 1. Small fixes in task_iter.c and the selftests. (

Re: [PATCH bpf-next] samples/bpf: Add hello world sample for newbies

2021-02-04 Thread Song Liu
On Thu, Feb 4, 2021 at 3:42 AM Tiezhu Yang wrote: > > The program is made in a way that everytime an execve syscall > is executed it prints Hello, BPF World! > > This is inspired and based on the code example for the book > Linux Observability with BPF [1], load_bpf_file() has been > removed after

Re: [PATCH bpf-next v4 1/6] xsk: add tracepoints for packet drops

2021-02-03 Thread Song Liu
On Wed, Feb 3, 2021 at 12:13 AM Ciara Loftus wrote: > > This commit introduces tracing infrastructure for AF_XDP sockets > (xsks) and a new trace event called 'xsk_packet_drop'. This trace > event is triggered when a packet cannot be processed by the socket > due to one of the following issues: >

Re: [PATCH bpf-next] bpf: Emit explicit NULL pointer checks for PROBE_LDX instructions.

2021-02-03 Thread Song Liu
> On Feb 2, 2021, at 6:19 PM, Alexei Starovoitov > wrote: > > On Wed, Feb 03, 2021 at 12:56:39AM +0000, Song Liu wrote: >> >> >>> On Feb 1, 2021, at 9:38 PM, Alexei Starovoitov >>> wrote: >>> >>> From: Alexei Starovoitov >&

Re: [PATCH bpf-next] bpf: Emit explicit NULL pointer checks for PROBE_LDX instructions.

2021-02-02 Thread Song Liu
> On Feb 1, 2021, at 9:38 PM, Alexei Starovoitov > wrote: > > From: Alexei Starovoitov > > PTR_TO_BTF_ID registers contain either kernel pointer or NULL. > Emit the NULL check explicitly by JIT instead of going into > do_user_addr_fault() on NULL deference. > > Signed-off-by: Alexei Starov

Re: [PATCH bpf-next] MAINTAINERS: BPF: Update web-page bpf.io to ebpf.io to avoid redirects

2021-01-28 Thread Song Liu
7; > https://ebpf.io/ > > $ curl -s -S -L https://ebpf.io/ -o /dev/null -w '%{time_redirect}\n' > 0.000 > > So update https://bpf.io/ to https://ebpf.io/ to avoid redirects. > > Signed-off-by: Tiezhu Yang Acked-by: Song Liu > --- > MAINTAINERS | 2 +

[PATCH v3 bpf-next 1/4] bpf: enable task local storage for tracing programs

2021-01-27 Thread Song Liu
not allocate new storage when the task is not refcounted (task->usage == 0). Signed-off-by: Song Liu --- include/linux/bpf.h| 7 +++ include/linux/bpf_lsm.h| 22 -- include/linux/bpf_types.h | 2 +- include/linux/sched.h | 5 + ker

[PATCH v3 bpf-next 4/4] bpf: runqslower: use task local storage

2021-01-27 Thread Song Liu
, as those in handle__sched_wakeup, are much faster with task local storage. If we disable hashtab prealloc, task local storage is much faster for all 3 functions. Acked-by: Andrii Nakryiko Signed-off-by: Song Liu --- tools/bpf/runqslower/runqslower.bpf.c | 33 +-- 1 file

[PATCH v3 bpf-next 2/4] selftests/bpf: add non-BPF_LSM test for task local storage

2021-01-27 Thread Song Liu
should not). Signed-off-by: Song Liu --- .../bpf/prog_tests/task_local_storage.c | 69 +++ .../selftests/bpf/progs/task_local_storage.c | 64 + .../bpf/progs/task_local_storage_exit_creds.c | 32 + 3 files changed, 165 insertions(+) create mode 100644

[PATCH v3 bpf-next 0/4] bpf: enable task local storage for tracing programs

2021-01-27 Thread Song Liu
CC list to make it easy for vger. Changes v1 => v2: 1. Do not allocate task local storage when the task is being freed. 2. Revise the selftest and added a new test for a task being freed. 3. Minor changes in runqslower. Song Liu (4): bpf: enable task local storage for tracing programs sel

[PATCH v3 bpf-next 3/4] bpf: runqslower: prefer using local vmlimux to generate vmlinux.h

2021-01-27 Thread Song Liu
Update the Makefile to prefer using $(O)/mvlinux, $(KBUILD_OUTPUT)/vmlinux (for selftests) or ../../../vmlinux. These two files should have latest definitions for vmlinux.h. Signed-off-by: Song Liu --- tools/bpf/runqslower/Makefile | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff

Re: [PATCH v2 bpf-next 2/4] selftests/bpf: add non-BPF_LSM test for task local storage

2021-01-27 Thread Song Liu
> On Jan 27, 2021, at 1:21 PM, Andrii Nakryiko > wrote: > > On Tue, Jan 26, 2021 at 1:21 AM Song Liu wrote: >> >> Task local storage is enabled for tracing programs. Add two tests for >> task local storage without CONFIG_BPF_LSM. >> >> The first

Re: [PATCH bpf-next 1/4] bpf: enable task local storage for tracing programs

2021-01-15 Thread Song Liu
> On Jan 15, 2021, at 4:55 PM, Yonghong Song wrote: > > > > On 1/15/21 3:34 PM, Song Liu wrote: >>> On Jan 12, 2021, at 8:53 AM, KP Singh wrote: >>> >>> On Tue, Jan 12, 2021 at 5:32 PM Yonghong Song wrote: >>>> >>>> >

Re: [PATCH bpf-next 1/4] bpf: enable task local storage for tracing programs

2021-01-15 Thread Song Liu
> On Jan 12, 2021, at 8:53 AM, KP Singh wrote: > > On Tue, Jan 12, 2021 at 5:32 PM Yonghong Song wrote: >> >> >> >> On 1/11/21 3:45 PM, Song Liu wrote: >>> >>> >>>> On Jan 11, 2021, at 1:58 PM, Martin Lau wrote: >

Re: [PATCH bpf-next] bpf: reject too big ctx_size_in for raw_tp test run

2021-01-13 Thread Song Liu
> On Jan 12, 2021, at 9:17 PM, Yonghong Song wrote: > > > > On 1/12/21 3:42 PM, Song Liu wrote: >> syzbot reported a WARNING for allocating too big memory: >> WARNING: CPU: 1 PID: 8484 at mm/page_alloc.c:4976 >> __alloc_pages_nodemask+0x5f8/0x730 mm/page_

[PATCH bpf-next] bpf: reject too big ctx_size_in for raw_tp test run

2021-01-12 Thread Song Liu
4f98876664c7337a4...@syzkaller.appspotmail.com Fixes: 1b4d60ec162f ("bpf: Enable BPF_PROG_TEST_RUN for raw_tracepoint") Cc: sta...@vger.kernel.org # v5.10+ Signed-off-by: Song Liu --- net/bpf/test_run.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/bpf/test_run.c b/net/bpf/tes

Re: [PATCH bpf-next 2/4] selftests/bpf: add non-BPF_LSM test for task local storage

2021-01-11 Thread Song Liu
> On Jan 11, 2021, at 9:30 AM, Yonghong Song wrote: > > > > On 1/8/21 3:19 PM, Song Liu wrote: >> Task local storage is enabled for tracing programs. Add a test for it >> without CONFIG_BPF_LSM. >> Signed-off-by: Song Liu >> --- >> .../b

Re: [PATCH bpf-next 2/4] selftests/bpf: add non-BPF_LSM test for task local storage

2021-01-11 Thread Song Liu
> On Jan 11, 2021, at 9:44 AM, KP Singh wrote: > > On Mon, Jan 11, 2021 at 6:31 PM Yonghong Song wrote: >> >> >> >> On 1/8/21 3:19 PM, Song Liu wrote: >>> Task local storage is enabled for tracing programs. Add a test for it >>> without

Re: [PATCH bpf-next 4/4] bpf: runqslower: use task local storage

2021-01-11 Thread Song Liu
> On Jan 11, 2021, at 9:49 AM, Yonghong Song wrote: > > > > On 1/8/21 3:19 PM, Song Liu wrote: >> Replace hashtab with task local storage in runqslower. This improves the >> performance of these BPF programs. The following table summarizes average >&

  1   2   3   4   5   6   7   8   9   10   >