Re: [PATCH bpf-next 13/13] selftests/bpf: Add 5-byte nop uprobe trigger bench

Andrii Nakryiko
2024-12-13T21:58:09Z

On Wed, Dec 11, 2024 at 5:36 AM Jiri Olsa <jolsa@kernel.org> 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 <jolsa@kernel.org>
> ---
> 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?

> +
> +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, …