Add 'slice_control' feature to the ABI Introduced in Linux v7.0, add it to our ABI header. Change-Id: I27280ccf98e25fb8fab3cdc85d273220d9f6df7d Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
diff --git a/include/rseq/abi.h b/include/rseq/abi.h index 9be5659..fd4963e 100644 --- a/include/rseq/abi.h +++ b/include/rseq/abi.h
@@ -58,6 +58,27 @@ __u64 abort_ip; } __attribute__((aligned(4 * sizeof(__u64)))); +/** + * rseq_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 is aligned on 4 * 8 bytes to ensure it is always * contained within a single cache-line. @@ -173,10 +194,16 @@ __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. */ char end[]; -} __attribute__((aligned(4 * sizeof(__u64)))); +} __attribute__((aligned(32))); /* * Define the rseq system call number if not yet available in
diff --git a/include/rseq/rseq.h b/include/rseq/rseq.h index 4e11ada..0c34f87 100644 --- a/include/rseq/rseq.h +++ b/include/rseq/rseq.h
@@ -231,6 +231,15 @@ } /* + * Returns true if the 'slice_ctrl' feature is available. + */ +static inline __attribute__((always_inline)) +bool rseq_slice_ctrl_available(void) +{ + return (int) rseq_size >= (int) rseq_offsetofend(struct rseq_abi, slice_ctrl); +} + +/* * Clear the rseq_cs pointer. */ static inline __attribute__((always_inline))