OSDN Git Service

ring-buffer: Don't deactivate the ring buffer on failed iterator reads
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 13 May 2020 19:18:01 +0000 (15:18 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 14 May 2020 12:50:51 +0000 (08:50 -0400)
commit3d2353de81061cab4b9d68b3e1dc69cbec1451ea
tree9e21cf5cfd7cb3a7b4e5eb7974101b6ef6b76448
parent59566b0b622e3e6ea928c0b8cac8a5601b00b383
ring-buffer: Don't deactivate the ring buffer on failed iterator reads

If the function tracer is running and the trace file is read (which uses the
ring buffer iterator), the iterator can get in sync with the writes, and
caues it to fail to find a page with content it can read three times. This
causes a warning and deactivation of the ring buffer code.

Looking at the other cases of failure to get an event, it appears that
there's a chance that the writer could cause them too. Since the iterator is
a "best effort" to read the ring buffer if there's an active writer (the
consumer reader is made for this case "see trace_pipe"), if it fails to get
an event after three tries, simply give up and return NULL. Don't warn, nor
disable the ring buffer on this failure.

Link: https://lore.kernel.org/r/20200429090508.GG5770@shao2-debian
Reported-by: kernel test robot <lkp@intel.com>
Fixes: ff84c50cfb4b ("ring-buffer: Do not die if rb_iter_peek() fails more than thrice")
Tested-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ring_buffer.c