Skip to content

tracing: Fixes for v6.7-rc7

Steven Rostedt lkml stable 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ring-buffer: Fix wake ups when buffer_percent is set to 100kernel/trace/ring_buffer.c+7 -20 replies
2/3tracing: Fix blocked reader of snapshot bufferkernel/trace/ring_buffer.c kernel/trace/trace.c+19 -40 replies
3/3ftrace: Fix modification of direct_function hash while in usekernel/trace/ftrace.c+47 -530 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchMasami Hiramatsu (Google)
1/3A-b
2/3A-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [for-linus][PATCH 0/3] tracing: Fixes for v6.7-rc7

tracing fixes for v6.7-rc7:

- Fix readers on blocked on the ring buffer when buffer_percent is 100%. They are supposed to wake up when the buffer is full, but because the sub-buffer that the writer is on is never considered "dirty" in the calculation, dirty pages will never equal nr_page. Add +1 to the dirty count in order to count for the sub-buffer that the writer is on.

- When a reader is blocked on the "snapshot_raw" file, it is to be woken up when a snapshot is done and be able to read the snapshot buffer. But because the snapshot swaps the buffers (the main one with the snapshot one), and the snapshot reader is waiting on the old snapshot buffer, it was not woken up (because it is now on the main buffer after the swap). Worse yet, when it reads the buffer after a snapshot, it's not reading the snapshot buffer, it's reading the live active main buffer.

Fix this by forcing a wakeup of all readers on the snapshot buffer when a new snapshot happens, and then update the buffer that the reader is reading to be back on the snapshot buffer.

- Fix the modification of the direct_function hash. There was a race when new functions were added to the direct_function hash as when it moved function entries from the old hash to the new one, a direct function trace could be hit and not see its entry.

This is fixed by allocating the new hash, copy all the old entries onto it as well as the new entries, and then use rcu_assign_pointer() to update the new direct_function hash with it.

This also fixes a memory leak in that code.

Steven Rostedt (Google) (3):
ring-buffer: Fix wake ups when buffer_percent is set to 100
tracing: Fix blocked reader of snapshot buffer
ftrace: Fix modification of direct_function hash while in use

----

 kernel/trace/ftrace.c      | 100 +++++++++++++++++++++------------------------
 kernel/trace/ring_buffer.c |  12 ++++--
 kernel/trace/trace.c       |  20 +++++++--
 3 files changed, 73 insertions(+), 59 deletions(-)