[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250804022101.2171981-1-xukuohai@huaweicloud.com>
Date: Mon, 4 Aug 2025 10:20:56 +0800
From: Xu Kuohai <xukuohai@...weicloud.com>
To: bpf@...r.kernel.org,
linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>,
Yonghong Song <yhs@...com>,
Song Liu <song@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>,
Mykola Lysenko <mykolal@...com>,
Shuah Khan <shuah@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>,
Willem de Bruijn <willemb@...gle.com>,
Jason Xing <kerneljasonxing@...il.com>,
Paul Chaignon <paul.chaignon@...il.com>,
Tao Chen <chen.dylane@...ux.dev>,
Kumar Kartikeya Dwivedi <memxor@...il.com>,
Martin Kelly <martin.kelly@...wdstrike.com>
Subject: [PATCH bpf-next 0/4] Add overwrite mode for bpf ring buffer
From: Xu Kuohai <xukuohai@...wei.com>
When the bpf ring buffer is full, new events can not be recorded util
the consumer consumes some events to free space. This may cause critical
events to be discarded, such as in fault diagnostic, where recent events
are more critical than older ones.
So add ovewrite mode for bpf ring buffer. In this mode, the new event
overwrites the oldest event when the buffer is full.
Xu Kuohai (4):
bpf: Add overwrite mode for bpf ring buffer
libbpf: ringbuf: Add overwrite ring buffer process
selftests/bpf: Add test for overwrite ring buffer
selftests/bpf/benchs: Add overwrite mode bench for rb-libbpf
include/uapi/linux/bpf.h | 4 +
kernel/bpf/ringbuf.c | 159 +++++++++++++++---
tools/include/uapi/linux/bpf.h | 4 +
tools/lib/bpf/ringbuf.c | 103 +++++++++++-
tools/testing/selftests/bpf/Makefile | 3 +-
.../selftests/bpf/benchs/bench_ringbufs.c | 22 ++-
.../bpf/benchs/run_bench_ringbufs.sh | 4 +
.../selftests/bpf/prog_tests/ringbuf.c | 74 ++++++++
.../bpf/progs/test_ringbuf_overwrite.c | 98 +++++++++++
9 files changed, 442 insertions(+), 29 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/test_ringbuf_overwrite.c
--
2.43.0
Powered by blists - more mailing lists