From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796252207; b=sgnrfqCqyxatQCxulNgHn6HE8Ue+JpAj+R89oDivT4/3GH2+qqkdMfav2bguaw5wQE3B qHkK4jyuhWzlN5zcfVG4pm06j7XM72vO2Nsjtbv1GtwGVPPlnfWjS9psvuRr+gr/h2q9e 8G80qg506Ps9MFOKbuu/r24GUV6Q+yF5gjcxQKoTjvaq6c5Sk/IJ7xMVi9PPgvjBNG8Bt VYTpN/7IxMwKDW0HEn4+s+FvRKYMZyl9iqon1i4KpI/UC/VBnVS9NHX0NGuNCyNlHtxu8 euYTE/ujTu67SCjAFlK/E/riHO01QzuTkcTWekdvM9jchd8jdFIiIhKOnC7Qt45aVeA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796252207; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=fqFw/jpaAGCbrUlW4e7a02H7PDS1BunsFWOVhQmEhes=; b=tGVDyG/fsr9vvadulVRAuFuY5Lnfddf7PYsQ1W0Su1nxYxhuzkulzXMvKn7pcFkDh2CC aBiEMuiYYbvADFn+cmVLzbhXb2DsURmY4rdutAyB95L7/s62kCqQH4hbkhGLzmK8FzIQp dScHZY/37SgOfCB/8ZFI0icYOtEQeGsfl64UODKOVjuh5LDYQWd+2+3WzFoD6XGqVxnql m8Yr+zzbf777NbwHz7TKJPmxO6al/5Nt4acDLihFlR754VSUFcbOeCMMFb7Pm86SAzpNI yybwAjlbguFUezuzngFGBOIKSUYEPuZB3+CQC62wSKD82BBchJKNRpaJ6dvN0DG6aRQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=G0ww57Nc; arc=none smtp.remote-ip=209.85.221.42 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15365606A330 for ; Wed, 2 Dec 2026 22:56:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 15365606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=G0ww57Nc Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-4c4b8e58cfeso3045106f8f.3 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=vger.kernel.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=G0ww57NcRPCRWn44jsI5UmoP8pc37ahqKF//0plP3VV0e2pXCZs0l2WVN5fCEnuLPa B9Ql8W1FiVmDOzKzRoBHe0k1lny0ywVuTLXxviFIQwOAXyCIs96r/xPOQzIZRluvsVQS HsLYjvekCLxcgZ3i+uXaE/3xd9d6vLiKBCOswj9Vo5qI8wxCIjNfgWghkHSDYdgBdG+f BOe3Do7SiJQzvFBHBAe2gKNl1t7CXe2LO6mVL0m9FS5DR2Rvw2ZzNxeAqu164zzKj5ck 4gUQtGeknON/5Pzh1+5MWzai9niwpd0LLGWBEFThQVPsEgRJCTh0emSoZTmJHLN1wOEj RXqg== 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=HUJSJ62Ni94tjUYGhkfw8WbDYrlXj4PXSxN6j+YVGA47t+Xv8TDeX4A1IQOp8pNz0V zoluvQkuXgDu/4tgmptM5BZtajMbwE/VtiRDTXs8kWMp0vNvtoC3/Bn6W2i4L7PJLp5W zuhSSHUtPUajuYqE7qcu4Qq0EK36ChHMj7htxQPs7MOeuevI3E9n7rUngkgr8c0AMsLC iu8oIu8DoRrcKv8dbtyyrWCtw1TeaWydtgfixgULrcgJk2Q1qZMKoTD8yVGN/P1cVr+A i4y1gWDhXF7X1hfBkLNt1HUnKCwSeEKyQOPDvfAtjYNuxPfEPFWhbYdJZx3p2KVKXuDA a7rg== X-Forwarded-Encrypted: i=1; AL+hErG7HXsLUOLz8MJvI7Od+nbiBlXDn8t/dAQJ9wuLXzYDNskxEsLIGXR4fDbE97RkMdmMh/8=@vger.kernel.org X-Gm-Message-State: APuU4Z/oeqsyEPz0cdsLt29XDHX0Z7KDbUMyxZBgUEXKCg+iWpNsgnhK MfVd8ZBtl0AbaP9Nj+YF8+9713v9SDglwwyEQp08wnY3HGnq1XHBnLrA X-Gm-Gg: AZFdTZfM5KkMnd9sKKtKIxAWlnlUqouFxXB10W9GhJgeIhNx829zSoJk9YEC6CWlfmS wyXxQv886P/MwNbXdpn8+8bdxWF9mG0EOk4GFNw9a7ZwSnpBtdUpDNkgYfta8PTpMSk8gCm6jAm TH6ry2FhWom18A7hXF5mzilG1Gv+0HHfVsoAF77p88b1j2MAHPNiwCbPCCbDHBNGKYsc3+6Dr6f Q6878RfU0HOdQaRhuf1YZ1nUECni/ZfNB1Ah/xJyBnZ1xeroaYK7Ne10VH6VGDQ/ZLfBXP+7UiG 1AOsmT9m+GZq0DNAPSlUOi6A2Cvit+fdYfAh81xUl6CLQiX/HT9cIdjJjrZphgVuQUh34hPctpy NKAlAjcv1/Vw2CrCm4BlKZXQ+qRLoCo7qIBy+TDfJEvM1muV4ej0+3xQvQqhWMYSSUM2Y0zaGr1 99LEc2cxqv+n90Zvn6oMYvPwPSx8vo+bLf1e3eol0KOQWhxB2mdeNq/52Ar3gMn8iT6rOWmvIb1 PQLOHXxvbW6E9K4EeitCOrVZTlzC3AgQ7gd8iUlqB8mPhR+la28qyyOOH2+sv3SbQuQpXby5tbS yzZUwVi6v27dJOqt9mIyKfRwsUKLw7+v159YjUNdCPtI4YmFwfW1Qme1/fX14U9boYJlApekzsR Lau4JGv7RYA== 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-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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