From: Tengda Wu <wutengda@huaweicloud.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
Tengda Wu <wutengda@huaweicloud.com>
Subject: [PATCH v2 0/2] ring-buffer: Fix snapshot swap race and improve user experience
Date: Mon, 3 Aug 2026 00:56:38 +0000 [thread overview]
Message-ID: <20260803005640.2445666-1-wutengda@huaweicloud.com> (raw)
Patch 1 fixes a race condition in ring_buffer_swap_cpu() where the
committing counter check can be bypassed during a write operation,
leading to inconsistent buffer state and a RB_WARN_ON. The fix uses
current_context instead, which remains valid throughout the entire
write.
Patch 2 improves the snapshot user experience by using work_on_cpu()
instead of smp_call_function_single(), ensuring the swap only occurs
after any ongoing write completes and avoiding confusing -EBUSY errors.
Changelog:
v2: Add fix patch for ring_buffer_swap_cpu(). (Steven)
Reorganize commit messages and Fixes tags.
v1: https://lore.kernel.org/all/20260730011912.2325121-1-wutengda@huaweicloud.com/
Tengda Wu (2):
ring-buffer: Use current_context for safe per-CPU buffer swap
tracing/snapshot: Use work_on_cpu to avoid -EBUSY during snapshot swap
kernel/trace/ring_buffer.c | 8 ++++----
kernel/trace/trace_snapshot.c | 8 +++++---
2 files changed, 9 insertions(+), 7 deletions(-)
--
2.34.1
next reply other threads:[~2026-08-03 0:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 0:56 Tengda Wu [this message]
2026-08-03 0:56 ` [PATCH v2 1/2] ring-buffer: Use current_context for safe per-CPU buffer swap Tengda Wu
2026-08-03 0:56 ` [PATCH v2 2/2] tracing/snapshot: Use work_on_cpu to avoid -EBUSY during snapshot swap Tengda Wu
2026-08-08 14:58 ` Steven Rostedt
2026-08-08 15:00 ` Steven Rostedt
2026-08-10 13:13 ` Tengda Wu
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=20260803005640.2445666-1-wutengda@huaweicloud.com \
--to=wutengda@huaweicloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.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