From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Peter Zijlstra <peterz@infradead.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
Boqun Feng <boqun.feng@gmail.com>,
Peter Zilstra <peterz@infradead.org>,
Jonathan Corbet <corbet@lwn.net>,
Prakash Sangappa <prakash.sangappa@oracle.com>,
Madadi Vineeth Reddy <vineethr@linux.ibm.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Steven Rostedt <rostedt@goodmis.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org
Subject: [patch V2 03/12] rseq: Provide static branch for time slice extensions
Date: Wed, 22 Oct 2025 14:57:32 +0200 (CEST) [thread overview]
Message-ID: <20251022121427.091502763@linutronix.de> (raw)
In-Reply-To: 20251022110646.839870156@linutronix.de
Guard the time slice extension functionality with a static key, which can
be disabled on the kernel command line.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
---
V2: Return 1 from __setup() - Prateek
---
include/linux/rseq_entry.h | 11 +++++++++++
kernel/rseq.c | 17 +++++++++++++++++
2 files changed, 28 insertions(+)
--- a/include/linux/rseq_entry.h
+++ b/include/linux/rseq_entry.h
@@ -75,6 +75,17 @@ DECLARE_STATIC_KEY_MAYBE(CONFIG_RSEQ_DEB
#define rseq_inline __always_inline
#endif
+#ifdef CONFIG_RSEQ_SLICE_EXTENSION
+DECLARE_STATIC_KEY_TRUE(rseq_slice_extension_key);
+
+static __always_inline bool rseq_slice_extension_enabled(void)
+{
+ return static_branch_likely(&rseq_slice_extension_key);
+}
+#else /* CONFIG_RSEQ_SLICE_EXTENSION */
+static inline bool rseq_slice_extension_enabled(void) { return false; }
+#endif /* !CONFIG_RSEQ_SLICE_EXTENSION */
+
bool rseq_debug_update_user_cs(struct task_struct *t, struct pt_regs *regs, unsigned long csaddr);
bool rseq_debug_validate_ids(struct task_struct *t);
--- a/kernel/rseq.c
+++ b/kernel/rseq.c
@@ -484,3 +484,20 @@ SYSCALL_DEFINE4(rseq, struct rseq __user
efault:
return -EFAULT;
}
+
+#ifdef CONFIG_RSEQ_SLICE_EXTENSION
+DEFINE_STATIC_KEY_TRUE(rseq_slice_extension_key);
+
+static int __init rseq_slice_cmdline(char *str)
+{
+ bool on;
+
+ if (kstrtobool(str, &on))
+ return -EINVAL;
+
+ if (!on)
+ static_branch_disable(&rseq_slice_extension_key);
+ return 1;
+}
+__setup("rseq_slice_ext=", rseq_slice_cmdline);
+#endif /* CONFIG_RSEQ_SLICE_EXTENSION */
next prev parent reply other threads:[~2025-10-22 12:57 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 12:57 [patch V2 00/12] rseq: Implement time slice extension mechanism Thomas Gleixner
2025-10-22 12:57 ` [patch V2 01/12] sched: Provide and use set_need_resched_current() Thomas Gleixner
2025-10-27 8:59 ` Sebastian Andrzej Siewior
2025-10-27 11:13 ` Thomas Gleixner
2025-10-22 12:57 ` [patch V2 02/12] rseq: Add fields and constants for time slice extension Thomas Gleixner
2025-10-22 17:28 ` Randy Dunlap
2025-10-22 12:57 ` Thomas Gleixner [this message]
2025-10-27 9:29 ` [patch V2 03/12] rseq: Provide static branch for time slice extensions Sebastian Andrzej Siewior
2025-10-22 12:57 ` [patch V2 04/12] rseq: Add statistics " Thomas Gleixner
2025-10-22 12:57 ` [patch V2 05/12] rseq: Add prctl() to enable " Thomas Gleixner
2025-10-27 9:40 ` Sebastian Andrzej Siewior
2025-10-22 12:57 ` [patch V2 06/12] rseq: Implement sys_rseq_slice_yield() Thomas Gleixner
2025-10-22 12:57 ` [patch V2 07/12] rseq: Implement syscall entry work for time slice extensions Thomas Gleixner
2025-10-22 12:57 ` [patch V2 08/12] rseq: Implement time slice extension enforcement timer Thomas Gleixner
2025-10-27 11:38 ` Sebastian Andrzej Siewior
2025-10-27 16:26 ` Thomas Gleixner
2025-10-28 8:33 ` Sebastian Andrzej Siewior
2025-10-28 8:51 ` K Prateek Nayak
2025-10-28 9:00 ` Sebastian Andrzej Siewior
2025-10-28 9:22 ` K Prateek Nayak
2025-10-28 10:22 ` Sebastian Andrzej Siewior
2025-10-28 13:04 ` Thomas Gleixner
2025-10-22 12:57 ` [patch V2 09/12] rseq: Reset slice extension when scheduled Thomas Gleixner
2025-10-22 12:57 ` [patch V2 10/12] rseq: Implement rseq_grant_slice_extension() Thomas Gleixner
2025-10-22 12:57 ` [patch V2 11/12] entry: Hook up rseq time slice extension Thomas Gleixner
2025-10-22 12:57 ` [patch V2 12/12] selftests/rseq: Implement time slice extension test Thomas Gleixner
2025-10-27 17:30 ` [patch V2 00/12] rseq: Implement time slice extension mechanism Sebastian Andrzej Siewior
2025-10-27 18:48 ` Thomas Gleixner
2025-10-28 8:53 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251022121427.091502763@linutronix.de \
--to=tglx@linutronix.de \
--cc=arnd@arndb.de \
--cc=bigeasy@linutronix.de \
--cc=boqun.feng@gmail.com \
--cc=corbet@lwn.net \
--cc=kprateek.nayak@amd.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=prakash.sangappa@oracle.com \
--cc=rostedt@goodmis.org \
--cc=vineethr@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).