[PATCH bpf-next v3 1/7] samples: bpf: refactor hbm program with libbpf

2020-11-24 Thread Daniel T. Lee
of BPF MAP definition. But this commit solves the problem by fixing this from 'queue_stats' map struct hvm_queue_stats -> hbm_queue_stats. Fixes: 36b5d471135c ("selftests/bpf: samples/bpf: Split off legacy stuff from bpf_helpers.h") Signed-off-by: Daniel T. L

[PATCH bpf-next v3 4/7] samples: bpf: refactor ibumad program with libbpf

2020-11-24 Thread Daniel T. Lee
not used on this program. Signed-off-by: Daniel T. Lee --- Changes in v2: - add static at global variable and drop {} - fix return error code on exit samples/bpf/Makefile | 2 +- samples/bpf/ibumad_kern.c | 26 +++--- samples/bpf/ibumad_user.c | 71

[PATCH bpf-next v3 6/7] samples: bpf: fix lwt_len_hist reusing previous BPF map

2020-11-24 Thread Daniel T. Lee
his commit add the executable permission to shell script files. Fixes: f74599f7c5309 ("bpf: Add tests and samples for LWT-BPF") Signed-off-by: Daniel T. Lee --- samples/bpf/lwt_len_hist.sh | 2 ++ samples/bpf/test_lwt_bpf.sh | 0 2 files changed, 2 insertions(+) mode change 100644 =

[PATCH bpf-next v3 7/7] samples: bpf: remove bpf_load loader completely

2020-11-24 Thread Daniel T. Lee
with the latest kernel BPF and causes confusion. Also, this commit removes the unused trace_helper and bpf_load from samples/bpf target objects from Makefile. Signed-off-by: Daniel T. Lee Acked-by: Jesper Dangaard Brouer Acked-by: Andrii Nakryiko --- Changes in v2: - merge commit with changing

[PATCH bpf-next v3 5/7] samples: bpf: refactor test_overhead program with libbpf

2020-11-24 Thread Daniel T. Lee
code, this commit uses the number of available cpus with _SC_NPROCESSORS_ONLN. Signed-off-by: Daniel T. Lee Acked-by: Andrii Nakryiko --- Changes in v2: - add static at global variable and drop {} samples/bpf/Makefile | 2 +- samples/bpf/test_overhead_user.c | 82

[PATCH bpf-next v3 3/7] samples: bpf: refactor task_fd_query program with libbpf

2020-11-24 Thread Daniel T. Lee
probe events, O_TRUNC flag has been used to clear 'uprobe_events' interface. Signed-off-by: Daniel T. Lee --- Changes in v2: - add static at global variable and drop {} - fix return error code on exit - restore DEBUGFS macro to absolute string path samples/bpf/Makefile

[PATCH bpf-next v3 2/7] samples: bpf: refactor test_cgrp2_sock2 program with libbpf

2020-11-24 Thread Daniel T. Lee
oblem that shell script cannot find the binary object from the current path, relative path './' has been added in front of binary. Fixes: 554ae6e792ef3 ("samples/bpf: add userspace example for prohibiting sockets") Signed-off-by: Daniel T. Lee --- Changes in v2: - cha

[PATCH bpf-next v3 0/7] bpf: remove bpf_load loader completely

2020-11-24 Thread Daniel T. Lee
d variable - change to destroy link even after link__pin() - fix return error code on exit - merge commit with changing Makefile Changes in v3: - cleanup bpf_link, bpf_object and cgroup fd both on success and error Daniel T. Lee (7): samples: bpf: refactor hbm program with libbpf samples: bpf

Re: [PATCH bpf-next v2 1/7] samples: bpf: refactor hbm program with libbpf

