[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f27bc532-f87b-4a46-9ffb-b38409b02c97@amd.com>
Date: Tue, 28 Oct 2025 14:52:09 +0530
From: K Prateek Nayak <kprateek.nayak@....com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
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 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" */
--
Thanks and Regards,
Prateek
Powered by blists - more mailing lists