From nobody Fri Oct 3 23:04:50 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F312E2EF662 for ; Sat, 23 Aug 2025 16:39:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755967189; cv=none; b=DBID4vZ3pR6DZFnrXHE44F3O/9YsYR9Eey+8NQXti9puzzOkeqpdw+a8yWSmAcFM9ZJS2T7EumgHtRYEiOpmPayBYf7njC9zd2WdtJOAbja4q/ockbCvXycxrX/evKNjQ+7EgBISF+mTcDfQjj/qfAi6wvGjv4rE2vNgv2yFSGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755967189; c=relaxed/simple; bh=ZweXSPz6QuEnl5pJKupeYVZ//OISnoj+Hclj7xxALFc=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=T07rpYafeRNywv/Lyxb+V+gH+8ueogmsRni99HH73q5ToZ2LFhPc5jxKB3LUVXZ3WzqQrf3KAwsLs9CnlRmBgJqc/he75AoUX9unkmQPVsY725Fz2mi9iy7o0JnYpMobAluursD/Oj2X+ZJRXLptdY/4pyY25QMgkQ96lnfPXiY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tpFl5S9l; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Tpm3Mpvk; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tpFl5S9l"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Tpm3Mpvk" Message-ID: <20250823161654.292334353@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1755967186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=X1p8CYCrwTeHl6w7ZxboATWMSxsZCeOES6hcV4qR6j4=; b=tpFl5S9lLJcLkjFc88nXRasoOEwjc8YChN32rvT9aZ5vB27KYDK8f/9AQAd8jTIe/g1Bni /f3QGzgOoTTsDFhhJFdSflmymFbU2VBudQCsL32F1041iB41K9Nx/FuPmTaumtP75ns8Mr 7YZjc5qXlOYYekvlGmyT0v46BexeLdpuz4CPeO3x91PF3UzYD6HHfaIy/D9RbVKvN6jUxK ABJpAkLwZMqD/YEf8XtBo4BxW3CvPg12wJVFKuOBCcL6qj8r6HOsFopt/THmB1p61CATpm YiWBD6yZHGeCtoa1cPUEY/mV7+2oo5QULR96D+aF7ljECfxovDgsqktTmOTH6w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1755967186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=X1p8CYCrwTeHl6w7ZxboATWMSxsZCeOES6hcV4qR6j4=; b=Tpm3MpvkaYe1P07NEMSo32tA44s6JMV6nt0dbHCKFXRpdOfMEJ7O4SFaYNCOPjPR+eMmPb UjO7aXiYcrrO3VBw== From: Thomas Gleixner To: LKML Cc: Jens Axboe , Mathieu Desnoyers , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Paolo Bonzini , Sean Christopherson , Wei Liu , Dexuan Cui , x86@kernel.org, Arnd Bergmann , Heiko Carstens , Christian Borntraeger , Sven Schnelle , Huacai Chen , Paul Walmsley , Palmer Dabbelt Subject: [patch V2 16/37] rseq: Provide tracepoint wrappers for inline code References: <20250823161326.635281786@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Sat, 23 Aug 2025 18:39:45 +0200 (CEST) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Provide tracepoint wrappers for the upcoming RSEQ exit to user space inline fast path, so that the header can be safely included by code which defines actual trace points. Signed-off-by: Thomas Gleixner Reviewed-by: Mathieu Desnoyers --- include/linux/rseq_entry.h | 30 ++++++++++++++++++++++++++++++ kernel/rseq.c | 17 +++++++++++++++++ 2 files changed, 47 insertions(+) --- a/include/linux/rseq_entry.h +++ b/include/linux/rseq_entry.h @@ -5,6 +5,36 @@ #ifdef CONFIG_RSEQ #include =20 +#include + +#ifdef CONFIG_TRACEPOINTS +DECLARE_TRACEPOINT(rseq_update); +DECLARE_TRACEPOINT(rseq_ip_fixup); +void __rseq_trace_update(struct task_struct *t); +void __rseq_trace_ip_fixup(unsigned long ip, unsigned long start_ip, + unsigned long offset, unsigned long abort_ip); + +static inline void rseq_trace_update(struct task_struct *t, struct rseq_id= s *ids) +{ + if (tracepoint_enabled(rseq_update)) { + if (ids) + __rseq_trace_update(t); + } +} + +static inline void rseq_trace_ip_fixup(unsigned long ip, unsigned long sta= rt_ip, + unsigned long offset, unsigned long abort_ip) +{ + if (tracepoint_enabled(rseq_ip_fixup)) + __rseq_trace_ip_fixup(ip, start_ip, offset, abort_ip); +} + +#else /* CONFIG_TRACEPOINT */ +static inline void rseq_trace_update(struct task_struct *t) { } +static inline void rseq_trace_ip_fixup(unsigned long ip, unsigned long sta= rt_ip, + unsigned long offset, unsigned long abort_ip) { } +#endif /* !CONFIG_TRACEPOINT */ + static __always_inline void rseq_note_user_irq_entry(void) { if (IS_ENABLED(CONFIG_GENERIC_IRQ_ENTRY)) --- a/kernel/rseq.c +++ b/kernel/rseq.c @@ -91,6 +91,23 @@ RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL | \ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE) =20 +#ifdef CONFIG_TRACEPOINTS +/* + * Out of line, so the actual update functions can be in a header to be + * inlined into the exit to user code. + */ +void __rseq_trace_update(struct task_struct *t) +{ + trace_rseq_update(t); +} + +void __rseq_trace_ip_fixup(unsigned long ip, unsigned long start_ip, + unsigned long offset, unsigned long abort_ip) +{ + trace_rseq_ip_fixup(ip, start_ip, offset, abort_ip); +} +#endif /* CONFIG_TRACEPOINTS */ + #ifdef CONFIG_DEBUG_RSEQ static struct rseq *rseq_kernel_fields(struct task_struct *t) {