Skip to contentSkip to conversation

tracing: More updates for 5.11

PATCH New Steven Rostedt 1 participant 4 messages Dec 3, 2020

Subsystems (4)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover tracing: More updates for 5.11

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: 5b7be9c709e10e88531f1f81e1150bbad65be1aa

Lukas Bulwahn (1):
tracing: Clean up after filter logic rewriting

Steven Rostedt (VMware) (2):
ftrace/documentation: Fix RST C code blocks
ring-buffer: Add test to validate the time stamp deltas

----

 Documentation/trace/ftrace-uses.rst |   6 ++
 kernel/trace/Kconfig                |  20 +++++
 kernel/trace/ring_buffer.c          | 150 ++++++++++++++++++++++++++++++++++++
 kernel/trace/trace_events_filter.c  |  21 -----
 4 files changed, 176 insertions(+), 21 deletions(-)
author maintainer
#1 lore raw

PATCH 1/3 tracing: Clean up after filter logic rewriting

From: Lukas Bulwahn <[email protected]>

The functions event_{set,clear,}_no_set_filter_flag were only used in replace_system_preds() [now, renamed to process_system_preds()].

Commit 80765597bc58 ("tracing: Rewrite filter logic to be simpler and faster") removed the use of those functions in replace_system_preds().

Since then, the functions event_{set,clear,}_no_set_filter_flag were unused. Fortunately, make CC=clang W=1 indicates this with -Wunused-function warnings on those three functions.

So, clean up these obsolete unused functions.

---
 kernel/trace/trace_events_filter.c | 21 ---------------------
 1 file changed, 21 deletions(-)
kernel/trace/trace_events_filter.c +0 -21
index d0f515ac9b7c..e91259f6a722 100644
@@ -1561,27 +1561,6 @@ static inline void event_clear_filter(struct trace_event_file *file)
 	RCU_INIT_POINTER(file->filter, NULL);
 }
 
-static inline void
-event_set_no_set_filter_flag(struct trace_event_file *file)
-{
-	file->flags |= EVENT_FILE_FL_NO_SET_FILTER;
-}
-
-static inline void
-event_clear_no_set_filter_flag(struct trace_event_file *file)
-{
-	file->flags &= ~EVENT_FILE_FL_NO_SET_FILTER;
-}
-
-static inline bool
-event_no_set_filter_flag(struct trace_event_file *file)
-{
-	if (file->flags & EVENT_FILE_FL_NO_SET_FILTER)
-		return true;
-
-	return false;
-}
-
 struct filter_list {
 	struct list_head	list;
 	struct event_filter	*filter;
Signature · 1 line
2.28.0
author maintainer
#2 lore raw

PATCH 2/3 ftrace/documentation: Fix RST C code blocks

In reply to Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

Some C code in the ftrace-users.rst document is missing RST C block annotation, which has to be added.

---
 Documentation/trace/ftrace-uses.rst | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/trace/ftrace-uses.rst +6 -0
index 5981d5691745..f7d98ae5b885 100644
@@ -116,6 +116,8 @@ called by a callback may also be traced, and call that same callback,
 recursion protection must be used. There are two helper functions that
 can help in this regard. If you start your code with:
 
+.. code-block:: c
+
 	int bit;
 
 	bit = ftrace_test_recursion_trylock(ip, parent_ip);
@@ -124,6 +126,8 @@ can help in this regard. If you start your code with:
 
 and end it with:
 
+.. code-block:: c
+
 	ftrace_test_recursion_unlock(bit);
 
 The code in between will be safe to use, even if it ends up calling a
@@ -145,6 +149,8 @@ protection, it is best to make sure that RCU is "watching", otherwise
 that data or critical section will not be protected as expected. In this
 case add:
 
+.. code-block:: c
+
 	if (!rcu_is_watching())
 		return;
 
Signature · 1 line
2.28.0
author maintainer
#3 lore raw

PATCH 3/3 ring-buffer: Add test to validate the time stamp deltas

In reply to Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

While debugging a situation where a delta for an event was calucalted wrong, I realize there was nothing making sure that the delta of events are correct. If a single event has an incorrect delta, then all events after it will also have one. If the discrepency gets large enough, it could cause the time stamps to go backwards when crossing sub buffers, that record a full 64 bit time stamp, and the new deltas are added to that.

Add a way to validate the events at most events and when crossing a buffer page. This will help make sure that the deltas are always correct. This test will detect if they are ever corrupted.

The test adds a high overhead to the ring buffer recording, as it does the audit for almost every event, and should only be used for testing the ring buffer.

This will catch the bug that is fixed by commit 55ea4cf40380 ("ring-buffer:
Update write stamp with the correct ts"), which is not applied when this commit is applied.

---
 kernel/trace/Kconfig       |  20 +++++
 kernel/trace/ring_buffer.c | 150 +++++++++++++++++++++++++++++++++++++
 2 files changed, 170 insertions(+)
kernel/trace/Kconfig +20 -0
index c9b64dea1216..fe60f9d7a0e6 100644
@@ -845,6 +845,26 @@ config RING_BUFFER_STARTUP_TEST
 
 	 If unsure, say N
 
+config RING_BUFFER_VALIDATE_TIME_DELTAS
+	bool "Verify ring buffer time stamp deltas"
+	depends on RING_BUFFER
+	help
+	  This will audit the time stamps on the ring buffer sub
+	  buffer to make sure that all the time deltas for the
+	  events on a sub buffer matches the current time stamp.
+	  This audit is performed for every event that is not
+	  interrupted, or interrupting another event. A check
+	  is also made when traversing sub buffers to make sure
+	  that all the deltas on the previous sub buffer do not
+	  add up to be greater than the current time stamp.
+
+	  NOTE: This adds significant overhead to recording of events,
+	  and should only be used to test the logic of the ring buffer.
+	  Do not use it on production systems.
+
+	  Only say Y if you understand what this does, and you
+	  still want it enabled. Otherwise say N
+
 config MMIOTRACE_TEST
 	tristate "Test module for mmiotrace"
 	depends on MMIOTRACE && m
kernel/trace/ring_buffer.c +150 -0

168 lines not on this page · raw message

Signature · 1 line
2.28.0