Re: [PATCH bpf-next v1 0/3] Improve .BTF_ids patching and alignment

2024-09-23 Thread Jiri Olsa
On Fri, Sep 20, 2024 at 12:49:10AM -0700, Tony Ambardar wrote: > Hello all, > > This patch series offers improvements to the way .BTF_ids section data is > created and later patched by resolve_btfids. > > Patch #1 simplifies the byte-order translation in resolve_btfids while > making it more resi

Re: [PATCH bpf-next v1 1/3] tools/resolve_btfids: Simplify handling cross-endian compilation

2024-09-23 Thread Jiri Olsa
shndx = idx; > obj->efile.idlist_addr = sh.sh_addr; > + if (btfids_endian_fix(obj)) > + return -1; nit, it'd be bit more clear to me without using the btfids_endian_fix function and just unwin

Re: [PATCH bpf-next v1 2/3] bpf: btf: Ensure natural alignment of .BTF_ids section

2024-09-23 Thread Jiri Olsa
On Sat, Sep 21, 2024 at 02:46:17AM -0700, Eduard Zingerman wrote: > On Fri, 2024-09-20 at 00:49 -0700, Tony Ambardar wrote: > > While building of vmlinux employs a linker script to align the .BTF_ids > > section to 4 bytes, other usage leaves .BTF_ids unaligned and may lead to > > problems (e.g. [1

Re: [PATCH] selftests/bpf: Fix procmap_query()'s params mismatch and compilation warning

2024-09-02 Thread Jiri Olsa
e_t *start, size_t *offset, int *flags) > | ^ > As this function is only used in the file, mark it as 'static'. > > Signed-off-by: Yuan Chen perhaps also Fixes: 4e9e07603ecd ("selftests/bpf: make use of PROCMAP_QUERY ioctl if available&quo

Re: [bpf-next 2/3] selftests/bpf: add rename tracepoint bench test

2024-08-12 Thread Jiri Olsa
, this > commit updates the benchmarking program to utilize the newly added > 'rename-tp'. > > Signed-off-by: Daniel T. Lee Acked-by: Jiri Olsa jirka > --- > tools/testing/selftests/bpf/bench.c | 2 ++ > .../testing/selftests/bpf/benchs/bench_rename

Re: [bpf-next 1/3] selftests/bpf: migrate tracepoint overhead test to prog_tests

2024-08-12 Thread Jiri Olsa
ly, > and do not cover tracepoint-specific tests. To support this, this > commit utilize 'vmlinux.h', and additional test program for tracepoint > has been added. > > Signed-off-by: Daniel T. Lee sure, let's have it complete Acked-by: Jiri Olsa jirka > --- >

Re: [PATCH] selftests/bpf:fix a resource leak

2024-07-09 Thread Jiri Olsa
On Tue, Jul 09, 2024 at 02:38:42AM -0700, Zhu Jun wrote: > The requested resources should be closed before return > in main(), otherwise resource leak will occur > > Signed-off-by: Zhu Jun should have 'PATCHv2 bpf-next' (or bpf) in subject, other than that lgtm Acked

Re: [PATCH] selftests/bpf:fix a resource leak

2024-07-01 Thread Jiri Olsa
On Sun, Jun 30, 2024 at 07:13:31PM -0700, Zhu Jun wrote: > The requested resources should be closed before return > in main(), otherwise resource leak will occur > > Signed-off-by: Zhu Jun could you please send this not as reply but as a separate patch with v2 > --- > tools/testing/selftests/b

Re: [PATCH bpf-next v4 06/12] bpf: selftests: Fix bpf_session_cookie() kfunc prototype

2024-06-18 Thread Jiri Olsa
On Tue, Jun 18, 2024 at 09:58:23AM -0700, Andrii Nakryiko wrote: > On Tue, Jun 18, 2024 at 5:43 AM Jiri Olsa wrote: > > > > On Mon, Jun 17, 2024 at 03:25:53PM -0700, Andrii Nakryiko wrote: > > > On Mon, Jun 10, 2024 at 6:04 AM Jiri Olsa wrote: > > > > > &

Re: [PATCH bpf-next v4 06/12] bpf: selftests: Fix bpf_session_cookie() kfunc prototype

2024-06-18 Thread Jiri Olsa
On Mon, Jun 17, 2024 at 03:25:53PM -0700, Andrii Nakryiko wrote: > On Mon, Jun 10, 2024 at 6:04 AM Jiri Olsa wrote: > > > > On Sat, Jun 08, 2024 at 03:16:02PM -0600, Daniel Xu wrote: > > > The prototype defined in bpf_kfuncs.h was not in line with how the > > &g

Re: [PATCH bpf-next v4 03/12] bpf: selftests: Fix fentry test kfunc prototypes

2024-06-12 Thread Jiri Olsa
On Tue, Jun 11, 2024 at 10:58:26AM -0600, Daniel Xu wrote: > On Mon, Jun 10, 2024 at 03:28:36PM GMT, Jiri Olsa wrote: > > On Sat, Jun 08, 2024 at 03:15:59PM -0600, Daniel Xu wrote: > > > The prototypes in progs/get_func_ip_test.c were not in line with how the > > > actua

Re: [PATCH bpf-next v4 03/12] bpf: selftests: Fix fentry test kfunc prototypes

2024-06-10 Thread Jiri Olsa
On Sat, Jun 08, 2024 at 03:15:59PM -0600, Daniel Xu wrote: > The prototypes in progs/get_func_ip_test.c were not in line with how the > actual kfuncs are defined in net/bpf/test_run.c. This causes compilation > errors when kfunc prototypes are generated from BTF. > > Fix by aligning with actual kf

Re: [PATCH bpf-next v4 06/12] bpf: selftests: Fix bpf_session_cookie() kfunc prototype

2024-06-10 Thread Jiri Olsa
On Sat, Jun 08, 2024 at 03:16:02PM -0600, Daniel Xu wrote: > The prototype defined in bpf_kfuncs.h was not in line with how the > actual kfunc was defined. This causes compilation errors when kfunc > prototypes are generated from BTF. > > Fix by aligning with actual kfunc definition. > > Signed-o

Re: [PATCH v3] selftests/bpf: Add ring_buffer__consume_n test.

2024-04-25 Thread Jiri Olsa
ing all of them greedily, like ring_buffer__consume() > does. > > Link: > https://lore.kernel.org/lkml/CAEf4BzaR4zqUpDmj44KNLdpJ=tpa97grvzuzvno5nm6b7ow...@mail.gmail.com > Signed-off-by: Andrea Righi Acked-by: Jiri Olsa jirka > --- > tools/testing/selftests/bpf/Makefile

Re: [PATCH v2] selftests/bpf: Add ring_buffer__consume_n test.

2024-04-25 Thread Jiri Olsa
gt; @@ -60,6 +61,7 @@ static int process_sample(void *ctx, void *data, size_t len) > } > > static struct test_ringbuf_map_key_lskel *skel_map_key; > +static struct test_ringbuf_n_lskel *skel_n; nit, as I wrote in the other email, I think this could be put directly in the ringbu

Re: [PATCH] selftests/bpf: Add ring_buffer__consume_n test.

2024-04-25 Thread Jiri Olsa
On Thu, Apr 25, 2024 at 08:19:04AM +0200, Andrea Righi wrote: > On Sun, Apr 21, 2024 at 10:11:33PM +0200, Jiri Olsa wrote: > ... > > > static struct test_ringbuf_map_key_lskel *skel_map_key; > > > +static struct test_ringbuf_n_lskel *skel_n; > > > > seems

Re: [PATCH] selftests/bpf: Add ring_buffer__consume_n test.

2024-04-21 Thread Jiri Olsa
On Sat, Apr 20, 2024 at 05:59:04PM +0200, Andrea Righi wrote: > Add a testcase for the ring_buffer__consume_n() API. > > The test produces multiple samples in a ring buffer, using a > sys_getpid() fentry prog, and consumes them from user-space in batches, > rather than consuming all of them greedi

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-30 Thread Jiri Olsa
On Sat, Mar 30, 2024 at 08:27:55AM -0400, Steven Rostedt wrote: > On Fri, 29 Mar 2024 16:28:33 -0700 > Andrii Nakryiko wrote: > > > I thought I'll just ask instead of digging through code, sorry for > > being lazy :) Is there any way to pass pt_regs/ftrace_regs captured > > before function execut

Re: [PATCH V3 bpf-next 2/2] selftests/bpf: add selftest for bpf_task_get_cgroup

2024-03-19 Thread Jiri Olsa
g a test cgroup, attaching a BPF program > that utilizes the `bpf_task_get_cgroup` during a `sched_switch` > tracepoint, and validating that the obtained cgroup ID for the previous > task matches the expected cgroup ID. > > Signed-off-by: Jose Fernandez > Reviewed-by: Tycho Ander

Re: [PATCH V2 bpf-next 2/2] selftests/bpf: add selftest for bpf_task_get_cgroup

2024-03-18 Thread Jiri Olsa
On Sat, Mar 16, 2024 at 10:22:41AM -0600, Jose Fernandez wrote: SNIP > +void test_task_get_cgroup(void) > +{ > + struct test_task_get_cgroup *skel; > + int err, fd; > + pid_t pid; > + __u64 cgroup_id, expected_cgroup_id; > + const struct timespec req = { > + .tv_se

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-13 Thread Jiri Olsa
On Wed, Mar 13, 2024 at 05:25:35PM -0700, Alexei Starovoitov wrote: > On Tue, Mar 12, 2024 at 6:53 PM 梦龙董 wrote: > > > > On Wed, Mar 13, 2024 at 12:42 AM Alexei Starovoitov > > wrote: > > > > > > On Mon, Mar 11, 2024 at 7:42 PM 梦龙董 wrote: > > > > > > [..] > > > > > > I see. > > > I thought y

Re: [PATCH v2 0/7] tracing/probes: Support function parameter access from return probe

2024-02-28 Thread Jiri Olsa
On Mon, Feb 26, 2024 at 12:57:53PM +0900, Masami Hiramatsu (Google) wrote: > Hi, > > Here is version 2 series of patches to support accessing function entry data > from function *return* probes (including kretprobe and fprobe-exit event). > > In this version, I added another cleanup [4/7], update

Re: [PATCH bpf-next 1/5] bpf: tracing: add support to record and check the accessed args

2024-02-20 Thread Jiri Olsa
On Tue, Feb 20, 2024 at 11:51:01AM +0800, Menglong Dong wrote: SNIP > +static int get_ctx_arg_idx_aligned(struct btf *btf, const struct btf_type *t, > +int off) > +{ > + const struct btf_param *args; > + u32 offset = 0, nr_args; > + int i; > + > + n

Re: [PATCH bpf-next 2/5] bpf: tracing: support to attach program to multi hooks

2024-02-20 Thread Jiri Olsa
On Tue, Feb 20, 2024 at 11:51:02AM +0800, Menglong Dong wrote: SNIP > @@ -3228,7 +3260,9 @@ static int bpf_tracing_prog_attach(struct bpf_prog > *prog, > struct bpf_link_primer link_primer; > struct bpf_prog *tgt_prog = NULL; > struct bpf_trampoline *tr = NULL; > + struct b

Re: [PATCH bpf-next v4 0/3] Annotate kfuncs in .BTF_ids section

2024-02-03 Thread Jiri Olsa
On Fri, Feb 02, 2024 at 03:09:05PM -0800, Manu Bretelle wrote: > On Sun, Jan 28, 2024 at 06:24:05PM -0700, Daniel Xu wrote: > > === Description === > > > > This is a bpf-treewide change that annotates all kfuncs as such inside > > .BTF_ids. This annotation eventually allows us to automatically gen

Re: [PATCH bpf-next v4 0/3] Annotate kfuncs in .BTF_ids section

2024-01-31 Thread Jiri Olsa
viewed > here on these "frozen" branches [0][1]. > > [0]: https://github.com/danobi/pahole/tree/kfunc_btf-v3-mailed > [1]: https://github.com/danobi/linux/tree/kfunc_bpftool-mailed > > === Changelog === > > Changes from v3: > * Rebase to bpf-next and add m

Re: [bpf-next] selftests/bpf: Drop return in bpf_testmod_exit

2024-01-27 Thread Jiri Olsa
master, there's conflict now with latest change Acked-by: Jiri Olsa jirka > --- > tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c > b/to

Re: [PATCH bpf-next v3 0/3] Annotate kfuncs in .BTF_ids section

2024-01-13 Thread Jiri Olsa
On Sat, Jan 13, 2024 at 09:17:44AM -0700, Daniel Xu wrote: > Hi Jiri, > > On Sat, Jan 13, 2024 at 02:57:40PM +0100, Jiri Olsa wrote: > > On Fri, Jan 12, 2024 at 01:03:59PM -0700, Daniel Xu wrote: > > > On Fri, Jan 12, 2024 at 05:20:39PM +0100, Jiri Olsa wrote: > >

Re: [PATCH bpf-next v3 0/3] Annotate kfuncs in .BTF_ids section

2024-01-13 Thread Jiri Olsa
On Fri, Jan 12, 2024 at 01:03:59PM -0700, Daniel Xu wrote: > On Fri, Jan 12, 2024 at 05:20:39PM +0100, Jiri Olsa wrote: > > On Sat, Jan 06, 2024 at 11:24:07AM -0700, Daniel Xu wrote: > > > === Description === > > > > > > This is a bpf-treewide change that

Re: [PATCH bpf-next v3 0/3] Annotate kfuncs in .BTF_ids section

2024-01-12 Thread Jiri Olsa
On Sat, Jan 06, 2024 at 11:24:07AM -0700, Daniel Xu wrote: > === Description === > > This is a bpf-treewide change that annotates all kfuncs as such inside > .BTF_ids. This annotation eventually allows us to automatically generate > kfunc prototypes from bpftool. > > We store this metadata inside

Re: [PATCH bpf-next v2 3/3] bpf: treewide: Annotate BPF kfuncs in BTF

2024-01-06 Thread Jiri Olsa
On Fri, Jan 05, 2024 at 09:55:43AM -0700, Daniel Xu wrote: > On Fri, Jan 05, 2024 at 04:11:33PM +0100, Jiri Olsa wrote: > > On Thu, Jan 04, 2024 at 07:45:49PM -0700, Daniel Xu wrote: > > > > SNIP > > > > > diff --git a/fs/verity/measure.c b/fs/verit

Re: [PATCH bpf-next v2 0/3] Annotate kfuncs in .BTF_ids section

2024-01-05 Thread Jiri Olsa
On Thu, Jan 04, 2024 at 07:45:46PM -0700, Daniel Xu wrote: > === Description === > > This is a bpf-treewide change that annotates all kfuncs as such inside > .BTF_ids. This annotation eventually allows us to automatically generate > kfunc prototypes from bpftool. > > We store this metadata inside

Re: [PATCH bpf-next v2 3/3] bpf: treewide: Annotate BPF kfuncs in BTF

2024-01-05 Thread Jiri Olsa
On Thu, Jan 04, 2024 at 07:45:49PM -0700, Daniel Xu wrote: SNIP > diff --git a/fs/verity/measure.c b/fs/verity/measure.c > index bf7a5f4cccaf..3969d54158d1 100644 > --- a/fs/verity/measure.c > +++ b/fs/verity/measure.c > @@ -159,9 +159,9 @@ __bpf_kfunc int bpf_get_fsverity_digest(struct file > *

Re: [PATCH bpf-next 2/2] bpf: treewide: Annotate BPF kfuncs in BTF

2024-01-04 Thread Jiri Olsa
On Wed, Jan 03, 2024 at 04:31:56PM -0700, Daniel Xu wrote: SNIP > diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h > index 88f914579fa1..771e29762a2d 100644 > --- a/include/linux/btf_ids.h > +++ b/include/linux/btf_ids.h > @@ -8,6 +8,9 @@ struct btf_id_set { > u32 ids[]; > };

Re: [PATCH 2/2] selftest/bpf: Test returning zero from a perf bpf program suppresses SIGIO.

2023-12-05 Thread Jiri Olsa
On Mon, Dec 04, 2023 at 12:14:06PM -0800, Kyle Huey wrote: > The test sets a hardware breakpoint and uses a bpf program to suppress the > I/O availability signal if the ip matches the expected value. > > Signed-off-by: Kyle Huey > --- > .../selftests/bpf/prog_tests/perf_skip.c | 95

Re: [PATCH bpf-next 3/3] selftests/bpf: Add uprobe_multi to gen_tar target

2023-10-04 Thread Jiri Olsa
On Wed, Oct 04, 2023 at 02:27:21PM +0200, Björn Töpel wrote: > From: Björn Töpel > > The uprobe_multi program was not picked up for the gen_tar target. Fix > by adding it to TEST_GEN_FILES. > > Signed-off-by: Björn Töpel Acked-by: Jiri Olsa thanks, jirka > --- >

Re: [PATCH bpf-next v1] bpf/selftests: improve arg parsing in test_verifier

2023-09-26 Thread Jiri Olsa
On Mon, Sep 25, 2023 at 04:37:02PM -0700, Tony Ambardar wrote: SNIP > @@ -1848,36 +1850,40 @@ int main(int argc, char **argv) > { > unsigned int from = 0, to = ARRAY_SIZE(tests); > bool unpriv = !is_admin(); > - int arg = 1; > - > - if (argc > 1 && strcmp(argv[1], "-v") == 0)

Re: [PATCH bpf-next v1] bpf/selftests: improve arg parsing in test_verifier

2023-09-26 Thread Jiri Olsa
On Mon, Sep 25, 2023 at 04:37:02PM -0700, Tony Ambardar wrote: > Current test_verifier provides little feedback or argument validation, > instead silently falling back to running all tests in case of user error > or even expected use cases. Trying to do manual exploratory testing, > switching betwe