public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next 0/3] Add target-less tracing SEC() definitions
@ 2022-04-28 18:53 Andrii Nakryiko
  2022-04-28 18:53 ` [PATCH v2 bpf-next 1/3] libbpf: allow "incomplete" basic " Andrii Nakryiko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andrii Nakryiko @ 2022-04-28 18:53 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team, Delyan Kratunov, Jiri Olsa

Allow specifying "target-less" SEC() definitions for tracing BPF programs,
both non-BTF-backed (kprobes, tracepoints, raw tracepoints) and BTF-backed
(fentry/fexit, iter, lsm, etc).

There are various situations where attach target cannot be known at
compilation time, so libbpf's insistence on specifying something leads to
users having to add random test like SEC("kprobe/whatever") and then
specifying correct target at runtime using APIs like
bpf_program__attach_kprobe().

So this patch set improves ergonomics by allowing simple SEC() definitions
that define BPF program type and nothing else. Such programs won't be
auto-attachable, of course, but they also won't fail skeleton auto-attachment,
just like we do this for uprobes.

v1->v2:
  - rebased and added Song's acks.

Cc: Delyan Kratunov <delyank@fb.com>
Cc: Jiri Olsa <jolsa@kernel.org>

Andrii Nakryiko (3):
  libbpf: allow "incomplete" basic tracing SEC() definitions
  libbpf: support target-less SEC() definitions for BTF-backed programs
  selftests/bpf: use target-less SEC() definitions in various tests

 tools/lib/bpf/libbpf.c                        | 118 ++++++++++++------
 .../selftests/bpf/prog_tests/attach_probe.c   |  10 ++
 .../bpf/prog_tests/kprobe_multi_test.c        |  14 +--
 .../selftests/bpf/progs/kprobe_multi.c        |  14 +++
 .../selftests/bpf/progs/test_attach_probe.c   |  23 +++-
 .../selftests/bpf/progs/test_module_attach.c  |   2 +-
 6 files changed, 135 insertions(+), 46 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-28 21:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-28 18:53 [PATCH v2 bpf-next 0/3] Add target-less tracing SEC() definitions Andrii Nakryiko
2022-04-28 18:53 ` [PATCH v2 bpf-next 1/3] libbpf: allow "incomplete" basic " Andrii Nakryiko
2022-04-28 18:53 ` [PATCH v2 bpf-next 2/3] libbpf: support target-less SEC() definitions for BTF-backed programs Andrii Nakryiko
2022-04-28 18:53 ` [PATCH v2 bpf-next 3/3] selftests/bpf: use target-less SEC() definitions in various tests Andrii Nakryiko
2022-04-28 21:50 ` [PATCH v2 bpf-next 0/3] Add target-less tracing SEC() definitions patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox