From: Karl Mehltretter <kmehltretter@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@kernel.org>, Song Liu <song@kernel.org>,
linux-trace-kernel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing: Keep preemption disabled until the recursion bit is cleared
Date: Wed, 2 Dec 2026 02:18:28 +0100 [thread overview]
Message-ID: <aw9xHDH3z3yI3sRL@gmail.com> (raw)
In-Reply-To: <20261130113108.293e4d1d@gandalf.local.home>
On Mon, Nov 30, 2026 at 11:31:08AM +0100, Steven Rostedt wrote:
> > Would you rather drop the patch, or go with one of these?
> >
> > 1. Send the partial fix above as v2 (keeps your check, fixes >99%,
> > leaves the two short interrupt windows).
> > 2. Reorder as in my patch using small noinstr helpers for the count
> > updates (closes both windows, objtool checks noinstr on x86, loses
> > the runtime check, adds a helper call).
>
> Why are disabling preemption before the checks anyway. It's not the checks
> that are causing the issue, it's the setting of the bits themselves.
>
> Why not this patch which disables preemption *before* setting the bits,
> which should give you the same results?
>
This is simpler and avoids the preempt_count updates on the rejection
path and gives the same results.
That said, your triple-fault concern still applies here, since the
recursion bit is still unset when preempt_disable_notrace() runs.
I tested your patch on x86_64 (with and without VMAP_STACK) and arm64.
With the transition bit disabled it matches my patch (~90% fewer
recorded recursion sites) and the ftrace startup self-tests pass.
On fault injection, a traced call right after preempt_disable_notrace()
is still caught by the current ordering. Your version hangs with
VMAP_STACK and triple-faults without it (under both TCG and KVM).
Keeping the transition bit does not help.
On the other hand, switching preempt_disable_notrace() to the real
traced preempt_count_add() hangs the baseline too. Paths like
preempt_schedule_notrace() already rely on it not being traced.
So if you're fine relying on preempt_disable_notrace() staying
non-instrumented, I'd rather go with your version.
Thanks,
Karl
prev parent reply other threads:[~2026-12-02 1:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 1:13 [PATCH] tracing: Keep preemption disabled until the recursion bit is cleared Karl Mehltretter
2026-11-24 16:14 ` Steven Rostedt
2026-11-29 22:34 ` Karl Mehltretter
2026-11-30 16:31 ` Steven Rostedt
2026-12-02 1:18 ` Karl Mehltretter [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=aw9xHDH3z3yI3sRL@gmail.com \
--to=kmehltretter@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=song@kernel.org \
--cc=tglx@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox