[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPjcmhnOm1R-9euo@google.com>
Date: Wed, 22 Oct 2025 06:31:06 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>, Michael Jeanson <mjeanson@...icios.com>,
Jens Axboe <axboe@...nel.dk>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Peter Zijlstra <peterz@...radead.org>, "Paul E. McKenney" <paulmck@...nel.org>, x86@...nel.org,
Wei Liu <wei.liu@...nel.org>
Subject: Re: [patch V5 25/31] rseq: Rework the TIF_NOTIFY handler
On Wed, Oct 22, 2025, Thomas Gleixner wrote:
> ---
> include/linux/rseq_entry.h | 29 +++++++++++++++++
> kernel/rseq.c | 76 +++++++++++++++++++--------------------------
> 2 files changed, 62 insertions(+), 43 deletions(-)
> --- a/include/linux/rseq_entry.h
> +++ b/include/linux/rseq_entry.h
> @@ -368,6 +368,35 @@ bool rseq_set_ids_get_csaddr(struct task
> return false;
> }
>
> +/*
> + * Update user space with new IDs and conditionally check whether the task
> + * is in a critical section.
> + */
> +static rseq_inline bool rseq_update_usr(struct task_struct *t, struct pt_regs *regs,
> + struct rseq_ids *ids, u32 node_id)
> +{
> + u64 csaddr;
> +
> + if (!rseq_set_ids_get_csaddr(t, ids, node_id, &csaddr))
> + return false;
> +
> + /*
> + * On architectures which utilize the generic entry code this
> + * allows to skip the critical section when the entry was not from
> + * a user space interrupt, unless debug mode is enabled.
> + */
> + if (IS_ENABLED(CONFIG_GENERIC_IRQ_ENTRY)) {
> + if (!static_branch_unlikely(&rseq_debug_enabled)) {
> + if (likely(!t->rseq.event.user_irq))
> + return true;
> + }
> + }
This can be:
if (IS_ENABLED(CONFIG_GENERIC_IRQ_ENTRY) &&
!static_branch_unlikely(&rseq_debug_enabled) &&
likely(!t->rseq.event.user_irq))
return true;
> + if (likely(!csaddr))
> + return true;
> + /* Sigh, this really needs to do work */
> + return rseq_update_user_cs(t, regs, csaddr);
> +}
> +
> static __always_inline void rseq_exit_to_user_mode(void)
> {
> struct rseq_event *ev = ¤t->rseq.event;
Powered by blists - more mailing lists