From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Karl Mehltretter <kmehltretter@gmail.com>
Subject: [for-next][PATCH 7/8] tracing: Dont use TRACE_BRANCH_BIT as a mask
Date: Wed, 02 Dec 2026 03:14:43 -0500 [thread overview]
Message-ID: <20261202081501.001575740@kernel.org> (raw)
In-Reply-To: 20261202081436.100375310@kernel.org
From: Karl Mehltretter <kmehltretter@gmail.com>
TRACE_BRANCH_BIT is a bit number, but the branch tracer uses it as a
mask on current->trace_recursion. Instead of its own bit, the branch
tracer tests, sets and clears bits that function tracing uses for its
own recursion protection.
While a function tracing callback holds one of these bits, the current
task's branch events are lost. This includes events in an interrupt that
arrives during the callback.
Use the trace_recursion_*() helpers, which take a bit number.
Link: https://patch.msgid.link/20261129000609.45955-1-kmehltretter@gmail.com
Fixes: 6224beb12e19 ("tracing: Have branch tracer use recursive field of task struct")
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_branch.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
index d8e97ad798f0..ed19e69f9294 100644
--- a/kernel/trace/trace_branch.c
+++ b/kernel/trace/trace_branch.c
@@ -38,7 +38,7 @@ probe_likely_condition(struct ftrace_likely_data *f, int val, int expect)
unsigned int trace_ctx;
const char *p;
- if (current->trace_recursion & TRACE_BRANCH_BIT)
+ if (trace_recursion_test(TRACE_BRANCH_BIT))
return;
/*
@@ -52,7 +52,7 @@ probe_likely_condition(struct ftrace_likely_data *f, int val, int expect)
return;
raw_local_irq_save(flags);
- current->trace_recursion |= TRACE_BRANCH_BIT;
+ trace_recursion_set(TRACE_BRANCH_BIT);
if (!tracer_tracing_is_on_cpu(tr, raw_smp_processor_id()))
goto out;
@@ -80,7 +80,7 @@ probe_likely_condition(struct ftrace_likely_data *f, int val, int expect)
trace_buffer_unlock_commit_nostack(buffer, event);
out:
- current->trace_recursion &= ~TRACE_BRANCH_BIT;
+ trace_recursion_clear(TRACE_BRANCH_BIT);
raw_local_irq_restore(flags);
}
--
2.53.0
next prev parent reply other threads:[~2026-12-02 8:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 8:14 [for-next][PATCH 0/8] tracing: Updates for v7.5 Steven Rostedt
2026-12-02 8:14 ` [for-next][PATCH 1/8] tracing: Rename __dynamic_array() to __dynamic_field() for ftrace events Steven Rostedt
2026-12-02 8:14 ` [for-next][PATCH 2/8] tracing: Do not bother getting user space stacktraces for kernel threads Steven Rostedt
2026-12-02 8:14 ` [for-next][PATCH 3/8] tracing: Drop duplicated NO_CMDLINE_MAP check in saved_cmdlines_next() Steven Rostedt
2026-12-02 8:14 ` [for-next][PATCH 4/8] tracing: Add __print_sym() to replace __print_symbolic() Steven Rostedt
2026-12-02 8:14 ` [for-next][PATCH 5/8] net: dropreason: use new __print_sym() in tracing Steven Rostedt
2026-12-02 8:14 ` [for-next][PATCH 6/8] net: drop_monitor: use drop_reason_lookup() Steven Rostedt
2026-12-02 8:14 ` Steven Rostedt [this message]
2026-12-02 8:14 ` [for-next][PATCH 8/8] tracing: Use test_bit() in event_enable_count_probe() Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261202081501.001575740@kernel.org \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=kmehltretter@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.