[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200424061755.436559-1-songliubraving@fb.com>
Date: Thu, 23 Apr 2020 23:17:52 -0700
From: Song Liu <songliubraving@...com>
To: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>
CC: <ast@...nel.org>, <daniel@...earbox.net>, <kernel-team@...com>,
Song Liu <songliubraving@...com>
Subject: [PATCH v4 bpf-next 0/3] bpf: sharing bpf runtime stats with
run_time_ns is a useful stats for BPF programs. However, it is gated by
sysctl kernel.bpf_stats_enabled. When multiple user space tools are
toggling kernl.bpf_stats_enabled at the same time, they may confuse each
other.
Solve this problem with a new BPF command BPF_ENABLE_STATS.
Changes v3 => v4:
1. Add libbpf support and selftest;
2. Avoid cleaning trailing space.
Changes v2 => v3:
1. Rename the command to BPF_ENABLE_STATS, and make it extendible.
2. fix commit log;
3. remove unnecessary headers.
Changes RFC => v2:
1. Add a new bpf command instead of /dev/bpf_stats;
2. Remove the jump_label patch, which is no longer needed;
3. Add a static variable to save previous value of the sysctl.
Song Liu (3):
bpf: sharing bpf runtime stats with BPF_ENABLE_STATS
libbpf: add support for command BPF_ENABLE_STATS
bpf: add selftest for BPF_ENABLE_STATS
include/linux/bpf.h | 1 +
include/uapi/linux/bpf.h | 11 ++++
kernel/bpf/syscall.c | 50 +++++++++++++++++++
kernel/sysctl.c | 36 ++++++++++++-
tools/include/uapi/linux/bpf.h | 11 ++++
tools/lib/bpf/bpf.c | 9 ++++
tools/lib/bpf/bpf.h | 1 +
tools/lib/bpf/libbpf.map | 5 ++
.../selftests/bpf/prog_tests/enable_stats.c | 45 +++++++++++++++++
.../selftests/bpf/progs/test_enable_stats.c | 28 +++++++++++
10 files changed, 196 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/enable_stats.c
create mode 100644 tools/testing/selftests/bpf/progs/test_enable_stats.c
--
2.24.1
Powered by blists - more mailing lists