From nobody Mon Dec 1 22:03:45 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 3B4C528A3FA; Mon, 1 Dec 2025 07:06:41 +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=1764572803; cv=none; b=P3Y8UWiheMcXw6PktyFIVF864XvUtIKCzpAn0aAFELnIoQfHndeiE3ToNdrOSabunGE2ZD7rvYw1+KXB7+zTlgHvPooq0j8oKlyz9zdCGn95X1kZrlJzcuP63e1EdmX8HuHTEu9FR2rCXl7d5qqUOvfiW+37eGc08wKrMInLBTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764572803; c=relaxed/simple; bh=RhXdOrpmvWhEXZAJBOlVp00/Ibtc92pO9VfibfnzKL4=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=ULlOUcJjLjKBOgC/oPBIa7S7sAuuc7ApX8rZrmIbPYnUeFZVA0V8huK2Y3Dgi1NWu83MPRPoL3T16JY3vO5d9H/QG6/CNcsjUfZwlKEzEX//btcrFkwOtkC5t12NacdRMtoP1tO380q2NPcVgzmBHZ/TTlAJSMzOa5movkzUw58= 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=g2H+9FLJ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=DDj5aq0N; 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="g2H+9FLJ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DDj5aq0N" Message-ID: <20251128230241.286446179@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1764572800; 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=g2H+9FLJ3AAr6TEx4aZfUVSaTpTVBfsKjuSbJlQv86I7HS6524njxNg6yfv+5hvwcAKDG+ bJmUyCYFPWvp77IqZ6PBVH+/AqI3Ps0zwgDkAniRx3krJ1S0IEbNgDILdyv1tfdGzwHcFs SAGbqO4FHK5BQcWTSKpNQFa0s2jkbJcyonFI7b6XMV0gaE5PMZ8di2oLKvPQTAdYtDOPfC rZiShMZX6LoNODqOCTWRSXs5CI/lJCea+D/Q7kgdnFuFCsK0Z6/0rCAlatZXfls+MmIgSV Rq5XJOb4zniuvgNFRFS8/cWY0Me7F8QK/tfe6tFeu+WkG4HO88ir5CXfPaWt6g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1764572800; 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=DDj5aq0N+lEuEWEEUTTW8X37QPJtm4RsenK1IZCcDuCxDe1G2SvuUgHLAh9RbOLlJvM7rt c1iMRVWzA3vG5FAQ== 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 V5 10/11] entry: Hook up rseq time slice extension References: <20251128225931.959481199@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Mon, 1 Dec 2025 08:06:35 +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);