]> git.baikalelectronics.ru Git - kernel.git/commit
ring-buffer: Protect ring_buffer_reset() from reentrancy
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Mon, 8 Nov 2021 15:58:10 +0000 (10:58 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 10 Nov 2021 16:56:29 +0000 (11:56 -0500)
commit39d1407859f09ea8b619b2a032420adda20ccf8a
tree927fc7cdc4c52ab709ddd9e6ce0b97eb19d02d7e
parent65b16805e5f5a6541fa80afa7a225a3b0c94a972
ring-buffer: Protect ring_buffer_reset() from reentrancy

The resetting of the entire ring buffer use to simply go through and reset
each individual CPU buffer that had its own protection and synchronization.
But this was very slow, due to performing a synchronization for each CPU.
The code was reshuffled to do one disabling of all CPU buffers, followed
by a single RCU synchronization, and then the resetting of each of the CPU
buffers. But unfortunately, the mutex that prevented multiple occurrences
of resetting the buffer was not moved to the upper function, and there is
nothing to protect from it.

Take the ring buffer mutex around the global reset.

Cc: stable@vger.kernel.org
Fixes: 93b8a3ed58c03 ("ring-buffer: speed up buffer resets by avoiding synchronize_rcu for each CPU")
Reported-by: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ring_buffer.c