[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251028102205.D6mh4eAL@linutronix.de>
Date: Tue, 28 Oct 2025 11:22:05 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: K Prateek Nayak <kprateek.nayak@....com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Peter Zijlstra <peterz@...radead.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
Boqun Feng <boqun.feng@...il.com>, Jonathan Corbet <corbet@....net>,
Prakash Sangappa <prakash.sangappa@...cle.com>,
Madadi Vineeth Reddy <vineethr@...ux.ibm.com>,
Steven Rostedt <rostedt@...dmis.org>, Arnd Bergmann <arnd@...db.de>,
linux-arch@...r.kernel.org
Subject: Re: [patch V2 08/12] rseq: Implement time slice extension
enforcement timer
On 2025-10-28 14:52:09 [+0530], K Prateek Nayak wrote:
> On 10/28/2025 2:30 PM, Sebastian Andrzej Siewior wrote:
> >>> Without an interrupt on the target CPU, there is nothing stopping the
> >>> task from overstepping its fair share.
> >>
> >> When the task moves CPU, the rseq_exit_user_update() would clear all
> >> of the slice extension state before running the task again. The task
> >> will start off again with "rseq->slice_ctrl.request" and
> >> "rseq->slice_ctrl.granted" both at 0 signifying the task was
> >> rescheduled.
> >
> > I wasn't aware this is done once the task is in userland and then
> > relocated to another CPU.
>
> The exact path based on my understanding is:
>
> /* Task migrates to another CPU; Has to resume from kernel. */
> __schedule()
> context_switch()
> rseq_sched_switch_event()
> t->rseq.event.sched_switch = true;
> set_tsk_thread_flag(t, TIF_RSEQ);
>
> ...
> exit_to_user_mode_loop()
> rseq_exit_to_user_mode_restart()
> __rseq_exit_to_user_mode_restart()
> /* Sees t->rseq.event.sched_switch to be true. */
> rseq_exit_user_update()
> if (rseq_slice_extension_enabled())
> unsafe_put_user(0U, &rseq->slice_ctrl.all, efault); /* Unconditionally clears all of "rseq_ctrl" */
You are right. The migration thread preempts it on the old CPU and then
it gets scheduled in on the new CPU.
Sebastian
Powered by blists - more mailing lists