Re: [RFC PATCH v2 0/3] trace: stack trace deduplication for ftrace ring buffer
From: Li Pengfei
Date: Mon May 25 2026 - 03:40:14 EST
Hi Masami,
I went through the Sashiko comments on v2 [1]. Per-finding response
below; v3 will incorporate the fixes.
[1] https://sashiko.dev/#/patchset/20260522104017.1668638-1-lipengfei28%40xiaomi.com
Patch 1/3:
- memset() torn reads against lockless readers: agreed, the
reset path is not well serialized against tracefs readers.
Will tighten slow-path synchronization in v3.
- seq_next() not advancing *pos on EOF: agreed, will fix in v3.
- atomic_read(&resetting) without acquire: agreed, will switch
to atomic_read_acquire() in v3.
- Plain reads of entry->key: agreed, will use READ_ONCE() in v3.
- atomic64_inc() in NMI-safe hot path on 32-bit GENERIC_ATOMIC64:
agreed, will move the counters off the hot path (local_t /
per-CPU) in v3.
Patch 2/3:
- TRACE_STACK_ID not in trace_valid_entry(): agreed, will add in v3.
- "NULL from kzalloc" comment: wording bug, will correct in v3.
- Reset memset synchronization: same fix as patch 1, finding 1.
Patch 3/3:
- Selftest missing 'function:tracer' in '# requires:': agreed,
will add in v3.
- Selftest wiping the ring buffer via 'echo nop > current_tracer'
before reading trace: agreed, will reorder in v3.
I'll send v3 once the changes are tested.
Pengfei