The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ring-buffer: Fix snapshot swap race and improve user experience
@ 2026-08-03  0:56 Tengda Wu
  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
  0 siblings, 2 replies; 5+ messages in thread
From: Tengda Wu @ 2026-08-03  0:56 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu
  Cc: Mathieu Desnoyers, linux-trace-kernel, linux-kernel, Tengda Wu

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-08 15:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03  0:56 [PATCH v2 0/2] ring-buffer: Fix snapshot swap race and improve user experience Tengda Wu
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox