[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87plbyu4r1.ffs@tglx>
Date: Wed, 10 Sep 2025 09:49:06 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: K Prateek Nayak <kprateek.nayak@....com>, LKML
<linux-kernel@...r.kernel.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, "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>, Sebastian
Andrzej Siewior <bigeasy@...utronix.de>, Arnd Bergmann <arnd@...db.de>,
linux-arch@...r.kernel.org
Subject: Re: [patch 07/12] rseq: Implement syscall entry work for time slice
extensions
On Wed, Sep 10 2025 at 10:52, K. Prateek Nayak wrote:
> On 9/9/2025 4:30 AM, Thomas Gleixner wrote:
>> +static inline void rseq_slice_set_need_resched(struct task_struct *curr)
>> +{
>> + /*
>> + * The interrupt guard is required to prevent inconsistent state in
>> + * this case:
>> + *
>> + * set_tsk_need_resched()
>> + * --> Interrupt
>> + * wakeup()
>> + * set_tsk_need_resched()
>> + * set_preempt_need_resched()
>> + * schedule_on_return()
>> + * clear_tsk_need_resched()
>> + * clear_preempt_need_resched()
>> + * set_preempt_need_resched() <- Inconsistent state
>> + *
>> + * This is safe vs. a remote set of TIF_NEED_RESCHED because that
>> + * only sets the already set bit and does not create inconsistent
>> + * state.
>> + */
>> + scoped_guard(irq)
>> + set_need_resched_current();
>
> nit. any specific reason for using a scoped_guard() instead of just a
> guard() here (and in rseq_cancel_slice_extension_timer()) other than to
> prominently highlight what is being guarded?
Yes, the intention was to highlight it and scoped_guard() really
does. From a code generation perspective it's the same outcome.
Thanks,
tglx
Powered by blists - more mailing lists