mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 13:19:56 -04:00
rseq: Add fields and constants for time slice extension
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
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251215155708.669472597@linutronix.de
This commit is contained in:
committed by
Peter Zijlstra
parent
4fe82cf302
commit
d7a5da7a0f
@@ -23,9 +23,15 @@ enum rseq_flags {
|
||||
};
|
||||
|
||||
enum rseq_cs_flags_bit {
|
||||
/* Historical and unsupported bits */
|
||||
RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT = 0,
|
||||
RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT = 1,
|
||||
RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2,
|
||||
/* (3) Intentional gap to put new bits into a separate byte */
|
||||
|
||||
/* User read only feature flags */
|
||||
RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE_BIT = 4,
|
||||
RSEQ_CS_FLAG_SLICE_EXT_ENABLED_BIT = 5,
|
||||
};
|
||||
|
||||
enum rseq_cs_flags {
|
||||
@@ -35,6 +41,11 @@ enum rseq_cs_flags {
|
||||
(1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT),
|
||||
RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE =
|
||||
(1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT),
|
||||
|
||||
RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE =
|
||||
(1U << RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE_BIT),
|
||||
RSEQ_CS_FLAG_SLICE_EXT_ENABLED =
|
||||
(1U << RSEQ_CS_FLAG_SLICE_EXT_ENABLED_BIT),
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -53,6 +64,27 @@ struct rseq_cs {
|
||||
__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_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.
|
||||
@@ -141,6 +173,12 @@ struct rseq {
|
||||
*/
|
||||
__u32 mm_cid;
|
||||
|
||||
/*
|
||||
* Time slice extension control structure. CPU local updates from
|
||||
* kernel and user space.
|
||||
*/
|
||||
struct rseq_slice_ctrl slice_ctrl;
|
||||
|
||||
/*
|
||||
* Flexible array member at end of structure, after last feature field.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user