From: sashiko-bot@kernel.org
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] tracing: Roll back soft-mode and trigger-mode refs on register failure
Date: Sun, 06 Dec 2026 12:40:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-252417@kernel.org> (raw)
In-Reply-To: <20261206115150.61594-4-mhiramat@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] tracing: trace_buffered_event_enable() before reg() causes
IPIs on failure
--
commit 72afe8e498650764992e3b93fcd22a04cecb9540
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing: Roll back soft-mode and trigger-mode refs on register failure
This commit rolls back soft-mode and trigger-mode state when event
registration fails in __ftrace_event_enable_disable() and
trace_event_trigger_enable_disable(), and updates the histogram trigger
failure path so it cleans up without double-decrementing tm_ref.
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index f33fd00d26044..dbe10b26d5bca 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -922,6 +922,12 @@ static int __ftrace_event_enable_disable(struct trace_event_file *file,
> &file->flags);
> tracing_stop_tgid_record();
> }
> + if (soft_disable) {
> + clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT,
> + &file->flags);
> + trace_buffered_event_disable();
> + atomic_dec(&file->sm_ref);
> + }
> pr_info("event trace: Could not enable event "
> "%s\n", trace_event_name(call));
> break;
[Severity: Medium]
Can trace_buffered_event_enable() be deferred until after call->class->reg()
succeeds, instead of rolling it back here with trace_buffered_event_disable()?
When trace_buffered_event_ref transitions 0 -> 1 -> 0 on a failed soft-mode
registration, this allocates a page per possible CPU and immediately tears
them down with two synchronous all-CPU IPIs and two synchronize_rcu() waits
while holding event_mutex.
During bulk enablement such as __ftrace_set_clr_event_nolock() ->
enable_trace_eprobe() -> enable_eprobe(), that cycle repeats for every
failing event, interrupting online CPUs and stalling concurrent tracing
operations.
Since trace_event_buffer_lock_reserve() checks trace_buffered_event and falls
back to __trace_buffer_lock_reserve() when it is NULL, enabling the buffered
event after the registration block avoids both the per-CPU page churn and the
IPI/RCU teardown on failure.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206115150.61594-1-mhiramat@kernel.org?part=3
prev parent reply other threads:[~2026-12-06 12:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 12:22 [PATCH 0/3] tracing: Roll back event flags and soft/trigger-mode refs on register failure Masami Hiramatsu (Google)
2026-12-06 12:22 ` [PATCH 1/3] tracing: Clear RECORDED_CMD and RECORDED_TGID flags " Masami Hiramatsu (Google)
2026-12-06 12:22 ` [PATCH 2/3] tracing/eprobe: Handle trace_event_trigger_enable_disable() failure in enable_eprobe() Masami Hiramatsu (Google)
2026-12-06 12:40 ` sashiko-bot
2026-12-06 12:22 ` [PATCH 3/3] tracing: Roll back soft-mode and trigger-mode refs on register failure Masami Hiramatsu (Google)
2026-12-06 12:40 ` sashiko-bot [this message]
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=sashiko-outbox-252417@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox