All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Song Liu <song@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, Hou Tao <houtao1@huawei.com>,
	bpf@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
	Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Daniel Xu <dxu@dxuuu.xyz>
Subject: Re: [PATCHv2 bpf-next 8/9] selftests/bpf: Add test for recursion counts of perf event link kprobe
Date: Thu, 14 Sep 2023 09:56:03 +0200	[thread overview]
Message-ID: <ZQK8k9zi43J/v5aa@krava> (raw)
In-Reply-To: <CAPhsuW5uG9rAdnUCnMUy6EJhh8xU+2ARe-_bQApSD9_XekNvFg@mail.gmail.com>

On Thu, Sep 07, 2023 at 11:55:27AM -0700, Song Liu wrote:
> On Thu, Sep 7, 2023 at 12:14 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Adding selftest that puts kprobe.multi on bpf_fentry_test1 that
> > calls bpf_kfunc_common_test kfunc which has 3 perf event kprobes
> > and 1 kprobe.multi attached.
> >
> > Because fprobe (kprobe.multi attach layear) does not have strict
> > recursion check the kprobe's bpf_prog_active check is hit for test2-5.
> >
> > Disabling this test for arm64, because there's no fprobe support yet.
> >
> > Acked-by: Hou Tao <houtao1@huawei.com>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> 
> Reviewed-and-tested-by: Song Liu <song@kernel.org>
> 
> With on nitpick below.
> 
> > ---
> >  tools/testing/selftests/bpf/DENYLIST.aarch64  |  1 +
> >  .../testing/selftests/bpf/prog_tests/missed.c | 51 +++++++++++++++++++
> >  .../bpf/progs/missed_kprobe_recursion.c       | 48 +++++++++++++++++
> >  3 files changed, 100 insertions(+)
> >  create mode 100644 tools/testing/selftests/bpf/progs/missed_kprobe_recursion.c
> >
> > diff --git a/tools/testing/selftests/bpf/DENYLIST.aarch64 b/tools/testing/selftests/bpf/DENYLIST.aarch64
> > index 7f768d335698..3f2187c049db 100644
> > --- a/tools/testing/selftests/bpf/DENYLIST.aarch64
> > +++ b/tools/testing/selftests/bpf/DENYLIST.aarch64
> > @@ -15,3 +15,4 @@ fexit_test/fexit_many_args                       # fexit_many_args:FAIL:fexit_ma
> >  fill_link_info/kprobe_multi_link_info            # bpf_program__attach_kprobe_multi_opts unexpected error: -95
> >  fill_link_info/kretprobe_multi_link_info         # bpf_program__attach_kprobe_multi_opts unexpected error: -95
> >  fill_link_info/kprobe_multi_invalid_ubuff        # bpf_program__attach_kprobe_multi_opts unexpected error: -95
> > +missed/kprobe_recursion                          # missed_kprobe_recursion__attach unexpected error: -95 (errno 95)
> > diff --git a/tools/testing/selftests/bpf/prog_tests/missed.c b/tools/testing/selftests/bpf/prog_tests/missed.c
> > index fc674258c81f..f10dc9232b3f 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/missed.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/missed.c
> > @@ -1,6 +1,7 @@
> >  // SPDX-License-Identifier: GPL-2.0
> >  #include <test_progs.h>
> >  #include "missed_kprobe.skel.h"
> > +#include "missed_kprobe_recursion.skel.h"
> >
> >  /*
> >   * Putting kprobe on bpf_fentry_test1 that calls bpf_kfunc_common_test
> > @@ -40,8 +41,58 @@ static void test_missed_perf_kprobe(void)
> >         missed_kprobe__destroy(skel);
> >  }
> >
> > +static __u64 get_count(int fd)
> 
> nit: Probably rename it as get_missed_count() or get_missed().

right, I was thinking of that ;-) will change

thanks,
jirka

> 
> > +{
> > +       struct bpf_prog_info info = {};
> > +       __u32 len = sizeof(info);
> > +       int err;
> > +
> > +       err = bpf_prog_get_info_by_fd(fd, &info, &len);
> > +       if (!ASSERT_OK(err, "bpf_prog_get_info_by_fd"))
> > +               return (__u64) -1;
> > +       return info.recursion_misses;
> > +}
> [...]

  reply	other threads:[~2023-09-14  7:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07  7:13 [PATCHv2 bpf-next 0/9] bpf: Add missed stats for kprobes Jiri Olsa
2023-09-07  7:13 ` [PATCHv2 bpf-next 1/9] bpf: Count stats for kprobe_multi programs Jiri Olsa
2023-09-07 18:09   ` Song Liu
2023-09-07  7:13 ` [PATCHv2 bpf-next 2/9] bpf: Add missed value to kprobe_multi link info Jiri Olsa
2023-09-07 18:15   ` Song Liu
2023-09-07  7:13 ` [PATCHv2 bpf-next 3/9] bpf: Add missed value to kprobe perf " Jiri Olsa
2023-09-07 18:40   ` Song Liu
2023-09-08 11:43     ` Jiri Olsa
2023-09-08 16:49       ` Song Liu
2023-09-10 18:54         ` Jiri Olsa
2023-09-08 23:22       ` Andrii Nakryiko
2023-09-08 23:32         ` Song Liu
2023-09-08 23:44           ` Andrii Nakryiko
2023-09-10 18:54         ` Jiri Olsa
2023-09-07  7:13 ` [PATCHv2 bpf-next 4/9] bpf: Count missed stats in trace_call_bpf Jiri Olsa
2023-09-07 18:46   ` Song Liu
2023-09-07  7:13 ` [PATCHv2 bpf-next 5/9] bpftool: Display missed count for kprobe_multi link Jiri Olsa
2023-09-07  7:13 ` [PATCHv2 bpf-next 6/9] bpftool: Display missed count for kprobe perf link Jiri Olsa
2023-09-07  7:13 ` [PATCHv2 bpf-next 7/9] selftests/bpf: Add test for missed counts of perf event link kprobe Jiri Olsa
2023-09-07 18:52   ` Song Liu
2023-09-08 23:25   ` Andrii Nakryiko
2023-09-10 18:54     ` Jiri Olsa
2023-09-07  7:13 ` [PATCHv2 bpf-next 8/9] selftests/bpf: Add test for recursion " Jiri Olsa
2023-09-07 18:55   ` Song Liu
2023-09-14  7:56     ` Jiri Olsa [this message]
2023-09-07  7:13 ` [PATCHv2 bpf-next 9/9] selftests/bpf: Add test for recursion counts of perf event link tracepoint Jiri Olsa
2023-09-07 19:00   ` Song Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZQK8k9zi43J/v5aa@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dxu@dxuuu.xyz \
    --cc=haoluo@google.com \
    --cc=houtao1@huawei.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.