Re: [patch V3 02/12] rseq: Add fields and constants for time slice extension
From: Thomas Gleixner
Date: Fri Oct 31 2025 - 10:32:58 EST
On Thu, Oct 30 2025 at 22:01, Prakash Sangappa wrote:
>> On Oct 29, 2025, at 6:22 AM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>>
>> Aside of a Kconfig knob add the following items:
>>
>> - Two flag bits for the rseq user space ABI, which allow user space to
>> query the availability and enablement without a syscall.
>>
>> - A new member to the user space ABI struct rseq, which is going to be
>> used to communicate request and grant between kernel and user space.
>>
>> - A rseq state struct to hold the kernel state of this
>>
>> - Documentation of the new mechanism
>>
> […]
>> +
>> +If both the request bit and the granted bit are false when leaving the
>> +critical section, then this indicates that a grant was revoked and no
>> +further action is required by userspace.
>> +
>> +The required code flow is as follows::
>> +
>> + rseq->slice_ctrl.request = 1;
>> + critical_section();
>> + if (rseq->slice_ctrl.granted)
>> + rseq_slice_yield();
>> +
>> +As all of this is strictly CPU local, there are no atomicity requirements.
>> +Checking the granted state is racy, but that cannot be avoided at all::
>> +
>> + if (rseq->slice_ctrl & GRANTED)
> Could this be?
> if (rseq->slice_ctrl.granted)
Yes.