selftests/rseq: Implement rseq mm_cid field support
Add support for the mm_cid field (per-memory-map concurrency ID) of struct rseq to rseq selftests. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20221122203932.231377-11-mathieu.desnoyers@efficios.com
This commit is contained in:
parent
72cb1d7f2f
commit
18c2355838
|
@ -155,6 +155,15 @@ struct rseq_abi {
|
|||
*/
|
||||
__u32 node_id;
|
||||
|
||||
/*
|
||||
* Restartable sequences mm_cid field. Updated by the kernel. Read by
|
||||
* user-space with single-copy atomicity semantics. This field should
|
||||
* only be read by the thread which registered this data structure.
|
||||
* Aligned on 32-bit. Contains the current thread's concurrency ID
|
||||
* (allocated uniquely within a memory map).
|
||||
*/
|
||||
__u32 mm_cid;
|
||||
|
||||
/*
|
||||
* Flexible array member at end of structure, after last feature field.
|
||||
*/
|
||||
|
|
|
@ -191,6 +191,16 @@ static inline uint32_t rseq_current_node_id(void)
|
|||
return RSEQ_ACCESS_ONCE(rseq_get_abi()->node_id);
|
||||
}
|
||||
|
||||
static inline bool rseq_mm_cid_available(void)
|
||||
{
|
||||
return (int) rseq_feature_size >= rseq_offsetofend(struct rseq_abi, mm_cid);
|
||||
}
|
||||
|
||||
static inline uint32_t rseq_current_mm_cid(void)
|
||||
{
|
||||
return RSEQ_ACCESS_ONCE(rseq_get_abi()->mm_cid);
|
||||
}
|
||||
|
||||
static inline void rseq_clear_rseq_cs(void)
|
||||
{
|
||||
RSEQ_WRITE_ONCE(rseq_get_abi()->rseq_cs.arch.ptr, 0);
|
||||
|
|
Loading…
Reference in New Issue