On Fri, Dec 13, 2024 at 01:57:56PM -0800, Andrii Nakryiko wrote:
> On Wed, Dec 11, 2024 at 5:36 AM Jiri Olsa <[email protected]> wrote:
> >
> > Add 5-byte nop uprobe trigger bench (x86_64 specific) to measure
> > uprobes/uretprobes on top of nop5 instruction.
> >
> > Signed-off-by: Jiri Olsa <[email protected]>
> > ---
> >  tools/testing/selftests/bpf/bench.c           | 12 ++++++
> >  .../selftests/bpf/benchs/bench_trigger.c      | 42 +++++++++++++++++++
> >  .../selftests/bpf/benchs/run_bench_uprobes.sh |  2 +-
> >  3 files changed, 55 insertions(+), 1 deletion(-)
> >
> 
> [...]
> 
> >  static void usetup(bool use_retprobe, bool use_multi, void *target_addr)
> >  {
> >         size_t uprobe_offset;
> > @@ -448,6 +462,28 @@ static void uretprobe_multi_ret_setup(void)
> >         usetup(true, true /* use_multi */, &uprobe_target_ret);
> >  }
> >
> > +#ifdef __x86_64__
> > +static void uprobe_nop5_setup(void)
> > +{
> > +       usetup(false, false /* !use_multi */, &uprobe_target_nop5);
> > +}
> > +
> > +static void uretprobe_nop5_setup(void)
> > +{
> > +       usetup(false, false /* !use_multi */, &uprobe_target_nop5);
> > +}
> 
> true /* use_retprobe */
> 
> that's the problem with bench setup, right?

yes, but there's more ;-)

we also need change in arch_uretprobe_hijack_return_addr to skip
the extra 3 values (pushed on stack by the uprobe trampoline) when
hijacking the returm value, I'll send new version

jirka

> 
> > +
> > +static void uprobe_multi_nop5_setup(void)
> > +{
> > +       usetup(false, true /* use_multi */, &uprobe_target_nop5);
> > +}
> > +
> > +static void uretprobe_multi_nop5_setup(void)
> > +{
> > +       usetup(false, true /* use_multi */, &uprobe_target_nop5);
> > +}
> > +#endif
> > +
> >  const struct bench bench_trig_syscall_count = {
> >         .name = "trig-syscall-count",
> >         .validate = trigger_validate,
> 
> [...]

Reply via email to