From: Alexei Starovoitov <ast@kernel.org>
To: davem@davemloft.net
Cc: daniel@iogearbox.net, torvalds@linux-foundation.org,
peterz@infradead.org, mingo@kernel.org, rostedt@goodmis.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, linux-api@vger.kernel.org
Subject: [PATCH bpf-next 0/5] bpf, tracing: introduce bpf raw tracepoints
Date: Wed, 28 Feb 2018 20:19:52 -0800 [thread overview]
Message-ID: <20180301041957.399230-1-ast@kernel.org> (raw)
This patch set is a different way to address the pressing need to access
task_struct pointers in sched tracepoints from bpf programs.
The first approach simply added these pointers to sched tracepoints:
https://lkml.org/lkml/2017/12/14/753
which Peter nacked.
Few options were discussed and eventually the discussion converged on
doing bpf specific tracepoint_probe_register() probe functions.
Details here:
https://lkml.org/lkml/2017/12/20/929
Patch 1 is kernel wide cleanup of pass-struct-by-value into
pass-struct-by-reference into tracepoints.
Patch 2 minor prep work to expose number of arguments passed
into tracepoints.
Patch 3 introduces BPF_RAW_TRACEPOINT api.
the auto-cleanup and multiple concurrent users are must have
features of tracing api. For bpf raw tracepoints it looks like:
// load bpf prog with BPF_PROG_TYPE_RAW_TRACEPOINT type
prog_fd = bpf_prog_load(...);
// receive anon_inode fd for given bpf_raw_tracepoint
raw_tp_fd = bpf_raw_tracepoint_open("xdp_exception");
// attach bpf program to given tracepoint
bpf_prog_attach(prog_fd, raw_tp_fd, BPF_RAW_TRACEPOINT);
Ctrl-C of tracing daemon or cmdline tool will automatically
detach bpf program, unload it and unregister tracepoint probe.
More details in patch 3.
Patch 4, 5 - user space lib and tests
samples/bpf/test_overhead performance on 1 cpu:
tracepoint base kprobe+bpf tracepoint+bpf raw_tracepoint+bpf
task_rename 1.1M 769K 947K 1.0M
urandom_read 789K 697K 750K 755K
Alexei Starovoitov (5):
treewide: remove struct-pass-by-value from tracepoints arguments
tracepoint: compute num_args at build time
bpf: introduce BPF_RAW_TRACEPOINT
libbpf: add bpf_raw_tracepoint_open helper
samples/bpf: raw tracepoint test
arch/x86/xen/mmu_pv.c | 16 +--
drivers/gpu/drm/i915/i915_trace.h | 13 +-
drivers/infiniband/hw/hfi1/file_ops.c | 2 +-
drivers/infiniband/hw/hfi1/trace_ctxts.h | 12 +-
drivers/s390/cio/ioasm.c | 18 +--
drivers/s390/cio/trace.h | 50 ++++----
fs/dax.c | 2 +-
include/linux/bpf_types.h | 1 +
include/linux/trace_events.h | 57 +++++++++
include/linux/tracepoint-defs.h | 1 +
include/linux/tracepoint.h | 32 +++--
include/trace/bpf_probe.h | 87 +++++++++++++
include/trace/define_trace.h | 15 ++-
include/trace/events/f2fs.h | 2 +-
include/trace/events/fs_dax.h | 6 +-
include/trace/events/rcu.h | 4 +-
include/trace/events/xen.h | 32 ++---
include/uapi/linux/bpf.h | 11 ++
kernel/bpf/syscall.c | 108 ++++++++++++++++
kernel/rcu/tree.c | 10 +-
kernel/trace/bpf_trace.c | 211 +++++++++++++++++++++++++++++++
kernel/tracepoint.c | 27 ++--
net/wireless/trace.h | 2 +-
samples/bpf/Makefile | 1 +
samples/bpf/bpf_load.c | 13 ++
samples/bpf/test_overhead_raw_tp_kern.c | 17 +++
samples/bpf/test_overhead_user.c | 12 ++
sound/firewire/amdtp-stream-trace.h | 2 +-
tools/include/uapi/linux/bpf.h | 11 ++
tools/lib/bpf/bpf.c | 10 ++
tools/lib/bpf/bpf.h | 1 +
31 files changed, 677 insertions(+), 109 deletions(-)
create mode 100644 include/trace/bpf_probe.h
create mode 100644 samples/bpf/test_overhead_raw_tp_kern.c
--
2.9.5
WARNING: multiple messages have this Message-ID (diff)
From: Alexei Starovoitov <ast@kernel.org>
To: <davem@davemloft.net>
Cc: <daniel@iogearbox.net>, <torvalds@linux-foundation.org>,
<peterz@infradead.org>, <mingo@kernel.org>, <rostedt@goodmis.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<kernel-team@fb.com>, <linux-api@vger.kernel.org>
Subject: [PATCH bpf-next 0/5] bpf, tracing: introduce bpf raw tracepoints
Date: Wed, 28 Feb 2018 20:19:52 -0800 [thread overview]
Message-ID: <20180301041957.399230-1-ast@kernel.org> (raw)
This patch set is a different way to address the pressing need to access
task_struct pointers in sched tracepoints from bpf programs.
The first approach simply added these pointers to sched tracepoints:
https://lkml.org/lkml/2017/12/14/753
which Peter nacked.
Few options were discussed and eventually the discussion converged on
doing bpf specific tracepoint_probe_register() probe functions.
Details here:
https://lkml.org/lkml/2017/12/20/929
Patch 1 is kernel wide cleanup of pass-struct-by-value into
pass-struct-by-reference into tracepoints.
Patch 2 minor prep work to expose number of arguments passed
into tracepoints.
Patch 3 introduces BPF_RAW_TRACEPOINT api.
the auto-cleanup and multiple concurrent users are must have
features of tracing api. For bpf raw tracepoints it looks like:
// load bpf prog with BPF_PROG_TYPE_RAW_TRACEPOINT type
prog_fd = bpf_prog_load(...);
// receive anon_inode fd for given bpf_raw_tracepoint
raw_tp_fd = bpf_raw_tracepoint_open("xdp_exception");
// attach bpf program to given tracepoint
bpf_prog_attach(prog_fd, raw_tp_fd, BPF_RAW_TRACEPOINT);
Ctrl-C of tracing daemon or cmdline tool will automatically
detach bpf program, unload it and unregister tracepoint probe.
More details in patch 3.
Patch 4, 5 - user space lib and tests
samples/bpf/test_overhead performance on 1 cpu:
tracepoint base kprobe+bpf tracepoint+bpf raw_tracepoint+bpf
task_rename 1.1M 769K 947K 1.0M
urandom_read 789K 697K 750K 755K
Alexei Starovoitov (5):
treewide: remove struct-pass-by-value from tracepoints arguments
tracepoint: compute num_args at build time
bpf: introduce BPF_RAW_TRACEPOINT
libbpf: add bpf_raw_tracepoint_open helper
samples/bpf: raw tracepoint test
arch/x86/xen/mmu_pv.c | 16 +--
drivers/gpu/drm/i915/i915_trace.h | 13 +-
drivers/infiniband/hw/hfi1/file_ops.c | 2 +-
drivers/infiniband/hw/hfi1/trace_ctxts.h | 12 +-
drivers/s390/cio/ioasm.c | 18 +--
drivers/s390/cio/trace.h | 50 ++++----
fs/dax.c | 2 +-
include/linux/bpf_types.h | 1 +
include/linux/trace_events.h | 57 +++++++++
include/linux/tracepoint-defs.h | 1 +
include/linux/tracepoint.h | 32 +++--
include/trace/bpf_probe.h | 87 +++++++++++++
include/trace/define_trace.h | 15 ++-
include/trace/events/f2fs.h | 2 +-
include/trace/events/fs_dax.h | 6 +-
include/trace/events/rcu.h | 4 +-
include/trace/events/xen.h | 32 ++---
include/uapi/linux/bpf.h | 11 ++
kernel/bpf/syscall.c | 108 ++++++++++++++++
kernel/rcu/tree.c | 10 +-
kernel/trace/bpf_trace.c | 211 +++++++++++++++++++++++++++++++
kernel/tracepoint.c | 27 ++--
net/wireless/trace.h | 2 +-
samples/bpf/Makefile | 1 +
samples/bpf/bpf_load.c | 13 ++
samples/bpf/test_overhead_raw_tp_kern.c | 17 +++
samples/bpf/test_overhead_user.c | 12 ++
sound/firewire/amdtp-stream-trace.h | 2 +-
tools/include/uapi/linux/bpf.h | 11 ++
tools/lib/bpf/bpf.c | 10 ++
tools/lib/bpf/bpf.h | 1 +
31 files changed, 677 insertions(+), 109 deletions(-)
create mode 100644 include/trace/bpf_probe.h
create mode 100644 samples/bpf/test_overhead_raw_tp_kern.c
--
2.9.5
next reply other threads:[~2018-03-01 4:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 4:19 Alexei Starovoitov [this message]
2018-03-01 4:19 ` [PATCH bpf-next 0/5] bpf, tracing: introduce bpf raw tracepoints Alexei Starovoitov
2018-03-01 4:19 ` [PATCH bpf-next 1/5] treewide: remove struct-pass-by-value from tracepoints arguments Alexei Starovoitov
2018-03-01 4:19 ` Alexei Starovoitov
2018-03-01 4:19 ` [PATCH bpf-next 2/5] tracepoint: compute num_args at build time Alexei Starovoitov
2018-03-01 4:19 ` Alexei Starovoitov
2018-03-01 4:19 ` [PATCH bpf-next 3/5] bpf: introduce BPF_RAW_TRACEPOINT Alexei Starovoitov
2018-03-01 4:19 ` Alexei Starovoitov
2018-03-05 23:56 ` Daniel Borkmann
2018-03-06 1:28 ` Alexei Starovoitov
2018-03-06 1:28 ` Alexei Starovoitov
2018-03-01 4:19 ` [PATCH bpf-next 4/5] libbpf: add bpf_raw_tracepoint_open helper Alexei Starovoitov
2018-03-01 4:19 ` Alexei Starovoitov
2018-03-01 4:19 ` [PATCH bpf-next 5/5] samples/bpf: raw tracepoint test Alexei Starovoitov
2018-03-01 4:19 ` Alexei Starovoitov
2018-03-05 13:36 ` [PATCH bpf-next 0/5] bpf, tracing: introduce bpf raw tracepoints Daniel Borkmann
2018-03-05 21:11 ` Steven Rostedt
2018-03-06 10:35 ` Peter Zijlstra
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=20180301041957.399230-1-ast@kernel.org \
--to=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kernel-team@fb.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.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 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.