bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andriin@fb.com>
To: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>, <ast@fb.com>,
	<daniel@iogearbox.net>
Cc: <andrii.nakryiko@gmail.com>, <kernel-team@fb.com>,
	Andrii Nakryiko <andriin@fb.com>
Subject: [PATCH bpf-next 0/4] Move BPF_PROG, BPF_KPROBE, and BPF_KRETPROBE to libbpf
Date: Sat, 29 Feb 2020 15:11:08 -0800	[thread overview]
Message-ID: <20200229231112.1240137-1-andriin@fb.com> (raw)

Move BPF_PROG, BPF_KPROBE, and BPF_KRETPROBE helper macros from private
selftests helpers to public libbpf ones. These helpers are extremely helpful
for writing tracing BPF applications and have been requested to be exposed for
easy use (e.g., [0]).

As part of this move, fix up BPF_KRETPROBE to not allow for capturing input
arguments (as it's unreliable and they will be often clobbered). Also, add
vmlinux.h header guard to allow multi-time inclusion, if necessary; but also
to let PT_REGS_PARM do proper detection of struct pt_regs field names on x86
arch. See relevant patches for more details.

  [0] https://github.com/iovisor/bcc/pull/2778#issue-381642907

Andrii Nakryiko (4):
  bpftool: add header guards to generated vmlinux.h
  libbpf: fix use of PT_REGS_PARM macros with vmlinux.h
  selftests/bpf: fix BPF_KRETPROBE macro and use it in attach_probe test
  libbpf: merge selftests' bpf_trace_helpers.h into libbpf's
    bpf_tracing.h

 tools/bpf/bpftool/btf.c                       |   5 +
 tools/lib/bpf/bpf_tracing.h                   | 120 +++++++++++++++++-
 tools/testing/selftests/bpf/bpf_tcp_helpers.h |   2 +-
 .../testing/selftests/bpf/bpf_trace_helpers.h | 120 ------------------
 tools/testing/selftests/bpf/progs/bpf_dctcp.c |   2 +-
 .../testing/selftests/bpf/progs/fentry_test.c |   2 +-
 .../selftests/bpf/progs/fexit_bpf2bpf.c       |   2 +-
 .../bpf/progs/fexit_bpf2bpf_simple.c          |   2 +-
 .../testing/selftests/bpf/progs/fexit_test.c  |   2 +-
 tools/testing/selftests/bpf/progs/kfree_skb.c |   2 +-
 .../selftests/bpf/progs/test_attach_probe.c   |   3 +-
 .../selftests/bpf/progs/test_overhead.c       |   7 +-
 .../selftests/bpf/progs/test_perf_branches.c  |   2 +-
 .../selftests/bpf/progs/test_perf_buffer.c    |   2 +-
 .../selftests/bpf/progs/test_probe_user.c     |   1 -
 .../bpf/progs/test_trampoline_count.c         |   3 +-
 .../selftests/bpf/progs/test_xdp_bpf2bpf.c    |   2 +-
 17 files changed, 140 insertions(+), 139 deletions(-)
 delete mode 100644 tools/testing/selftests/bpf/bpf_trace_helpers.h

-- 
2.17.1


             reply	other threads:[~2020-02-29 23:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-29 23:11 Andrii Nakryiko [this message]
2020-02-29 23:11 ` [PATCH bpf-next 1/4] bpftool: add header guards to generated vmlinux.h Andrii Nakryiko
2020-02-29 23:11 ` [PATCH bpf-next 2/4] libbpf: fix use of PT_REGS_PARM macros with vmlinux.h Andrii Nakryiko
2020-02-29 23:11 ` [PATCH bpf-next 3/4] selftests/bpf: fix BPF_KRETPROBE macro and use it in attach_probe test Andrii Nakryiko
2020-02-29 23:11 ` [PATCH bpf-next 4/4] libbpf: merge selftests' bpf_trace_helpers.h into libbpf's bpf_tracing.h Andrii Nakryiko
2020-03-03  0:30 ` [PATCH bpf-next 0/4] Move BPF_PROG, BPF_KPROBE, and BPF_KRETPROBE to libbpf Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200229231112.1240137-1-andriin@fb.com \
    --to=andriin@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).