Re: [RFC][PATCH 4/9] idle: Fix rcu_idle_*() usage

From: Peter Zijlstra
Date: Tue May 31 2022 - 05:34:25 EST


On Mon, May 23, 2022 at 03:16:11PM +0530, Gautham R. Shenoy wrote:
> On Thu, May 19, 2022 at 11:27:54PM +0200, Peter Zijlstra wrote:
> > The whole disable-RCU, enable-IRQS dance is very intricate since
> > changing IRQ state is traced, which depends on RCU.
> >
> > Add two helpers for the cpuidle case that mirror the entry code.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> > ---
>
> [...]
> >
> > --- a/drivers/cpuidle/cpuidle.c
> > +++ b/drivers/cpuidle/cpuidle.c
> > @@ -13,6 +13,7 @@
> > #include <linux/mutex.h>
> > #include <linux/sched.h>
> > #include <linux/sched/clock.h>
> > +#include <linux/sched/idle.h>
> > #include <linux/notifier.h>
> > #include <linux/pm_qos.h>
> > #include <linux/cpu.h>
> > @@ -150,12 +151,12 @@ static void enter_s2idle_proper(struct c
> > */
> > stop_critical_timings();
> > if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
> > - rcu_idle_enter();
> > + cpuidle_rcu_enter();
> > target_state->enter_s2idle(dev, drv, index);
> > if (WARN_ON_ONCE(!irqs_disabled()))
> > - local_irq_disable();
> > + raw_local_irq_disable();
> > if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
> > - rcu_idle_exit();
> > + cpuidle_rcu_enter();
>
> Shouldn't this be cpuidle_rcu_exit() ?

Yes, very much so... soon I should buy a new supply of brown paper bags
:-)