From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DD0B606A32C for ; Wed, 2 Dec 2026 22:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=hUa19BcQ; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Lt7E/N3D DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=fqFw/jpaAGCbrUlW4e7a02H7PDS1BunsFWOVhQmEhes=; b=hUa19BcQ4GqagX 08WsQKEHFchZewRJCKBp9ghvvhex8ce8VIh4RzJIXy7s1oL6IesYx9S7HhhpQKxJaKzySTRmqDwWk xNqNIBDtBXZBE5vHR2zMzQZZRMD5dI3n2OiWDBgwedWEirnR/EHvtLpbo7fJO3PAyZFjClxQrPksO TR98QwVx6HTvMGmE86aTsVC886YJlscIlHc2ZJi+meX00WbXg3+LsyNY0Cmzj8nMJr6y6e3dwp0Za kN1tO9832mW/JlSLUjYPpUqapJnj2N2WVDzH0uzN3dwPe56nh7VO/MNCiijQjs//UoNhY/TKb44LP 60rv/yTGmKMMs4uk0ruQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYtFq-0000000Cxf6-24X6; Wed, 02 Dec 2026 22:56:50 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYtFn-0000000CxeG-1WcC for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2026 22:56:49 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-4ad6219f7d8so12611380f8f.0 for ; Wed, 02 Dec 2026 14:56:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796252205; x=1796857005; darn=lists.infradead.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=fqFw/jpaAGCbrUlW4e7a02H7PDS1BunsFWOVhQmEhes=; b=Lt7E/N3DweXJpz5YXXwDS7iBocBDQqqk2q04pUT6gJh0yogtACiyLj0L9OnlXWV5ZJ wnLL632O03o2zCFNdhEE2Ko1jFH2qN6As6zwIByfrz99fNcmgqduf5MBBy109jyexaiJ jZCplj5DPVK8dLGctMXvW1YBdFF5QrbMiEGNLXVkZAu9vXG3NCEUD7ETzPW3b1J/kWFr Xr9E9z+35eGUE3ZN8pKsXXWXGQCutjKpuFCXGCh4DL7rrQRkuW+yiCXDZYm4BiU/lfvU wHfVlWhkD/pYjPrhlsVTvQtLedea8lwJqspkQKM9jILIzcc4yL2ZGQgo00TGL2BbY7Db CTlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796252205; x=1796857005; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=fqFw/jpaAGCbrUlW4e7a02H7PDS1BunsFWOVhQmEhes=; b=tDRAifvr0coOtrI76sxfEwX8Vf4kdPA84EmlI6s12KUpXvqY+R6/T60KvWZzQTemxA yrUC4bZ7A0892Y5hRINGTffNW6YsOLGL2DVjCE7FQjUDie3OXya+2vS1SXwRYmJ5IdW4 gctD5U6z7r2PYHB/t+pvOlJLrGjAQcHQI1o8c53I+idqn4aldeDA8lU9ff6Yn1czaN6k vdz879h1520i1ArvNTAduqk13JelwaNpQz9qJFWvBY4e6JfBBS5XwgnRosYPjs6f4MKd +dDgxshYXxWuJu/O5PCMkEPwj2ukxfcdO36ctxuSpLVndMVldab4n7bDKRY8D4lXG3AB 7thg== X-Forwarded-Encrypted: i=1; AL+hErFt53yLQcxpGwSHMRLA6JNLm90CQK2Lb6IbDQEJ6rUs5m0PLnVEq4WtKeofDsNSTacVbzRAHD8hj9zp3dBUA9AH@lists.infradead.org X-Gm-Message-State: APuU4Z92k3sDjqjqsC48xk0cxIyOsvEeASfO545wQB6Lp7x9c3mUw1oP krwQIHV6ZIjKr/ZSbqhwpZhb6Ctkak9AH5i/9tMlO9UT1kyo2SGVqMJV X-Gm-Gg: AZFdTZc2Hdk/IIiijoPyOdI0fFxwmbpSstl1MU4E9xW3ecnlvUAfryxOhYY10kv1qoj 975wU7B/Cv8sfuwOWJO+0xCDE3BZGIPjMtah/D23kUKmVJQfF/uKUEITDbkWbhn8at2/LWJkE95 GPW49E7j6aLbhoTecuDSOZIg35sWs5SWrupSydv7QQ/3yyyy5Iw8xwcswojqPT9wkMuJ6Z2cZAn aQJUVmOZbG08lzHpK9ophYposFy/d5EDYxE2+egPtJywaCrYuZExbzDwQHnWPygKBzxgzcZeCn8 /YFQaAEfO+I+TcWfiUxyUiQkP66UQcsRlzL/2b6GAOaUUtOOh4EpOnqKY/xFBYmP0lZL3938imo qN56TZsSO6/9hZPeJqvvcz1r6pYitDWO228kDamLiq8JvZnvspJjZ6wRoy5LbzQc8Ahb1Wiwo8+ n+V2jRCQefSppTCds9omHx0hqhDypshDeMKqJMr507jlro5t7Mqw0luSwCGg2QxVyLrP9t3ga6f FoEdZaP7kbeAgQbIQW9M6fdCCRGIiB/OWIY/rP8sZjhQZCPuFY3YG0mz9gsskZ+T+xKf73uJsb9 4+/MmD+Hx0d7R4zFs8sotx6lfx2XpDu44I2x1UGHYg8kd/th4oUgt8N58NfM9cDZkQ03e9nJNGA 4WwuOLNl6IQ== X-Received: by 2002:a05:6000:428a:b0:4a9:dcdb:2e11 with SMTP id ffacd0b85a97d-4abb8406ea4mr84829745f8f.41.1796252205424; Wed, 02 Dec 2026 14:56:45 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab69bf6804sm79902710f8f.10.2026.12.02.14.56.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 14:56:44 -0800 (PST) Date: Wed, 2 Dec 2026 22:56:43 +0000 From: David Laight To: Song Liu Cc: "Masami Hiramatsu (Google)" , 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, rostedt@goodmis.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 Subject: Re: [PATCH v3 00/22] Move notrace from inline to __always_inline Message-ID: <20261202225643.0004cfb1@pumpkin> In-Reply-To: References: <20261201042201.3199928-1-song@kernel.org> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_145647_427651_8D246555 X-CRM114-Status: GOOD ( 33.26 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-4.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Wed, 2 Dec 2026 11:12:09 -0800 Song Liu wrote: > Hi Masami, >=20 > Thanks for your review! >=20 > On Wed, Dec 2, 2026 at 6:49=E2=80=AFAM Masami Hiramatsu (Google) > wrote: > [...] > > > > In my view, ftrace operates on the following assumption: it is always > > safe to call a standard `static inline` helper function from within a > > function marked `notrace` (or from within the ftrace recursion- > > protection path in code compiled for instrumentation). =20 >=20 > Hmm.. Do we really have the protection today? For example, on x86, > __switch_to is marked with __notrace_funcgraph. But __switch_to > calls switch_to_extra, which calls __switch_to_xtra, and __switch_to_xtra > is actually traceable. Is this a problem? >=20 > > If the `notrace` designation were removed from an inline function, that > > function - should it be generated as standalone code rather than being > > inlined - would become subject to tracing. This could trigger recursion > > within ftrace or fgraph. If this occurs before the recursion-protection > > flag is set, it could even lead to infinite recursion. > > > > In v3, there are still some problems here: > > > > - Patch 12 marks tracing_gen_ctx() and tracing_gen_ctx_flags() notrace, > > but arch_local_save_flags() and arch_irqs_disabled_flags() that they > > call remain plain static inline on arm, csky, loongarch, mips, and > > parisc. > > - trace_test_and_set_recursion() reads current_thread_info() before > > setting current->trace_recursion, yet current_thread_info() in > > arch/microblaze/include/asm/thread_info.h is still plain static inlin= e. > > - Patch 14 marks is_kernel_text() notrace for core_kernel_text() (called > > by the MIPS function graph tracer), but in_gate_area_no_mm() that it > > calls remains plain static inline. > > > > More importantly, there is a structural maintainability problem. > > It is impossible to know in advance whether a `static inline` helper > > function will actually be inlined or generated as standalone code. > > Unlike `noinstr` on x86, there is no compile-time check tool > > (such as objtool) detecting - across different architectures - > > calls from a function marked `notrace` to a function that is > > traceable. =20 >=20 > To clarify, the motivation is not to trace functions marked with > "inline". We observed the issue when we want to livepatch a > function marked with "inline". If the function is actually inlined > by the compiler, we will livepatch the callers of it, which works > as-is. However, if the compiler decides not to inline this function, > we need extra work for the livepatch (basically apply a bunch of > s/inline/__always_inline/). This is not too difficult or too much > work. However, I still don't think "inline" means "if not inlined, > still not traceable/livepatchable". Well, the compiler can inline some (but not all) calls to a static function and also inline calls to a non-static function. So unless you force everything either noinline or always_inline you'll always get multiple copies. Not to mention the 'constprop' alternatives it can generate when one argument is constant. David >=20 > Thanks, > Song >=20