selftests/rseq: Implement time slice extension test

Provide an initial test case to evaluate the functionality. This needs to be
extended to cover the ABI violations and expose the race condition between
observing granted and arriving in rseq_slice_yield().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251215155709.320325431@linutronix.de
This commit is contained in:
Thomas Gleixner
2025-12-15 17:52:34 +01:00
committed by Peter Zijlstra
parent 3c78aaec19
commit 830969e782
4 changed files with 251 additions and 1 deletions

View File

@@ -53,6 +53,27 @@ struct rseq_abi_cs {
__u64 abort_ip;
} __attribute__((aligned(4 * sizeof(__u64))));
/**
* rseq_abi_slice_ctrl - Time slice extension control structure
* @all: Compound value
* @request: Request for a time slice extension
* @granted: Granted time slice extension
*
* @request is set by user space and can be cleared by user space or kernel
* space. @granted is set and cleared by the kernel and must only be read
* by user space.
*/
struct rseq_abi_slice_ctrl {
union {
__u32 all;
struct {
__u8 request;
__u8 granted;
__u16 __reserved;
};
};
};
/*
* struct rseq_abi is aligned on 4 * 8 bytes to ensure it is always
* contained within a single cache-line.
@@ -164,6 +185,12 @@ struct rseq_abi {
*/
__u32 mm_cid;
/*
* Time slice extension control structure. CPU local updates from
* kernel and user space.
*/
struct rseq_abi_slice_ctrl slice_ctrl;
/*
* Flexible array member at end of structure, after last feature field.
*/