2020-11-24 Thread Daniel T. Lee
Sorry for the late reply. On Sat, Nov 21, 2020 at 11:34 AM Martin KaFai Lau wrote: > > On Thu, Nov 19, 2020 at 03:06:11PM +, Daniel T. Lee wrote: > [ ... ] > > > static int run_bpf_prog(char *prog, int cg_id) > > [ ... ] > > if (!o

[PATCH bpf-next v2 6/7] samples: bpf: fix lwt_len_hist reusing previous BPF map

2020-11-19 Thread Daniel T. Lee
his commit add the executable permission to shell script files. Fixes: f74599f7c5309 ("bpf: Add tests and samples for LWT-BPF") Signed-off-by: Daniel T. Lee --- samples/bpf/lwt_len_hist.sh | 2 ++ samples/bpf/test_lwt_bpf.sh | 0 2 files changed, 2 insertions(+) mode change 100644 =

[PATCH bpf-next v2 7/7] samples: bpf: remove bpf_load loader completely

2020-11-19 Thread Daniel T. Lee
with the latest kernel BPF and causes confusion. Also, this commit removes the unused trace_helper and bpf_load from samples/bpf target objects from Makefile. Signed-off-by: Daniel T. Lee Acked-by: Jesper Dangaard Brouer Acked-by: Andrii Nakryiko --- Changes in v2: - merge commit with changing

[PATCH bpf-next v2 5/7] samples: bpf: refactor test_overhead program with libbpf

2020-11-19 Thread Daniel T. Lee
code, this commit uses the number of available cpus with _SC_NPROCESSORS_ONLN. Signed-off-by: Daniel T. Lee Acked-by: Andrii Nakryiko --- Changes in v2: - add static at global variable and drop {} samples/bpf/Makefile | 2 +- samples/bpf/test_overhead_user.c | 82

[PATCH bpf-next v2 3/7] samples: bpf: refactor task_fd_query program with libbpf

2020-11-19 Thread Daniel T. Lee
probe events, O_TRUNC flag has been used to clear 'uprobe_events' interface. Signed-off-by: Daniel T. Lee --- Changes in v2: - add static at global variable and drop {} - fix return error code on exit - restore DEBUGFS macro to absolute string path samples/bpf/Makefile |

[PATCH bpf-next v2 4/7] samples: bpf: refactor ibumad program with libbpf

2020-11-19 Thread Daniel T. Lee
not used on this program. Signed-off-by: Daniel T. Lee --- Changes in v2: - add static at global variable and drop {} - fix return error code on exit samples/bpf/Makefile | 2 +- samples/bpf/ibumad_kern.c | 26 +++--- samples/bpf/ibumad_user.c | 71

[PATCH bpf-next v2 0/7] bpf: remove bpf_load loader completely

2020-11-19 Thread Daniel T. Lee
d variable - change to destroy link even after link__pin() - fix return error code on exit - merge commit with changing Makefile Daniel T. Lee (7): samples: bpf: refactor hbm program with libbpf samples: bpf: refactor test_cgrp2_sock2 program with libbpf samples: bpf: refactor task_fd_query pr

[PATCH bpf-next v2 1/7] samples: bpf: refactor hbm program with libbpf

2020-11-19 Thread Daniel T. Lee
of BPF MAP definition. But this commit solves the problem by fixing this from 'queue_stats' map struct hvm_queue_stats -> hbm_queue_stats. Fixes: 36b5d471135c ("selftests/bpf: samples/bpf: Split off legacy stuff from bpf_helpers.h") Signed-off-by: Daniel T. L

[PATCH bpf-next v2 2/7] samples: bpf: refactor test_cgrp2_sock2 program with libbpf

2020-11-19 Thread Daniel T. Lee
oblem that shell script cannot find the binary object from the current path, relative path './' has been added in front of binary. Fixes: 554ae6e792ef3 ("samples/bpf: add userspace example for prohibiting sockets") Signed-off-by: Daniel T. Lee --- Changes in v2: - cha

Re: [PATCH bpf-next 2/9] samples: bpf: refactor hbm program with libbpf

2020-11-18 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 11:10 AM Martin KaFai Lau wrote: > > On Tue, Nov 17, 2020 at 02:56:37PM +, Daniel T. Lee wrote: > [ ... ] > > > + > > +cleanup: > > + if (rc != 0) > so this test can be avoided. > Thanks for pointing

Re: [PATCH bpf-next 3/9] samples: bpf: refactor test_cgrp2_sock2 program with libbpf

2020-11-18 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 2:58 PM Martin KaFai Lau wrote: > > On Tue, Nov 17, 2020 at 02:56:38PM +, Daniel T. Lee wrote: > [ ... ] > > > + err = bpf_link__pin(link, link_pin_path); > > + if (err < 0) { > > + printf("err : %d\n&

Re: [PATCH bpf-next 5/9] samples: bpf: refactor ibumad program with libbpf

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 12:10 PM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 7:05 PM Daniel T. Lee wrote: > > > > On Wed, Nov 18, 2020 at 11:52 AM Andrii Nakryiko > > wrote: > > > > > > On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee > > &g

Re: [PATCH bpf-next 3/9] samples: bpf: refactor test_cgrp2_sock2 program with libbpf

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 12:02 PM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee wrote: > > > > This commit refactors the existing cgroup program with libbpf bpf > > loader. The original test_cgrp2_sock2 has keeped the bpf program > > at

Re: [PATCH bpf-next 4/9] samples: bpf: refactor task_fd_query program with libbpf

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 11:58 AM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee wrote: > > > > This commit refactors the existing kprobe program with libbpf bpf > > loader. To attach bpf program, this uses generic bpf_program__attach() > &

Re: [PATCH bpf-next 5/9] samples: bpf: refactor ibumad program with libbpf

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 11:52 AM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee wrote: > > > > This commit refactors the existing ibumad program with libbpf bpf > > loader. Attach/detach of Tracepoint bpf programs has been mana

Re: [PATCH bpf-next 9/9] samples: bpf: remove bpf_load loader completely

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 11:49 AM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 6:58 AM Daniel T. Lee wrote: > > > > Numerous refactoring that rewrites BPF programs written with bpf_load > > to use the libbpf loader was finally completed, resulting in BPF > >

Re: [PATCH bpf-next 1/9] selftests: bpf: move tracing helpers to trace_helper

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 10:58 AM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee wrote: > > > > Under the samples/bpf directory, similar tracing helpers are > > fragmented around. To keep consistent of tracing programs, this commit > &g

Re: [PATCH bpf-next 1/9] selftests: bpf: move tracing helpers to trace_helper

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 10:19 AM Martin KaFai Lau wrote: > > On Tue, Nov 17, 2020 at 02:56:36PM +, Daniel T. Lee wrote: > > Under the samples/bpf directory, similar tracing helpers are > > fragmented around. To keep consistent of tracing programs, this commit > > mov

[PATCH bpf-next 1/9] selftests: bpf: move tracing helpers to trace_helper

2020-11-17 Thread Daniel T. Lee
Under the samples/bpf directory, similar tracing helpers are fragmented around. To keep consistent of tracing programs, this commit moves the helper and define locations to increase the reuse of each helper function. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile

[PATCH bpf-next 4/9] samples: bpf: refactor task_fd_query program with libbpf

2020-11-17 Thread Daniel T. Lee
ed to control uprobe events. Furthermore, to prevent conflict of same named uprobe events, O_TRUNC flag has been used to clear 'uprobe_events' interface. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- samples/bpf/task_fd_query_user.c | 101 +++

[PATCH bpf-next 9/9] samples: bpf: remove bpf_load loader completely

2020-11-17 Thread Daniel T. Lee
with the latest kernel BPF and causes confusion. Signed-off-by: Daniel T. Lee --- samples/bpf/bpf_load.c | 667 samples/bpf/bpf_load.h | 57 --- samples/bpf/xdp2skb_meta_kern.c | 2 +- 3 files changed, 1 insertion(+), 725 deletions(-) delete

[PATCH bpf-next 0/9] bpf: remove bpf_load loader completely

2020-11-17 Thread Daniel T. Lee
bpf_load, an outdated bpf loader that is difficult to keep up with the latest kernel BPF and causes confusion. Daniel T. Lee (9): selftests: bpf: move tracing helpers to trace_helper.h samples: bpf: refactor hbm program with libbpf samples: bpf: refactor test_cgrp2_sock2 program with libbpf

[PATCH bpf-next 7/9] samples: bpf: fix lwt_len_hist reusing previous BPF map

2020-11-17 Thread Daniel T. Lee
his commit add the executable permission to shell script files. Fixes: f74599f7c5309 ("bpf: Add tests and samples for LWT-BPF") Signed-off-by: Daniel T. Lee --- samples/bpf/lwt_len_hist.sh | 2 ++ samples/bpf/test_lwt_bpf.sh | 0 2 files changed, 2 insertions(+) mode change 100644 =

[PATCH bpf-next 5/9] samples: bpf: refactor ibumad program with libbpf

2020-11-17 Thread Daniel T. Lee
not used on this program. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- samples/bpf/ibumad_kern.c | 26 +++ samples/bpf/ibumad_user.c | 66 ++- 3 files changed, 65 insertions(+), 29 deletions(-) diff --git a/samples/bpf

[PATCH bpf-next 6/9] samples: bpf: refactor test_overhead program with libbpf

2020-11-17 Thread Daniel T. Lee
code, this commit uses the number of available cpus with _SC_NPROCESSORS_ONLN. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- samples/bpf/test_overhead_user.c | 82 +++- 2 files changed, 60 insertions(+), 24 deletions(-) diff --git a/samples

[PATCH bpf-next 2/9] samples: bpf: refactor hbm program with libbpf

2020-11-17 Thread Daniel T. Lee
6b5d471135c ("selftests/bpf: samples/bpf: Split off legacy stuff from bpf_helpers.h") Signed-off-by: Daniel T. Lee --- samples/bpf/.gitignore | 3 ++ samples/bpf/Makefile | 2 +- samples/bpf/hbm.c | 96 +- samples/bpf/hbm_kern.h | 2 +

[PATCH bpf-next 3/9] samples: bpf: refactor test_cgrp2_sock2 program with libbpf

2020-11-17 Thread Daniel T. Lee
oblem that shell script cannot find the binary object from the current path, relative path './' has been added in front of binary. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile| 2 +- samples/bpf/test_cgrp2_sock2.c | 63 - samples/

[PATCH bpf-next 8/9] samples: bpf: remove unused trace_helper and bpf_load from Makefile

2020-11-17 Thread Daniel T. Lee
This commit removes the unused trace_helper and bpf_load from samples/bpf target objects from Makefile. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index

[PATCH bpf-next v2 1/3] samples: bpf: Refactor xdp_monitor with libbpf

2020-10-10 Thread Daniel T. Lee
ff-by: Daniel T. Lee --- Changes in v2: - added cleanup logic for bpf_link and bpf_object - split increment into seperate satement - refactor pointer array initialization samples/bpf/Makefile | 2 +- samples/bpf/xdp_monitor_user.c | 159 + 2 files changed

[PATCH bpf-next v2 3/3] samples: bpf: refactor XDP kern program maps with BTF-defined map

2020-10-10 Thread Daniel T. Lee
, this commit removes the max_entries attribute at PERF_EVENT_ARRAY map type. The libbpf's bpf_object__create_map() will automatically set max_entries to the maximum configured number of CPUs on the host. Signed-off-by: Daniel T. Lee --- Changes in v2: - revert BTF key/val type to defau

[PATCH bpf-next v2 0/3] samples: bpf: Refactor XDP programs with libbpf

2020-10-10 Thread Daniel T. Lee
inter array initialization - error code cleanup Daniel T. Lee (3): samples: bpf: Refactor xdp_monitor with libbpf samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu samples: bpf: refactor XDP kern program maps with BTF-defined map samples/bpf/Mak

[PATCH bpf-next v2 1/3] samples: bpf: Refactor xdp_monitor with libbpf

2020-10-10 Thread Daniel T. Lee
ff-by: Daniel T. Lee --- Changes in v2: - added cleanup logic for bpf_link and bpf_object - split increment into seperate satement - refactor pointer array initialization samples/bpf/Makefile | 2 +- samples/bpf/xdp_monitor_user.c | 159 + 2 files changed

Re: [PATCH bpf-next 0/3] samples: bpf: Refactor XDP programs with libbpf

2020-10-10 Thread Daniel T. Lee
On Sat, Oct 10, 2020 at 3:30 AM Andrii Nakryiko wrote: > > On Fri, Oct 9, 2020 at 9:04 AM Daniel T. Lee wrote: > > > > To avoid confusion caused by the increasing fragmentation of the BPF > > Loader program, this commit would like to convert the previous bpf_load &g

[PATCH bpf-next v2 3/3] samples: bpf: refactor XDP kern program maps with BTF-defined map

2020-10-10 Thread Daniel T. Lee
, this commit removes the max_entries attribute at PERF_EVENT_ARRAY map type. The libbpf's bpf_object__create_map() will automatically set max_entries to the maximum configured number of CPUs on the host. Signed-off-by: Daniel T. Lee --- Changes in v2: - revert BTF key/val type to defau

Re: [PATCH bpf-next 2/3] samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu

2020-10-10 Thread Daniel T. Lee
On Sat, Oct 10, 2020 at 3:23 AM Andrii Nakryiko wrote: > > On Fri, Oct 9, 2020 at 9:04 AM Daniel T. Lee wrote: > > > > From commit d7a18ea7e8b6 ("libbpf: Add generic bpf_program__attach()"), > > for some BPF programs, it is now possible to attach BPF progr

[PATCH bpf-next v2 2/3] samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu

2020-10-10 Thread Daniel T. Lee
ethod. In addition, this refactors the logic of setting the map FD to simplify the code. Also, the missing removal of bpf_load.o in Makefile has been fixed. Signed-off-by: Daniel T. Lee --- Changes in v2: - program section match with bpf_program__is_ instead of strncmp - refactor pointer ar

[PATCH bpf-next v2 0/3] samples: bpf: Refactor XDP programs with libbpf

2020-10-10 Thread Daniel T. Lee
inter array initialization - error code cleanup Daniel T. Lee (3): samples: bpf: Refactor xdp_monitor with libbpf samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu samples: bpf: refactor XDP kern program maps with BTF-defined map samples/bpf/Mak

[PATCH bpf-next v2 2/3] samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu

2020-10-10 Thread Daniel T. Lee
ethod. In addition, this refactors the logic of setting the map FD to simplify the code. Also, the missing removal of bpf_load.o in Makefile has been fixed. Signed-off-by: Daniel T. Lee --- Changes in v2: - program section match with bpf_program__is_ instead of strncmp - refactor pointer ar

Re: [PATCH bpf-next 3/3] samples: bpf: refactor XDP kern program maps with BTF-defined map

2020-10-10 Thread Daniel T. Lee
On Sat, Oct 10, 2020 at 3:25 AM Andrii Nakryiko wrote: > > On Fri, Oct 9, 2020 at 9:04 AM Daniel T. Lee wrote: > > > > Most of the samples were converted to use the new BTF-defined MAP as > > they moved to libbpf, but some of the samples were missing. > > > &g

Re: [PATCH bpf-next 1/3] samples: bpf: Refactor xdp_monitor with libbpf

2020-10-10 Thread Daniel T. Lee
On Sat, Oct 10, 2020 at 3:17 AM Andrii Nakryiko wrote: > > On Fri, Oct 9, 2020 at 9:04 AM Daniel T. Lee wrote: > > > > To avoid confusion caused by the increasing fragmentation of the BPF > > Loader program, this commit would like to change to the libbpf loader > >

[PATCH bpf-next 3/3] samples: bpf: refactor XDP kern program maps with BTF-defined map

2020-10-09 Thread Daniel T. Lee
, this commit removes the max_entries attribute at PERF_EVENT_ARRAY map type. The libbpf's bpf_object__create_map() will automatically set max_entries to the maximum configured number of CPUs on the host. Signed-off-by: Daniel T. Lee --- samples/bpf/xdp_monitor_kern.c

[PATCH bpf-next 0/3] samples: bpf: Refactor XDP programs with libbpf

2020-10-09 Thread Daniel T. Lee
o BTF-defined map. Daniel T. Lee (3): samples: bpf: Refactor xdp_monitor with libbpf samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu samples: bpf: refactor XDP kern program maps with BTF-defined map samples/bpf/Makefile| 4 +- sample

[PATCH bpf-next 1/3] samples: bpf: Refactor xdp_monitor with libbpf

2020-10-09 Thread Daniel T. Lee
ff-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- samples/bpf/xdp_monitor_user.c | 144 - 2 files changed, 108 insertions(+), 38 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 4f1ed0e3cf9f..0cee2aa8970f 100644 --- a/sample

[PATCH bpf-next 2/3] samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu

2020-10-09 Thread Daniel T. Lee
ethod. In addition, this refactors the logic of setting the map FD to simplify the code. Also, the missing removal of bpf_load.o in Makefile has been fixed. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile| 2 +- samples/bpf/xdp_redirect_cpu_user.c | 138 +--

Re: [PATCH bpf-next] samples: bpf: refactor xdp_sample_pkts_kern with BTF-defined map

2020-09-08 Thread Daniel T. Lee
On Wed, Sep 9, 2020 at 8:24 AM Andrii Nakryiko wrote: > > On Sat, Sep 5, 2020 at 8:41 AM Daniel T. Lee wrote: > > > > Most of the samples were converted to use the new BTF-defined MAP as > > they moved to libbbpf, but some of the samples were missing. > > > &g

Re: [PATCH bpf-next] samples: bpf: refactor xdp_sample_pkts_kern with BTF-defined map

2020-09-07 Thread Daniel T. Lee
On Mon, Sep 7, 2020 at 10:02 PM Michal Rostecki wrote: > > Daniel T. Lee writes: > > Most of the samples were converted to use the new BTF-defined MAP as > > they moved to libbbpf, but some of the samples were missing. > > > > Instead of using the previous B

[PATCH bpf-next] samples: bpf: refactor xdp_sample_pkts_kern with BTF-defined map

2020-09-05 Thread Daniel T. Lee
T. Lee --- samples/bpf/xdp_sample_pkts_kern.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/bpf/xdp_sample_pkts_kern.c b/samples/bpf/xdp_sample_pkts_kern.c index 33377289e2a8..b15172b7d455 100644 --- a/samples/bpf/xdp_sample_pkts_kern.c +++ b/samples

[PATCH bpf-next 1/2] samples: bpf: Replace bpf_program__title() with bpf_program__section_name()

2020-09-03 Thread Daniel T. Lee
f_program__section_name(). Due to this commit, the compilation warning issue has also been resolved. Fixes: 521095842027 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"") Signed-off-by: Daniel T. Lee --- samples/bpf/sockex3_user

[PATCH bpf-next 2/2] samples: bpf: add xsk_fwd test file to .gitignore

2020-09-03 Thread Daniel T. Lee
This commit adds xsk_fwd test file to .gitignore which is newly added to samples/bpf. Signed-off-by: Daniel T. Lee --- samples/bpf/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore index 034800c4d1e6..b2f29bc8dc43 100644 --- a/samples

[PATCH 1/2] samples: bpf: Replace bpf_program__title() with bpf_program__section_name()

2020-09-03 Thread Daniel T. Lee
f_program__section_name(). Due to this commit, the compilation warning issue has also been resolved. Fixes: 521095842027 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"") Signed-off-by: Daniel T. Lee --- samples/bpf/sockex3_user

[PATCH 2/2] samples: bpf: add xsk_fwd test file to .gitignore

2020-09-03 Thread Daniel T. Lee
This commit adds xsk_fwd test file to .gitignore which is newly added to samples/bpf. Signed-off-by: Daniel T. Lee --- samples/bpf/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore index 034800c4d1e6..b2f29bc8dc43 100644 --- a/samples

[PATCH bpf-next 2/3] samples: bpf: Refactor kprobe tracing programs with libbpf

2020-08-23 Thread Daniel T. Lee
trace_common.h was used. - Adding a kprobe event and attaching a bpf program to it was done through bpf_program_attach(). - Instead of using the existing BPF MAP definition, MAP definition has been refactored with the new BTF-defined MAP format. Signed-off-by: Daniel T. Lee

[PATCH bpf-next 3/3] samples: bpf: Refactor tracepoint tracing programs with libbpf

2020-08-23 Thread Daniel T. Lee
through bpf_program_attach(). - Instead of using the existing BPF MAP definition, MAP definition has been refactored with the new BTF-defined MAP format. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 6 ++-- samples/bpf/cpustat_kern.c | 36

[PATCH bpf-next 1/3] samples: bpf: cleanup bpf_load.o from Makefile

2020-08-23 Thread Daniel T. Lee
erformance test with libbpf") Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index f87ee02073ba..0cac89230c6d 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Mak

[PATCH bpf-next 0/3] samples: bpf: Refactor tracing programs with libbpf

2020-08-23 Thread Daniel T. Lee
() macro in trace_common.h was used. - Adding a kprobe/tracepoint event and attaching a bpf program to it was done through bpf_program_attach(). - Instead of using the existing BPF MAP definition, MAP definition has been refactored with the new BTF-defined MAP format. Daniel T. Lee (3

[PATCH bpf-next] samples: bpf: Fix broken bpf programs due to removed symbol

2020-08-17 Thread Daniel T. Lee
attach kprobe events to blk_account_io_done() to modify them to perform the same behavior as before. Signed-off-by: Daniel T. Lee --- samples/bpf/task_fd_query_kern.c | 2 +- samples/bpf/task_fd_query_user.c | 2 +- samples/bpf/tracex3_kern.c | 2 +- 3 files changed, 3 insertions(+), 3 delet

[PATCH bpf-next] libbf: fix uninitialized pointer at btf__parse_raw()

2020-08-05 Thread Daniel T. Lee
itializing btf pointer as NULL. Fixes: 94a1fedd63ed ("libbpf: Add btf__parse_raw() and generic btf__parse() APIs") Signed-off-by: Daniel T. Lee --- tools/lib/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.

Re: [PATCH bpf-next v2 4/4] selftests: bpf: remove unused bpf_map_def_legacy struct

2020-07-07 Thread Daniel T. Lee
On Wed, Jul 8, 2020 at 4:00 AM Andrii Nakryiko wrote: > > On Tue, Jul 7, 2020 at 11:49 AM Daniel T. Lee wrote: > > > > samples/bpf no longer use bpf_map_def_legacy and instead use the > > libbpf's bpf_map_def or new BTF-defined MAP format. This commit removes > &g

[PATCH bpf-next v2 4/4] selftests: bpf: remove unused bpf_map_def_legacy struct

2020-07-07 Thread Daniel T. Lee
samples/bpf no longer use bpf_map_def_legacy and instead use the libbpf's bpf_map_def or new BTF-defined MAP format. This commit removes unused bpf_map_def_legacy struct from selftests/bpf/bpf_legacy.h. Signed-off-by: Daniel T. Lee --- tools/testing/selftests/bpf/bpf_legacy.h

[PATCH bpf-next v2 2/4] samples: bpf: refactor BPF map in map test with libbpf

2020-07-07 Thread Daniel T. Lee
directive. __array(values, struct inner_map) This commit refactors map in map test program with libbpf by explicitly defining inner map with BTF-defined format. Signed-off-by: Daniel T. Lee --- Changes in V2: - fix wrong error check logic with bpf_program samples/bpf/Makefile

[PATCH bpf-next v2 3/4] samples: bpf: refactor BPF map performance test with libbpf

2020-07-07 Thread Daniel T. Lee
_load, the inner map definition has been explicitly declared with BTF-defined format. Also, the element of ARRAY_OF_MAPS was also statically specified using the BTF format. And for this reason some logic in fixup_map() was not needed and changed or removed. Signed-off-by: Daniel T. Lee --- Changes in V2

[PATCH bpf-next v2 0/4] samples: bpf: refactor BPF map test with libbpf

2020-07-07 Thread Daniel T. Lee
ARRAY_OF_MAPS element with '.values' Daniel T. Lee (4): samples: bpf: fix bpf programs with kprobe/sys_connect event samples: bpf: refactor BPF map in map test with libbpf samples: bpf: refactor BPF map performance test with libbpf selftests: bpf: remove unused bpf_map_def_leg

[PATCH bpf-next v2 1/4] samples: bpf: fix bpf programs with kprobe/sys_connect event

2020-07-07 Thread Daniel T. Lee
. Fixes: 34745aed515c ("samples/bpf: fix kprobe attachment issue on x64") Signed-off-by: Daniel T. Lee --- Changes in V2: - instead of changing event from __x64_sys_connect to __sys_connect, fetch and set register values directly samples/bpf/map_perf_test_kern.c | 9

Re: [PATCH bpf-next 1/4] samples: bpf: fix bpf programs with kprobe/sys_connect event

2020-07-06 Thread Daniel T. Lee
On Tue, Jul 7, 2020 at 2:15 PM Andrii Nakryiko wrote: > > On Mon, Jul 6, 2020 at 7:33 PM Daniel T. Lee wrote: > > > > On Tue, Jul 7, 2020 at 8:50 AM Andrii Nakryiko > > wrote: > > > > > > On Mon, Jul 6, 2020 at 3:28 AM Daniel T. Lee > > > wr

Re: [PATCH bpf-next 1/4] samples: bpf: fix bpf programs with kprobe/sys_connect event

2020-07-06 Thread Daniel T. Lee
On Tue, Jul 7, 2020 at 8:50 AM Andrii Nakryiko wrote: > > On Mon, Jul 6, 2020 at 3:28 AM Daniel T. Lee wrote: > > > > On Fri, Jul 3, 2020 at 1:04 AM Yonghong Song wrote: > > > > > > > > > > > > On 7/2/20 4:13 AM, Daniel T. Lee wrote: >

Re: [PATCH bpf-next 1/4] samples: bpf: fix bpf programs with kprobe/sys_connect event

2020-07-06 Thread Daniel T. Lee
On Fri, Jul 3, 2020 at 1:04 AM Yonghong Song wrote: > > > > On 7/2/20 4:13 AM, Daniel T. Lee wrote: > > On Thu, Jul 2, 2020 at 2:13 PM Yonghong Song wrote: > >> > >> > >> > >> On 7/1/20 7:16 PM, Daniel T. Lee wrote: > >>> Curr

Re: [PATCH bpf-next 3/4] samples: bpf: refactor BPF map performance test with libbpf

2020-07-02 Thread Daniel T. Lee
On Thu, Jul 2, 2020 at 1:34 PM Andrii Nakryiko wrote: > > On Wed, Jul 1, 2020 at 7:17 PM Daniel T. Lee wrote: > > > > Previously, in order to set the numa_node attribute at the time of map > > creation using "libbpf", it was necessary to call bpf_create_map_node

Re: [PATCH bpf-next 1/4] samples: bpf: fix bpf programs with kprobe/sys_connect event

2020-07-02 Thread Daniel T. Lee
On Thu, Jul 2, 2020 at 2:13 PM Yonghong Song wrote: > > > > On 7/1/20 7:16 PM, Daniel T. Lee wrote: > > Currently, BPF programs with kprobe/sys_connect does not work properly. > > > > Commit 34745aed515c ("samples/bpf: fix kprobe attachment issue on x64"

Re: [PATCH bpf-next 2/4] samples: bpf: refactor BPF map in map test with libbpf

2020-07-02 Thread Daniel T. Lee
On Thu, Jul 2, 2020 at 1:26 PM Andrii Nakryiko wrote: > > On Wed, Jul 1, 2020 at 7:17 PM Daniel T. Lee wrote: > > > > From commit 646f02ffdd49 ("libbpf: Add BTF-defined map-in-map > > support"), a way to define internal map in BTF-defined map has been > >

[PATCH bpf-next 2/4] samples: bpf: refactor BPF map in map test with libbpf

2020-07-01 Thread Daniel T. Lee
directive. __array(values, struct inner_map) This commit refactors map in map test program with libbpf by explicitly defining inner map with BTF-defined format. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- samples/bpf/test_map_in_map_kern.c | 85 +++-

[PATCH bpf-next 4/4] selftests: bpf: remove unused bpf_map_def_legacy struct

2020-07-01 Thread Daniel T. Lee
samples/bpf no longer use bpf_map_def_legacy and instead use the libbpf's bpf_map_def or new BTF-defined MAP format. This commit removes unused bpf_map_def_legacy struct from selftests/bpf/bpf_legacy.h. Signed-off-by: Daniel T. Lee --- tools/testing/selftests/bpf/bpf_legacy.h

[PATCH bpf-next 0/4] samples: bpf: refactor BPF map test with libbpf

2020-07-01 Thread Daniel T. Lee
. Daniel T. Lee (4): samples: bpf: fix bpf programs with kprobe/sys_connect event samples: bpf: refactor BPF map in map test with libbpf samples: bpf: refactor BPF map performance test with libbpf selftests: bpf: remove unused bpf_map_def_legacy struct samples/bpf/Makefile

[PATCH bpf-next 1/4] samples: bpf: fix bpf programs with kprobe/sys_connect event

2020-07-01 Thread Daniel T. Lee
sys_connect event by specifying the __sys_connect directly and this will bypass the "__x64_" appending rule of bpf_load. Fixes: 34745aed515c ("samples/bpf: fix kprobe attachment issue on x64") Signed-off-by: Daniel T. Lee --- samples/bpf/map_perf_test_kern.c

[PATCH bpf-next 3/4] samples: bpf: refactor BPF map performance test with libbpf

2020-07-01 Thread Daniel T. Lee
ject_load() has been added. By using libbpf instead of bpf_load, the inner map definition has been explicitly declared with BTF-defined format. And for this reason some logic in fixup_map() was not needed and changed or removed. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile |

Re: [PATCH 3/3] samples: bpf: refactor BPF map in map test with libbpf

2020-06-26 Thread Daniel T. Lee
On Sat, Jun 27, 2020 at 7:19 AM Andrii Nakryiko wrote: > > On Fri, Jun 26, 2020 at 3:14 PM Daniel T. Lee wrote: > > > > On Sat, Jun 27, 2020 at 5:30 AM Andrii Nakryiko > > wrote: > > > > > > On Fri, Jun 26, 2020 at 1:18 AM Daniel T. Lee > > &

Re: [PATCH 3/3] samples: bpf: refactor BPF map in map test with libbpf

2020-06-26 Thread Daniel T. Lee
On Sat, Jun 27, 2020 at 5:30 AM Andrii Nakryiko wrote: > > On Fri, Jun 26, 2020 at 1:18 AM Daniel T. Lee wrote: > > > > From commit 646f02ffdd49 ("libbpf: Add BTF-defined map-in-map > > support"), a way to define internal map in BTF-defined map has been &

Re: [PATCH 2/3] samples: bpf: cleanup pointer error check with libbpf

2020-06-26 Thread Daniel T. Lee
2020년 6월 27일 (토) 05:25, Andrii Nakryiko 님이 작성: > > On Fri, Jun 26, 2020 at 1:18 AM Daniel T. Lee wrote: > > > > Libbpf has its own helper function to check for errors in the bpf > > data structure (pointer). And Some codes do not use this libbbpf > > helper function

[PATCH 2/3] samples: bpf: cleanup pointer error check with libbpf

2020-06-26 Thread Daniel T. Lee
Libbpf has its own helper function to check for errors in the bpf data structure (pointer). And Some codes do not use this libbbpf helper function and check the pointer's error directly. This commit clean up the existing pointer error check logic with libbpf. Signed-off-by: Daniel T

[PATCH 3/3] samples: bpf: refactor BPF map in map test with libbpf

2020-06-26 Thread Daniel T. Lee
directive. __array(values, struct inner_map) This commit refactors map in map test program with libbpf by explicitly defining inner map with BTF-defined format. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- samples/bpf/test_map_in_map_kern.c | 85 +++-

[PATCH 1/3] samples: bpf: fix bpf programs with kprobe/sys_connect event

2020-06-26 Thread Daniel T. Lee
sys_connect event by specifying the __sys_connect directly and this will bypass the "__x64_" appending rule of bpf_load. Fixes: 34745aed515c ("samples/bpf: fix kprobe attachment issue on x64") Signed-off-by: Daniel T. Lee --- samples/bpf/map_perf_test_kern.c

[PATCH bpf-next v2 3/5] samples: bpf: refactor tail call user progs with libbpf

2020-05-15 Thread Daniel T. Lee
of them to PROG_ARRAY, and it's much more intuitive than the traditional approach. This commit refactors user programs with the PROG_ARRAY type MAP with libbpf instead of using bpf_load. Signed-off-by: Daniel T. Lee --- Changes in V2: - refactor pointer error check with libbpf_get_error - on

[PATCH bpf-next v2 4/5] samples: bpf: add tracex7 test file to .gitignore

2020-05-15 Thread Daniel T. Lee
This commit adds tracex7 test file (testfile.img) to .gitignore which comes from test_override_return.sh. Signed-off-by: Daniel T. Lee --- samples/bpf/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore index 23837f2ed458..034800c4d1e6

[PATCH bpf-next v2 5/5] samples: bpf: refactor kprobe, tail call kern progs map definition

2020-05-15 Thread Daniel T. Lee
with bpf_load. Signed-off-by: Daniel T. Lee --- samples/bpf/sampleip_kern.c| 12 +-- samples/bpf/sockex3_kern.c | 36 samples/bpf/trace_event_kern.c | 24 ++--- samples/bpf/tracex2_kern.c | 24 ++--- sample

[PATCH bpf-next v2 2/5] samples: bpf: refactor kprobe tracing user progs with libbpf

2020-05-15 Thread Daniel T. Lee
ith libbpf using bpf_link interface and bpf_program__attach. tracex2_kern.c, which tracks system calls (sys_*), has been modified to append prefix depending on architecture. Signed-off-by: Daniel T. Lee --- Changes in V2: - refactor pointer error check with libbpf_get_error - on bpf object op

[PATCH bpf-next v2 1/5] samples: bpf: refactor pointer error check with libbpf

2020-05-15 Thread Daniel T. Lee
Current method of checking pointer error is not user friendly. Especially the __must_check define makes this less intuitive. Since, libbpf has an API libbpf_get_error() which checks pointer error, this commit refactors existing pointer error check logic with libbpf. Signed-off-by: Daniel T. Lee

[PATCH bpf-next v2 0/5] samples: bpf: refactor kprobe tracing progs with libbpf

2020-05-15 Thread Daniel T. Lee
macro for adding architecture prefix to system calls (sys_*) Daniel T. Lee (5): samples: bpf: refactor pointer error check with libbpf samples: bpf: refactor kprobe tracing user progs with libbpf samples: bpf: refactor tail call user progs with libbpf samples: bpf: add tracex7 test file to

Re: [PATCH bpf-next 1/3] samples: bpf: refactor kprobe tracing user progs with libbpf

2020-05-15 Thread Daniel T. Lee
On Thu, May 14, 2020 at 12:29 AM Yonghong Song wrote: > > > > On 5/12/20 11:51 PM, Daniel T. Lee wrote: > > On Wed, May 13, 2020 at 10:40 AM Yonghong Song wrote: > >> > >> > >> > >> On 5/12/20 7:43 AM, Daniel T. Lee wrote: > >>> C

Re: [PATCH bpf-next 1/3] samples: bpf: refactor kprobe tracing user progs with libbpf

2020-05-12 Thread Daniel T. Lee
On Wed, May 13, 2020 at 10:40 AM Yonghong Song wrote: > > > > On 5/12/20 7:43 AM, Daniel T. Lee wrote: > > Currently, the kprobe BPF program attachment method for bpf_load is > > quite old. The implementation of bpf_load "directly" controls and > > mana

[PATCH bpf-next 2/3] samples: bpf: refactor tail call user progs with libbpf

2020-05-12 Thread Daniel T. Lee
of them to PROG_ARRAY, and it's much more intuitive than the traditional approach. This commit refactors user programs with the PROG_ARRAY type MAP with libbpf instead of using bpf_load. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 4 +-- samples/bpf/sock

[PATCH bpf-next 1/3] samples: bpf: refactor kprobe tracing user progs with libbpf

2020-05-12 Thread Daniel T. Lee
ith libbpf using bpf_link interface and bpf_program__attach. tracex2_kern.c, which tracks system calls (sys_*), has been modified to append prefix depending on architecture. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 12 +++ samples/bpf/tracex1_u

[PATCH bpf-next 3/3] samples: bpf: refactor kprobe, tail call kern progs map definition

2020-05-12 Thread Daniel T. Lee
with bpf_load. Signed-off-by: Daniel T. Lee --- samples/bpf/sampleip_kern.c| 12 +-- samples/bpf/sockex3_kern.c | 36 samples/bpf/trace_event_kern.c | 24 ++--- samples/bpf/tracex2_kern.c | 24 ++--- sample

[PATCH bpf-next 0/3] samples: bpf: refactor kprobe tracing progs with libbpf

2020-05-12 Thread Daniel T. Lee
r bpf_link interface) This patchset refactors kprobe tracing programs with using libbpf API for loading bpf program instead of previous bpf_load implementation. Daniel T. Lee (3): samples: bpf: refactor kprobe tracing user progs with libbpf samples: bpf: refactor tail call user progs with libbpf sa

  1   2   3   >