tracing: Explain the trace recursion transition bit better
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 19 Oct 2021 13:25:20 +0000 (09:25 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 21 Oct 2021 18:19:00 +0000 (14:19 -0400)
The current text of the explanation of the transition bit in the trace
recursion protection is not very clear. Improve the text, so that when all
the archs no longer have the issue of tracing between a start of a new
(interrupt) context and updating the preempt_count to reflect the new
context, that it may be removed.

Link: https://lore.kernel.org/all/20211018220203.064a42ed@gandalf.local.home/
Suggested-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
include/linux/trace_recursion.h

index 1d8cce02c3fbbe434e14bb308d4f24e6e30719dd..24f284eb55a748ae1ddae8e731fa5a21e6846ca5 100644 (file)
@@ -168,8 +168,12 @@ static __always_inline int trace_test_and_set_recursion(unsigned long ip, unsign
        bit = trace_get_context_bit() + start;
        if (unlikely(val & (1 << bit))) {
                /*
-                * It could be that preempt_count has not been updated during
-                * a switch between contexts. Allow for a single recursion.
+                * If an interrupt occurs during a trace, and another trace
+                * happens in that interrupt but before the preempt_count is
+                * updated to reflect the new interrupt context, then this
+                * will think a recursion occurred, and the event will be dropped.
+                * Let a single instance happen via the TRANSITION_BIT to
+                * not drop those events.
                 */
                bit = TRACE_TRANSITION_BIT;
                if (val & (1 << bit)) {