[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220520210008.GM1790663@paulmck-ThinkPad-P17-Gen-1>
Date: Fri, 20 May 2022 14:00:08 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: frederic@...nel.org, rjw@...ysocki.net, x86@...nel.org,
linux-kernel@...r.kernel.org, jpoimboe@...nel.org
Subject: Re: [RFC][PATCH 5/9] rcu: Fix rcu_idle_exit()
On Thu, May 19, 2022 at 11:27:55PM +0200, Peter Zijlstra wrote:
> Current rcu_idle_exit() is terminally broken because it uses
> local_irq_{save,restore}(), which are traced which uses RCU.
>
> However, now that all the callers are sure to have IRQs disabled, we
> can remove these calls.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
This looks good to me. If there are any callers with IRQs still
enabled, the lockdep_assert_irqs_disabled() should catch them.
And yes, after looking at the definition, I agree that it is just
fine to invoke lockdep_assert_irqs_disabled() from noinstr code.
The underlying __WARN_printf() might need an RCU_NONIDLE() or
equivalent, but if so that is a separate issue.
Acked-by: Paul E. McKenney <paulmck@...nel.org>
> ---
> kernel/rcu/tree.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -659,7 +659,7 @@ static noinstr void rcu_eqs_enter(bool u
> * If you add or remove a call to rcu_idle_enter(), be sure to test with
> * CONFIG_RCU_EQS_DEBUG=y.
> */
> -void rcu_idle_enter(void)
> +void noinstr rcu_idle_enter(void)
> {
> lockdep_assert_irqs_disabled();
> rcu_eqs_enter(false);
> @@ -896,13 +896,10 @@ static void noinstr rcu_eqs_exit(bool us
> * If you add or remove a call to rcu_idle_exit(), be sure to test with
> * CONFIG_RCU_EQS_DEBUG=y.
> */
> -void rcu_idle_exit(void)
> +void noinstr rcu_idle_exit(void)
> {
> - unsigned long flags;
> -
> - local_irq_save(flags);
> + lockdep_assert_irqs_disabled();
> rcu_eqs_exit(false);
> - local_irq_restore(flags);
> }
> EXPORT_SYMBOL_GPL(rcu_idle_exit);
>
>
>
Powered by blists - more mailing lists