From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796252207; b=CQXo5kwrGj26nOiaIfA4oqXjs33BeB0U7SVhQMa3BIE9yuxy3OTHzjfNvwMgNVOXOfnH 3Z42jsQhFAvJ8O+YjbrUzXf57c5JnPyb4LV+iyIjatZFKd3ugHLUSBPPD2KfkCqycwTKT bKwBzJ8Fv4wAFyVroj5yBSEuvbxzLZ5YK7aQRVMFNn3cb6y7MJLgRAhJH4KzYZu4Lt3UB 1HXe61R9XUfabBe3eng535zrLF87Z7wji8WiMmKmra8lpe4/GPQ5b8bErO6GXtsLg4HPx Jv6WeMwSmw0MJ57Vj7fhAJ7N0XLB/qQ6FMdiglousq0aLKX1VcAaEycaWlS/V1rYSsw== 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=vfONJwB6eebHLeaJTEpzQCIFgb7j03/ytt/MERysn4VIji1l8CpOpDiH1Xn2Xxc/UEST 3913Cp86EKJkmW2TLES5Gh7jbXELbxPRLv1YBoovuDU9BGGBeuEDxpjD58XBm34KHPTes zHibrxJgwz1Ix1WH972vyqkLnHRD6Mzutk3KBlN4Lw6WKJWdpQlqk0v1KUyU+K9d+PpIj 7jGAFicZJjx0fa0tKAJjSph5daBwHrYKCvgJj27REq3SmAvxZ3GyAU18PQhAYaFpuiyBV KN1Q4hfu1orG7XG8/Kqabfw1Z8IvsXDcVZNiqOeECYVEScC/OrYA+UxWKQ0pgL+MZig== 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.46 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 094EE606A32C for ; Wed, 2 Dec 2026 22:56:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 094EE606A32C 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-f46.google.com with SMTP id ffacd0b85a97d-48e20ed3b9dso12197688f8f.2 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=SX8f5GjJkqhsMu+zQAoatVxec8QOkDxeo5UnldsAGlLdB95fq7a4P/p53JaA8ZzusY 949ouRm1N+8+nIasusWadPAUfl5RsT7QZBQEB/gweo27ygErKdKNax/E44BG125nlRuE OKrwfSPx7irCqik0+qPNiL2WCnb4UqHidOL47ObH5VVoymfDvm7jhyYMxegFEFrFQk4H 7QU7JpjF4yejbl5JUoYsNfkuAhqIQtV0yatzJKCkKLivW8JQcVjhJHG4f007Euakepj2 a2a9wDrR6JOrOs1xMzHLWHoFwb5tmxi4xf7MZVGuiFjm9eIiK4+46H/kHF8nvNIseG/K 8SHA== X-Forwarded-Encrypted: i=1; AL+hErHxnDf0E0YCF8emT49aupctSMHEUPRPxb2MbZKXz4egkGCuFydWVmq0gmtgZ8lFWI4t3mgZUylAU2qtu6o=@vger.kernel.org X-Gm-Message-State: APuU4Z/CRVYfRSpdk9G/nBt6PQvncaRZsCqmxAMtt15P/hyTgX1W/VUD kxfMPCsZksiDXX4W+K4IkZ4gWlJAQ/8hBch4+vAuscJGdtXybRnvuw9G X-Gm-Gg: AZFdTZd0+yNE7VVYBkVhDMq5vWLORgJwHWAiavo/bfLd9h9GUKunVoRO5gc7fD5pAyl Nlp8LHLtWun2Ss7kmltIrDdzSJQL2J2g2DzziuJqw0N4bGtnoOeaS10AJuVPeB6MyKe7GAeYfpZ RBFbnrm4vrERZch8ctNxuYj4kWPGf2sFZPHq05dQisRGqQZSSfKvgsD++x9acxf2hrScFGMNLDo okfECLEwLJp6HgZZG0grnFqUph7dgN3Urp3zF0GUJGQSF/f4TrQlXfmea4BZVaya7movurrI4Rx HuXJQMg5xwphT9OYhQRRxDeMNCF4GtC5niJoBU7efcInmHC50nNJSrvDdif/eKCd31UI0feMJP7 qqGmWPbcPnnNziCyIEXG+x9lKeRTLlNeDFzUhuKrujdd+XoEPpxE7P2x/ky/sOFilUGBGHb+oCf IPB+6iB843HADOFQTNMVVeAroW7VojZ0BRRR1PSPazjNrBOzlmzjUgwTMY3Dibtsa00MYpCRgSk fVt4xNGZjbmG46EabJhTalHISvaeFJCN2LrMOf73jRmcLaOHMbp1/K0H3FM/TsiTimTtbpJkzA6 xJ1Td6WHwk4f60dZsxBFxaWSi+o9pwz4eTVtu7j/HQ6W/39UccoOiQ+kQXaNFJQCuqCKerxC1sW eKpfR0aWFcQ== 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: linux-kernel@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