From: bot+bpf-ci@kernel.org
To: song@kernel.org,linux-kernel@vger.kernel.org,linux-trace-kernel@vger.kernel.org,live-patching@vger.kernel.org,linux-arch@vger.kernel.org,linux-arm-kernel@lists.infradead.org,linuxppc-dev@lists.ozlabs.org,linux-riscv@lists.infradead.org,bpf@vger.kernel.org
Cc: rostedt@goodmis.org,mhiramat@kernel.org,mark.rutland@arm.com,peterz@infradead.org,tglx@kernel.org,frederic@kernel.org,paulmck@kernel.org,catalin.marinas@arm.com,will@kernel.org,maddy@linux.ibm.com,mpe@ellerman.id.au,npiggin@gmail.com,chleroy@kernel.org,pjw@kernel.org,palmer@dabbelt.com,aou@eecs.berkeley.edu,alex@ghiti.fr,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,ojeda@kernel.org,kernel-team@meta.com,song@kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH v3 20/22] powerpc: Mark helpers called from noinstr code notrace
Date: Tue, 1 Dec 2026 05:08:17 +0000 (UTC) [thread overview]
Message-ID: <26e0cda240be5b175f113ccbe299c7e04bdeb8037d73c9918d60cacad9ac30ea@mail.kernel.org> (raw)
In-Reply-To: <20261201042201.3199928-21-song@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 4674 bytes --]
> powerpc: Mark helpers called from noinstr code notrace
TL;DR:
- wrtee() and mtmsr_isync() may be left traceable out of line in noinstr
paths; unverified in a build
- commit message has wrong riscv irqflags and soft_nmi_interrupt() claims
> powerpc: Mark helpers called from noinstr code notrace
>
> Much of the powerpc code that must not be traced uses plain inline
> helpers from headers: the atomic, bitops and barrier helpers, the
> irqflags and hard irq helpers in <asm/hw_irq.h>, the interrupt entry
> and exit helpers in <asm/entry-common.h>, and the MMIO accessors.
> noinstr code calls them at points where tracing is not safe, for
> example:
> [ ... ]
> - soft_nmi_interrupt() calls wd_smp_lock().
> With clang, a ppc64le_defconfig build has out-of-line copies of many of
> these helpers, called from the functions above. The copies are
> untraced only because inline implies notrace.
> Mark them notrace explicitly, like the irq_soft_mask_*() helpers in
> <asm/hw_irq.h> already are. On x86, arm64 and riscv, the atomic, bitops
> and irqflags helpers are __always_inline. No functional change.
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Song Liu <song@kernel.org>
The commit message says that on riscv the irqflags helpers are
__always_inline. Is that accurate?
In arch/riscv/include/asm/irqflags.h they are plain inline:
static inline unsigned long arch_local_save_flags(void)
static inline void arch_local_irq_enable(void)
static inline void arch_local_irq_disable(void)
The riscv patch later in this series, 0c13f314b0bd ("riscv: Mark helpers
called from noinstr code notrace"), says "On riscv, the arch_local_irq_*()
helpers behind these are plain inline functions. On x86 and arm64 they are
__always_inline." That patch adds notrace and leaves them plain inline, so
the sentence stays wrong after the series. The riscv atomic and bitops
helpers are __always_inline, so only the irqflags part is off.
Could the sentence name only x86 and arm64 for the irqflags helpers?
The commit message also gives soft_nmi_interrupt() calling wd_smp_lock() as
an example of noinstr code calling a helper where tracing is not safe. Is
that accurate?
powerpc interrupt handlers are deliberately not noinstr; interrupt.h says
"Don't use noinstr here like x86, but rather add NOKPROBE_SYMBOL".
soft_nmi_interrupt() is entered with IVEC=0x900 in virtual mode, so
DEFINE_INTERRUPT_HANDLER_NMI calls irqentry_nmi_enter() before the body
runs and RCU is watching when wd_smp_lock() is called. In addition,
nmi_disables_ftrace() has:
/* Allow DEC and PMI to be traced when they are soft-NMI */
and returns false for INTERRUPT_DECREMENTER on BOOK3S_64, so ftrace is left
enabled on purpose. The same handler body also calls wd_try_report(),
set_cpu_stuck() and pr_emerg(), which are all traceable.
Marking wd_smp_lock() and wd_smp_unlock() notrace looks harmless, but could
this example be dropped or reworded to give the real reason?
> diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
> --- a/arch/powerpc/include/asm/hw_irq.h
> +++ b/arch/powerpc/include/asm/hw_irq.h
[ ... ]
> -static inline unsigned long mtmsr_isync_irqsafe(unsigned long msr)
> +static inline notrace unsigned long mtmsr_isync_irqsafe(unsigned long msr)
> {
> #ifdef CONFIG_PPC64
> if (arch_irqs_disabled()) {
mtmsr_isync_irqsafe() and the BookE irqflags helpers call two leaf helpers
from arch/powerpc/include/asm/reg.h that stay plain inline and are not
marked anywhere in the series:
static inline void mtmsr_isync(unsigned long val)
static inline void wrtee(unsigned long val)
On Book3S-64 mtmsr_isync() is reached from code that is notrace on purpose:
arch_exit_to_user_mode_prepare() (notrace)
-> restore_math() (notrace)
-> msr_check_and_set() (notrace)
-> mtmsr_isync_irqsafe() -> mtmsr_isync()
On 32-bit BookE, ct_idle_exit() (noinstr) calls raw_local_irq_save() and
raw_local_irq_restore(), which reach arch_local_irq_save() -> wrtee(0) and
arch_local_irq_restore() -> wrtee(flags) before RCU is watching.
Once a833438864c3 ("compiler_types: Move notrace from inline to
__always_inline") is applied, an out-of-line copy of either function would
get an ftrace call site. Should wrtee() and mtmsr_isync() (and possibly
msr_check_and_clear(), which restore_math() also calls) be marked notrace
here? This was not seen in a build.
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/46577721107
next prev parent reply other threads:[~2026-12-01 5:08 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 4:21 [PATCH v3 00/22] Move notrace from inline to __always_inline Song Liu
2026-12-01 4:21 ` [PATCH v3 01/22] x86/paravirt: Mark native pv_ops helpers notrace Song Liu
2026-12-01 7:43 ` Peter Zijlstra
2026-12-01 4:21 ` [PATCH v3 02/22] x86: Mark CPU state helpers used by resume and kexec notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 03/22] bpf: Mark bpf_spin_lock helpers notrace Song Liu
2026-12-01 4:55 ` bot+bpf-ci
2026-12-01 4:21 ` [PATCH v3 04/22] bpf: Mark the BPF trampoline " Song Liu
2026-12-01 5:08 ` bot+bpf-ci
2026-12-01 4:21 ` [PATCH v3 05/22] bpf: Mark the bpf_mem_alloc fast path " Song Liu
2026-12-01 4:21 ` [PATCH v3 06/22] u64_stats: Mark the update helpers used by BPF notrace Song Liu
2026-12-01 4:55 ` bot+bpf-ci
2026-12-01 4:21 ` [PATCH v3 07/22] tracepoint: Mark __do_trace_##name() notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 08/22] srcu: Mark the fast notrace read-side helpers notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 09/22] arm64: Mark the preempt count " Song Liu
2026-12-01 4:21 ` [PATCH v3 10/22] powerpc, csky, mips, sh: Mark the accessors behind current notrace Song Liu
2026-12-01 5:08 ` bot+bpf-ci
2026-12-01 4:21 ` [PATCH v3 11/22] rcu: Mark the Tiny RCU rcu_is_watching() notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 12/22] tracing: Mark the tracing_gen_ctx helpers notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 13/22] ktime: Mark ktime_to_ns() notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 14/22] kallsyms: Mark the kernel text address checks notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 15/22] uaccess: Mark pagefault_disable() and pagefault_enable() notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 16/22] context_tracking: Mark exception_enter() and exception_exit() notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 17/22] thread_info: Mark the thread flag helpers notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 18/22] arm64: Mark helpers called from noinstr code notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 19/22] arm64: Mark the stack unwinder helpers notrace Song Liu
2026-12-01 4:21 ` [PATCH v3 20/22] powerpc: Mark helpers called from noinstr code notrace Song Liu
2026-12-01 5:08 ` bot+bpf-ci [this message]
2026-12-01 6:02 ` Christophe Leroy (CS GROUP)
2026-12-01 4:22 ` [PATCH v3 21/22] riscv: " Song Liu
2026-12-01 4:22 ` [PATCH v3 22/22] compiler_types: Move notrace from inline to __always_inline Song Liu
2026-12-01 5:08 ` bot+bpf-ci
2026-12-01 11:04 ` Miguel Ojeda
2026-12-01 11:13 ` [PATCH v3 00/22] " David Laight
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=26e0cda240be5b175f113ccbe299c7e04bdeb8037d73c9918d60cacad9ac30ea@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=alex@ghiti.fr \
--cc=andrii@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=chleroy@kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=frederic@kernel.org \
--cc=ihor.solodrai@linux.dev \
--cc=kernel-team@meta.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=live-patching@vger.kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mark.rutland@arm.com \
--cc=martin.lau@kernel.org \
--cc=mason@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ojeda@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=rostedt@goodmis.org \
--cc=song@kernel.org \
--cc=tglx@kernel.org \
--cc=will@kernel.org \
--cc=yonghong.song@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
all inboxes | Powered by JetHome®