Re: [patch V4 06/36] rseq: Simplify the event notification

Mathieu Desnoyers
2025-09-09T13:18:28Z

On 2025-09-08 17:31, Thomas Gleixner wrote:
> Since commit 0190e4198e47 ("rseq: Deprecate RSEQ_CS_FLAG_NO_RESTART_ON_*
> flags") the bits in task::rseq_event_mask are meaningless and just extra
> work in terms of setting them individually.
>
> Aside of that the only relevant point where an event has to be raised is
> context switch. Neither the CPU nor MM CID can change without going through
> a context switch.
>
> Collapse them all into a single boolean which simplifies the code a lot and
> remove the pointless invocations which have been sprinkled all over the
> place for no value.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Boqun Feng <boqun.feng@gmail.com>
>
> ---
> V2: Reduce it to the sched switch event.
> ---
> fs/exec.c | 2 -
> include/linux/rseq.h | 66 +++++++++-------------------------------------
> include/linux/sched.h | 10 +++---
> include/uapi/linux/rseq.h | 21 ++++----------
> kernel/rseq.c | 28 +++++++++++--------
> kernel/sched/core.c | 5 ---
> kernel/sched/membarrier.c | 8 ++---
> 7 files changed, 48 insertions(+), 92 deletions(-)
> ---
>

[...]

> --- a/include/uapi/linux/rseq.h
> +++ b/include/uapi/linux/rseq.h
> @@ -114,20 +114,13 @@ struct rseq {
> /*
> * Restartable sequences flags field.
> *
> - * This field should only be updated by the thread which
> - * registered this data structure. Read by the kernel.
> - * Mainly used for single-stepping through rseq critical sections
> - * with debuggers.
> - *
> - * - RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT
> - * Inhibit instruction sequence block restart on preemption
> - * for this thread.
> - * - RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL
> - * Inhibit instruction sequence block restart on signal
> - * delivery for this thread.
> - * - RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE
> - * Inhibit instruction sequence block restart on migration for
> - * this thread.
> + * This field was initialy intended to allow event masking for for

initialy -> initially

for for -> for

Other than those nits:

Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

--
Mathieu Desnoyers
EfficiOS Inc.