]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ring-buffer: Enforce read ordering of trace_buffer cpumask and buffers
authorVincent Donnefort <vdonnefort@google.com>
Wed, 1 Apr 2026 05:36:59 +0000 (06:36 +0100)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 2 Apr 2026 17:19:09 +0000 (13:19 -0400)
commit20ad8b0888be392eb2c4c3654805eb8594952373
tree4c411e860788af364c1336bb58a7e9dc0b496b8e
parent23d1cfc0216e28140cb0c914814c03d127a3ad6e
ring-buffer: Enforce read ordering of trace_buffer cpumask and buffers

On CPU hotplug, if it is the first time a trace_buffer sees a CPU, a
ring_buffer_per_cpu will be allocated and its corresponding bit toggled
in the cpumask. Many readers check this cpumask to know if they can
safely read the ring_buffer_per_cpu but they are doing so without memory
ordering and may observe the cpumask bit set while having NULL buffer
pointer.

Enforce the memory read ordering by sending an IPI to all online CPUs.
The hotplug path is a slow-path anyway and it saves us from adding read
barriers in numerous call sites.

Link: https://patch.msgid.link/20260401053659.3458961-1-vdonnefort@google.com
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Suggested-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/ring_buffer.c