All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v5 0/3] libbpf: Add support for dynamic program attach target
@ 2020-02-20 13:26 Eelco Chaudron
  2020-02-20 13:26 ` [PATCH bpf-next v5 1/3] libbpf: Bump libpf current version to v0.0.8 Eelco Chaudron
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Eelco Chaudron @ 2020-02-20 13:26 UTC (permalink / raw)
  To: bpf; +Cc: davem, netdev, ast, daniel, kafai, songliubraving, yhs, andriin,
	toke

Currently when you want to attach a trace program to a bpf program
the section name needs to match the tracepoint/function semantics.

However the addition of the bpf_program__set_attach_target() API
allows you to specify the tracepoint/function dynamically.

The call flow would look something like this:

  xdp_fd = bpf_prog_get_fd_by_id(id);
  trace_obj = bpf_object__open_file("func.o", NULL);
  prog = bpf_object__find_program_by_title(trace_obj,
                                           "fentry/myfunc");
  bpf_program__set_expected_attach_type(prog, BPF_TRACE_FENTRY);
  bpf_program__set_attach_target(prog, xdp_fd,
                                 "xdpfilt_blk_all");
  bpf_object__load(trace_obj)

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>

v1 -> v2: Remove requirement for attach type hint in API
v2 -> v3: Moved common warning to __find_vmlinux_btf_id, requested by Andrii
          Updated the xdp_bpf2bpf test to use this new API
v3 -> v4: Split up patch, update libbpf.map version
v4 -> v5: Fix return code, and prog assignment in test case


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

end of thread, other threads:[~2020-02-21  1:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-20 13:26 [PATCH bpf-next v5 0/3] libbpf: Add support for dynamic program attach target Eelco Chaudron
2020-02-20 13:26 ` [PATCH bpf-next v5 1/3] libbpf: Bump libpf current version to v0.0.8 Eelco Chaudron
2020-02-20 13:26 ` [PATCH bpf-next v5 2/3] libbpf: Add support for dynamic program attach target Eelco Chaudron
2020-02-20 13:26 ` [PATCH bpf-next v5 3/3] selftests/bpf: update xdp_bpf2bpf test to use new set_attach_target API Eelco Chaudron
2020-02-20 17:29   ` Andrii Nakryiko
2020-02-21  1:53 ` [PATCH bpf-next v5 0/3] libbpf: Add support for dynamic program attach target Alexei Starovoitov

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.