All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>
Subject: Re: [PATCHv3 bpf-next 5/5] selftests/bpf: Add usdt trigger bench
Date: Thu, 12 Feb 2026 15:09:38 +0100	[thread overview]
Message-ID: <aY3fImpJnH6R2mKV@krava> (raw)
In-Reply-To: <CAEf4BzYP0+u6mMz1NsZW+sT7Ts=VyM4vnFbbo6sxEZKWznGSXQ@mail.gmail.com>

On Wed, Feb 11, 2026 at 01:45:15PM -0800, Andrii Nakryiko wrote:
> On Wed, Feb 11, 2026 at 12:49 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Adding usdt trigger bench for usdt:
> >  trig-usdt_nop - usdt on top of nop1 instruction
> >  trig-usdt_nop_combo - usdt on top of nop1/nop5 combo
> >
> > Adding it to benchs/run_bench_uprobes.sh script.
> >
> > Example run on x86_64 kernel with uprobe syscall:
> >
> >   # ./benchs/run_bench_uprobes.sh
> >   usermode-count :  152.507 ± 0.098M/s
> >   syscall-count  :   14.309 ± 0.093M/s
> >   uprobe-nop     :    3.190 ± 0.012M/s
> >   uprobe-push    :    3.057 ± 0.004M/s
> >   uprobe-ret     :    1.095 ± 0.009M/s
> >   uprobe-nop5    :    7.305 ± 0.034M/s
> >   uretprobe-nop  :    2.175 ± 0.005M/s
> >   uretprobe-push :    2.109 ± 0.003M/s
> >   uretprobe-ret  :    0.945 ± 0.002M/s
> >   uretprobe-nop5 :    3.530 ± 0.006M/s
> >   usdt_nop       :    3.235 ± 0.008M/s   <-- added
> >   usdt_nop_combo :    7.511 ± 0.045M/s   <-- added
> 
> consistency, usdt-nop. And for nop_combo I'd use usdt-nop5, that combo
> doesn't matter for performance beyond the fact that we have nop5 there

ok

SNIP

> > +static void usdt_setup(const char *name)
> > +{
> > +       struct bpf_link *link;
> > +       int err;
> > +
> > +       setup_libbpf();
> > +
> > +       ctx.skel = trigger_bench__open();
> > +       if (!ctx.skel) {
> > +               fprintf(stderr, "failed to open skeleton\n");
> > +               exit(1);
> > +       }
> > +
> > +       bpf_program__set_autoload(ctx.skel->progs.bench_trigger_usdt, true);
> > +
> > +       err = trigger_bench__load(ctx.skel);
> > +       if (err) {
> > +               fprintf(stderr, "failed to load skeleton\n");
> > +               exit(1);
> > +       }
> > +
> > +       link = bpf_program__attach_usdt(ctx.skel->progs.bench_trigger_usdt,
> > +                                       0 /*self*/, "/proc/self/exe",
> > +                                       "optimized_attach", name, NULL);
> > +       if (libbpf_get_error(link)) {
> > +               fprintf(stderr, "failed to attach optimized_attach:%s usdt probe\n", name);
> > +               exit(1);
> > +       }
> > +       ctx.skel->links.bench_trigger_usdt = link;
> > +}
> > +
> > +static void usdt_nop_setup(void)
> > +{
> > +       usdt_setup("usdt_1");
> > +}
> > +
> > +static void usdt_nop_combo_setup(void)
> > +{
> > +       usdt_setup("usdt_2");
> > +}
> >  #endif
> >
> >  const struct bench bench_trig_syscall_count = {
> > @@ -609,4 +667,6 @@ BENCH_TRIG_USERMODE(uprobe_nop5, nop5, "uprobe-nop5");
> >  BENCH_TRIG_USERMODE(uretprobe_nop5, nop5, "uretprobe-nop5");
> >  BENCH_TRIG_USERMODE(uprobe_multi_nop5, nop5, "uprobe-multi-nop5");
> >  BENCH_TRIG_USERMODE(uretprobe_multi_nop5, nop5, "uretprobe-multi-nop5");
> > +BENCH_TRIG_USERMODE(usdt_nop, usdt_nop, "usdt_nop");
> > +BENCH_TRIG_USERMODE(usdt_nop_combo, usdt_nop_combo, "usdt_nop_combo");
> >  #endif
> > diff --git a/tools/testing/selftests/bpf/benchs/run_bench_uprobes.sh b/tools/testing/selftests/bpf/benchs/run_bench_uprobes.sh
> > index 03f55405484b..3656676d99d2 100755
> > --- a/tools/testing/selftests/bpf/benchs/run_bench_uprobes.sh
> > +++ b/tools/testing/selftests/bpf/benchs/run_bench_uprobes.sh
> > @@ -2,7 +2,7 @@
> >
> >  set -eufo pipefail
> >
> > -for i in usermode-count syscall-count {uprobe,uretprobe}-{nop,push,ret,nop5}
> > +for i in usermode-count syscall-count {uprobe,uretprobe}-{nop,push,ret,nop5} usdt_nop usdt_nop_combo
> 
> usdt_{nop,nop5}, consistency ;)

ook, will change

thanks,
jirka

      reply	other threads:[~2026-02-12 14:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11  8:48 [PATCHv3 bpf-next 0/5] libbpf: Make optimized uprobes backward compatible Jiri Olsa
2026-02-11  8:48 ` [PATCHv3 bpf-next 1/5] selftests/bpf: Emit nop,nop5 instructions combo for x86_64 arch Jiri Olsa
2026-02-11  8:48 ` [PATCHv3 bpf-next 2/5] libbpf: Add uprobe syscall feature detection Jiri Olsa
2026-02-11 21:45   ` Andrii Nakryiko
2026-02-12 14:08     ` Jiri Olsa
2026-02-11  8:48 ` [PATCHv3 bpf-next 3/5] libbpf: Add support to detect nop,nop5 instructions combo for usdt probe Jiri Olsa
2026-02-11 21:45   ` Andrii Nakryiko
2026-02-12 14:08     ` Jiri Olsa
2026-02-11  8:48 ` [PATCHv3 bpf-next 4/5] selftests/bpf: Add test for checking correct nop of optimized usdt Jiri Olsa
2026-02-11  9:13   ` bot+bpf-ci
2026-02-11 21:45   ` Andrii Nakryiko
2026-02-12 14:10     ` Jiri Olsa
2026-02-11  8:48 ` [PATCHv3 bpf-next 5/5] selftests/bpf: Add usdt trigger bench Jiri Olsa
2026-02-11 21:45   ` Andrii Nakryiko
2026-02-12 14:09     ` Jiri Olsa [this message]

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=aY3fImpJnH6R2mKV@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kernel@vger.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.