[PATCH bpf-next 0/4] libbpf: Make optimized uprobes backward compatible

From: Jiri Olsa
Date: Mon Nov 17 2025 - 03:36:20 EST


hi,
we can currently optimize uprobes on top of nop5 instructions,
so application can define USDT_NOP to nop5 and use USDT macro
to define optimized usdt probes.

This works fine on new kernels, but could have performance penalty
on older kernels, that do not have the support to optimize and to
emulate nop5 instruction.

This patchset adds support to workaround the performance penalty
on older kernels that do not support uprobe optimization, please
see detailed description in patch 1.

Note patch 1 will need to get pushed to libbpf/usdt [1] as well.

thanks,
jirka


[1] https://github.com/libbpf/usdt
---
Jiri Olsa (4):
selftests/bpf: Emit nop,nop5 instructions for x86_64 usdt probe
libbpf: Add uprobe syscall feature detection
libbpf: Add support to parse extra info in usdt note record
selftests/bpf: Add test for checking correct nop of optimized usdt

tools/lib/bpf/features.c | 22 ++++++++++++++++++++++
tools/lib/bpf/libbpf_internal.h | 2 ++
tools/lib/bpf/usdt.c | 27 ++++++++++++++++++++++++++-
tools/testing/selftests/bpf/.gitignore | 2 ++
tools/testing/selftests/bpf/Makefile | 7 ++++++-
tools/testing/selftests/bpf/prog_tests/usdt.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/testing/selftests/bpf/progs/test_usdt.c | 9 +++++++++
tools/testing/selftests/bpf/usdt.h | 17 +++++++++++++++++
tools/testing/selftests/bpf/usdt_1.c | 14 ++++++++++++++
tools/testing/selftests/bpf/usdt_2.c | 13 +++++++++++++
10 files changed, 193 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/selftests/bpf/usdt_1.c
create mode 100644 tools/testing/selftests/bpf/usdt_2.c