Thread (6 messages) flat view 6 messages, 2 authors, 5d ago
COOLING5d

[PATCH v2 0/2] ring-buffer: Fix snapshot swap race and improve user experience

From: Tengda Wu <hidden>
Date: 2026-08-03 00:56:56
Also in: lkml

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/ (local)

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help