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=1796101695; b=k0R6kFeNcFnvanxc45HJT3vSaQ9G8JRD2umHtUsAbOV/O7VooURlk/LIgiuMq/zvwtah zwwE9YoGbkP/ckxFYW1U5aAhFDJFMJ877jT9Z8qf4XndBngnuqNIjAGtIr4KnMKxuX7bp XhQWBSXgUljHNxmTds9HDt08AM1a6JHGJ/xNK1n3Yl8rRaQzUfTipNeVnUV4WxmUEEKWf o2vJlgPZs27RME5L5ZTtRtXjEe6jWtdxAACOUmQ6vDSHQLsjYRdOGkWcxvc7KrcYDTsMm lTUGyojgwF67IfeL3oMLr1U31WDGBjCXf/90aFYxLauvIFEE/fOFSsyFmR+wZS3N0pw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796101695; h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=fe/PCCGRv1HmD0PFjrAZXTDg3TWdqAD3CqFVeF3gD9w=; b=vgF8mgW0sr41zRrPvNON3eZ00cf9wXu8oaY9vippIWe7VCOM31itRlAcfX5ZW/yvtzgT 1wqCOMb0jUX7KDIe9ZZhOyyZ3LYNv5Y12H9+ojdxawrNRoM7WJGUzpmiUlv9eHCtpGZRT qh0f3ql76e9+tP6i28TQe149Y3/rRLxZ5Hu9oeEf+g5ejyyCpH/2Ei16BmHN+iTf7o92f 7xn/LzeiQxw4Yx1hILM/0C/iVtLdd8Umx06hugdLl1g2X3A5CBYICnUmcGGxuo74ruOCW AgAcdc0MBG9VUcNED8CKSVxbhGkbtMsbaUP+pSm5Tt0PcZm3oO7jxvefDE5be4nuPRQ== 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=h2tk3GSF; 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 A865E606A31A; Tue, 1 Dec 2026 05:08:15 +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=h2tk3GSF Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F7B41F000C1; Tue, 1 Dec 2026 05:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796101695; bh=fe/PCCGRv1HmD0PFjrAZXTDg3TWdqAD3CqFVeF3gD9w=; h=In-Reply-To:References:Subject:From:To:Cc:Date; b=h2tk3GSFmPBwe31po8j5FqLVG9u8jb+UGJG9eHlS77BmR0iW2IIs3rg35WJLIn8Nl ROTH7I48kKsHlMYY6iCtYyQmm9hdmFjniLf02Gj0M86QTITCB22GE5zZCLpQbi3BTw 3Ic2PUBNXcDoSb+RsG9a8vSket8XIlv0r6EUg5gpkgukEBtKrh9JNMvzJ5/hZ3wbNt wHA1bu3J8XpMDm7x5r9jyBCli+9HkA9dwnP+HEvizkhDcUET1IpQZyFBumspu2dNku XU9O7X9FiBVJR7NRCnhdgA8bvo3h+dG2JTwJht31/8eK1afKGMV7cyEN6taG68ODcz kD6RTOPGx9RZw== Content-Type: multipart/mixed; boundary="===============6543000562624551542==" 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: In-Reply-To: <20261201042201.3199928-11-song@kernel.org> References: <20261201042201.3199928-11-song@kernel.org> Subject: Re: [PATCH v3 10/22] powerpc, csky, mips, sh: Mark the accessors behind current 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:11 +0000 (UTC) --===============6543000562624551542== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit > powerpc, csky, mips, sh: Mark the accessors behind current notrace TL;DR: Microblaze's current_thread_info() is not marked notrace; once inline stops implying notrace, ftrace may possibly recurse without bound before the recursion bit is set. Should it get the same annotation? > diff --git a/arch/csky/include/asm/thread_info.h b/arch/csky/include/asm/thread_info.h > --- a/arch/csky/include/asm/thread_info.h > +++ b/arch/csky/include/asm/thread_info.h > @@ -42,7 +42,7 @@ struct thread_info { > #define thread_saved_lr(tsk) \ > ((unsigned long)(((struct switch_stack *)(tsk->thread.sp))->r15)) > > -static inline struct thread_info *current_thread_info(void) > +static inline notrace struct thread_info *current_thread_info(void) > { > unsigned long sp; > [ ... ] Microblaze also selects HAVE_FUNCTION_TRACER and does not select THREAD_INFO_IN_TASK, and its current_thread_info() is still a plain inline: arch/microblaze/include/asm/thread_info.h: static inline struct thread_info *current_thread_info(void) { register unsigned long sp asm("r1"); return (struct thread_info *)(sp & ~(THREAD_SIZE-1)); } On microblaze, current is the r31 register variable, so this helper is not behind current. It is behind preempt_count() though, because microblaze uses the generic include/asm-generic/preempt.h: static __always_inline int preempt_count(void) { return READ_ONCE(current_thread_info()->preempt_count); } The recursion protection reaches it before the recursion bit is set: function_trace_call() ftrace_test_recursion_trylock() trace_test_and_set_recursion() trace_get_context_bit() interrupt_context_level() preempt_count() current_thread_info() preempt_disable_notrace() at the end of trace_test_and_set_recursion() also reaches it through preempt_count_ptr(). Right now the helper is still notrace because inline implies notrace. Once a833438864c3 ("compiler_types: Move notrace from inline to __always_inline") removes that, can an out-of-line copy of microblaze's current_thread_info() get an mcount call, so that tracing it re-enters the callback before the recursion bit is set and recurses without bound? This is the same condition the patch handles on csky, mips and sh, where current_thread_info() is behind both current and the generic preempt_count(). The arm64 patch 4a65f9d5e118 says the generic preempt count helpers are __always_inline, but they depend on the arch's current_thread_info(). No commit in this series touches arch/microblaze. m68k, nios2 and arc keep a plain inline current_thread_info() but do not select HAVE_FUNCTION_TRACER. Should arch/microblaze/include/asm/thread_info.h get the same notrace annotation, here or in the preempt count patch? --- 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 --===============6543000562624551542==--