diff options
author | Yonghong Song <yhs@fb.com> | 2017-12-11 22:39:03 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2017-12-12 19:46:40 +0300 |
commit | d279f1f8c64711ca986c3121c8ec811b892932f0 (patch) | |
tree | e7cc1c25702aec28b2fb89842e4ccef512d9582f /tools/testing/selftests/bpf/test_tracepoint.c | |
parent | f371b304f12e31fe30207c41ca7754564e0ea4dc (diff) | |
download | linux-d279f1f8c64711ca986c3121c8ec811b892932f0.tar.xz |
bpf/tracing: add a bpf test for new ioctl query interface
Added a subtest in test_progs. The tracepoint is
sched/sched_switch. Multiple bpf programs are attached to
this tracepoint and the query interface is exercised.
Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/test_tracepoint.c')
-rw-r--r-- | tools/testing/selftests/bpf/test_tracepoint.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_tracepoint.c b/tools/testing/selftests/bpf/test_tracepoint.c new file mode 100644 index 000000000000..04bf084517e0 --- /dev/null +++ b/tools/testing/selftests/bpf/test_tracepoint.c @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2017 Facebook + +#include <linux/bpf.h> +#include "bpf_helpers.h" + +/* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format */ +struct sched_switch_args { + unsigned long long pad; + char prev_comm[16]; + int prev_pid; + int prev_prio; + long long prev_state; + char next_comm[16]; + int next_pid; + int next_prio; +}; + +SEC("tracepoint/sched/sched_switch") +int oncpu(struct sched_switch_args *ctx) +{ + return 0; +} + +char _license[] SEC("license") = "GPL"; +__u32 _version SEC("version") = 1; /* ignored by tracepoints, required by libbpf.a */ |