From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796101701; b=brfRy0YVbKufmE/xaDJKhaeXh8DQ1uu7nGr0DUuxXjmOz/7DmvKu5rUx28htG3P6TjIN ZFvpm7RN+fTH5IBMrhmH3ACXZ1PWy5YaOorBw7efEpcHJfQ0J+Wanp2zbwsRRzu/3yWwx +Vj1JjhdKj4SGBp7RelTIWgdYjWyMnWNAw55UIfcweM7KBJvGh/3ejCD1x2BpyKf72Ztm 838H20tGljc+rko+SBUvlZqo5bZiTUlA09pPW53OQTkS4bQxODHzPQhE0cnwoUTj+Ii+F sp2dDLCPQkfAQl+pVMydN7vOE6DBly9zyyp4DxUyZZOk0Eo+kksyBQo0Xwf4lQl5msg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796101701; h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=NwlOTpgcwzG2g3lbqGDWUd69Qs4UDBnOTFSPcwWsr6c=; b=qzZw978UHY0zy3ucgvHD7C+C4jrQJAUTuWcquOKQaEVtd4C75XdNWUHXekL/rKMuHxyf dm/TT4wspQO1017lmYucXw861SjbJkk26TozgwOYBHRIrF373I40I7sbn3zU7Rp0g+KZR fdMeDPn5kGzXlHu3PtY8HhFgV0MraCetgDuIh1cV7DmhaU8XyYXTtnUnp0xmQ/WHFY2qc NQvB4S5zuj/Vtdv/VcFM3zPhi7vF9RvUb7xw2maC4fLIS9ERaZMMTBWXK/z8PEzcZmVts kqCcYF31OyelZLiq/VcXUWPQurvjiVraiF3fE705GvvMKTV3BVIsT9shvts3xb4uGbQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Aad/f3tO"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3597606A320; Tue, 1 Dec 2026 05:08:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Aad/f3tO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B8A81F00898; Tue, 1 Dec 2026 05:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796101700; bh=NwlOTpgcwzG2g3lbqGDWUd69Qs4UDBnOTFSPcwWsr6c=; h=In-Reply-To:References:Subject:From:To:Cc:Date; b=Aad/f3tOoVnfTU3rYR5JiVTpHn6jnyB58Rxl2StcqwzAM5YxXEDts8kHkq7TWzurb 6EejdJelALF8v4Hhn6DrFrVJ40Iq18OWAX6JmnbFAF0WholMQsJI0uU3LweKZGWIVG SBUafcR2oVvyn4oJlGe3hg9QUFDnxS0M/PX86ulEaWe8PGwtmv/FJ+j6grNhpoAXDO TQkmb1NrpZ8rZGyp3BaSNHFNjsEubwe02z3elIE+GPxAvmbY1H/TZdk08S2XGSe1Yu DJqrcxxMN8lbD+ebUYBnAKgV0js9jReHT0HSsCo+GJyx16pisFTdpJQcb0jwCOoDxa C7dai6Y/Rk6Fw== Content-Type: multipart/mixed; boundary="===============3666649815527130854==" X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Message-Id: <26e0cda240be5b175f113ccbe299c7e04bdeb8037d73c9918d60cacad9ac30ea@mail.kernel.org> In-Reply-To: <20261201042201.3199928-21-song@kernel.org> References: <20261201042201.3199928-21-song@kernel.org> Subject: Re: [PATCH v3 20/22] powerpc: Mark helpers called from noinstr code notrace 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 Date: Tue, 1 Dec 2026 05:08:17 +0000 (UTC) --===============3666649815527130854== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit > 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 , the interrupt entry > and exit helpers in , 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 > 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 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 --===============3666649815527130854==--