From nobody Tue Dec 16 21:10:25 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 C0DC5346774; Mon, 15 Dec 2025 16:52:34 +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=1765817556; cv=none; b=XhefZwdO0zFrqbtWKkTHfw6TPLSFN7eHbd8f4/FdDdPK8AIBght06tBOils/6KeWGKH3ZqlYu+6ce5Om2femsioqv++ITZrwh85abMEC9ubdosUsCKQDR73YmEc96fGvlBTNWFvOUruGnGDPGwGX0gnXFnzgQLHaPYc8KMVjTfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765817556; c=relaxed/simple; bh=RhXdOrpmvWhEXZAJBOlVp00/Ibtc92pO9VfibfnzKL4=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=ezZa0YgUNzS+wFcN+zzJoI+tqKQvaHfo/laW31n8XKYzgBklop5vOoH2/0siKrTrRfIPC0uzhiQ7SUlx7fQOmjl5NRf7xvUBz90xcqdiPg0MwAr78QjMT3sjdB7PgQPUNSDuG2K8GKc+Z+MHCSWDABqmDvSe/9uLCE6P6DS51y4= 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=e5H6dLen; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3u5S2Jqz; 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="e5H6dLen"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3u5S2Jqz" Message-ID: <20251215155709.258157362@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1765817553; 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=gQFvLoA+8aqRp49/IJYirlydqYT+cxE6z9BZ2w2sdfQ=; b=e5H6dLenjxqDilMNKPMN5Ar3hVRmCaOf2Qr7mpkheVvrfMOV5qrFXcnQu+PEUHuhgIJ6dS XbDpfGt/wjCmsEuObXmQOj4mBw2ZGWJmErIzRJlRYh0x9DQ6ljm21ZQ6Taf5KFmCWhtNtv dRH4YdNtHKC/SahgNNeYtSxJ7c/bN0zO/hmep2oYN6BO7wR32no27FbHcpLuKx1ZUGxkLY 4H2ha2pijCGzg89UiXKO0+LMJ/Gwjn12WmWSZ4sO0QNNnWXE2tSONpbpUddyblKMuU6/zi kDp58wFfshlFEF7Qodud0KPhGpkIVl13veCm5RFypiUyjwia0vQgX61qh6NrTg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1765817553; 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=gQFvLoA+8aqRp49/IJYirlydqYT+cxE6z9BZ2w2sdfQ=; b=3u5S2JqzhxyvoHf7FYlOFTNCe2FuNXAwGRLW2TIhBb1K1GEtt2w1didBMuj6UBml1oHJsu Q/vjGOt4/204JtAA== From: Thomas Gleixner To: LKML Cc: Mathieu Desnoyers , "Paul E. McKenney" , Boqun Feng , Jonathan Corbet , Prakash Sangappa , Madadi Vineeth Reddy , K Prateek Nayak , Steven Rostedt , Sebastian Andrzej Siewior , Arnd Bergmann , linux-arch@vger.kernel.org, Randy Dunlap , Peter Zijlstra , Ron Geva , Waiman Long Subject: [patch V6 10/11] entry: Hook up rseq time slice extension References: <20251215155615.870031952@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Mon, 15 Dec 2025 17:52:31 +0100 (CET) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Wire the grant decision function up in exit_to_user_mode_loop() Signed-off-by: Thomas Gleixner Cc: Mathieu Desnoyers Cc: Peter Zijlstra Cc: "Paul E. McKenney" Cc: Boqun Feng --- kernel/entry/common.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -17,6 +17,14 @@ void __weak arch_do_signal_or_restart(st #define EXIT_TO_USER_MODE_WORK_LOOP (EXIT_TO_USER_MODE_WORK) #endif =20 +/* TIF bits, which prevent a time slice extension. */ +#ifdef CONFIG_PREEMPT_RT +# define TIF_SLICE_EXT_SCHED (_TIF_NEED_RESCHED_LAZY) +#else +# define TIF_SLICE_EXT_SCHED (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY) +#endif +#define TIF_SLICE_EXT_DENY (EXIT_TO_USER_MODE_WORK & ~TIF_SLICE_EXT_SCHED) + static __always_inline unsigned long __exit_to_user_mode_loop(struct pt_re= gs *regs, unsigned long ti_work) { @@ -28,8 +36,10 @@ static __always_inline unsigned long __e =20 local_irq_enable_exit_to_user(ti_work); =20 - if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)) - schedule(); + if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)) { + if (!rseq_grant_slice_extension(ti_work & TIF_SLICE_EXT_DENY)) + schedule(); + } =20 if (ti_work & _TIF_UPROBE) uprobe_notify_resume(regs);