2022-06-08 15:21:34

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH 33/36] cpuidle,omap3: Use WFI for omap3_pm_idle()

arch_cpu_idle() is a very simple idle interface and exposes only a
single idle state and is expected to not require RCU and not do any
tracing/instrumentation.

As such, omap_sram_idle() is not a valid implementation. Replace it
with the simple (shallow) omap3_do_wfi() call. Leaving the more
complicated idle states for the cpuidle driver.

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
---
arch/arm/mach-omap2/pm34xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -294,7 +294,7 @@ static void omap3_pm_idle(void)
if (omap_irq_pending())
return;

- omap_sram_idle();
+ omap3_do_wfi();
}

#ifdef CONFIG_SUSPEND



2022-06-08 18:26:54

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 33/36] cpuidle,omap3: Use WFI for omap3_pm_idle()

On Wed, Jun 8, 2022 at 4:27 PM Peter Zijlstra <[email protected]> wrote:
>
> arch_cpu_idle() is a very simple idle interface and exposes only a
> single idle state and is expected to not require RCU and not do any
> tracing/instrumentation.
>
> As such, omap_sram_idle() is not a valid implementation. Replace it
> with the simple (shallow) omap3_do_wfi() call. Leaving the more
> complicated idle states for the cpuidle driver.
>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>

I see similar code in omap2:

omap2_pm_idle()
-> omap2_enter_full_retention()
-> omap2_sram_suspend()

Is that code path safe to use without RCU or does it need a similar change?

Arnd

2022-06-09 08:21:16

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH 33/36] cpuidle,omap3: Use WFI for omap3_pm_idle()

* Arnd Bergmann <[email protected]> [220608 18:18]:
> On Wed, Jun 8, 2022 at 4:27 PM Peter Zijlstra <[email protected]> wrote:
> >
> > arch_cpu_idle() is a very simple idle interface and exposes only a
> > single idle state and is expected to not require RCU and not do any
> > tracing/instrumentation.
> >
> > As such, omap_sram_idle() is not a valid implementation. Replace it
> > with the simple (shallow) omap3_do_wfi() call. Leaving the more
> > complicated idle states for the cpuidle driver.

Agreed it makes sense to limit deeper idle states to cpuidle. Hopefully
there is some informative splat for attempting to use arch_cpu_ide()
for deeper idle states :)

> I see similar code in omap2:
>
> omap2_pm_idle()
> -> omap2_enter_full_retention()
> -> omap2_sram_suspend()
>
> Is that code path safe to use without RCU or does it need a similar change?

Seems like a similar change should be done for omap2. Then anybody who
cares to implement a minimal cpuidle support can do so.

Regards,

Tony

2022-06-09 09:58:13

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 33/36] cpuidle,omap3: Use WFI for omap3_pm_idle()

On Wed, Jun 08, 2022 at 06:28:33PM +0200, Arnd Bergmann wrote:
> On Wed, Jun 8, 2022 at 4:27 PM Peter Zijlstra <[email protected]> wrote:
> >
> > arch_cpu_idle() is a very simple idle interface and exposes only a
> > single idle state and is expected to not require RCU and not do any
> > tracing/instrumentation.
> >
> > As such, omap_sram_idle() is not a valid implementation. Replace it
> > with the simple (shallow) omap3_do_wfi() call. Leaving the more
> > complicated idle states for the cpuidle driver.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
>
> I see similar code in omap2:
>
> omap2_pm_idle()
> -> omap2_enter_full_retention()
> -> omap2_sram_suspend()
>
> Is that code path safe to use without RCU or does it need a similar change?

It needs a similar change, clearly I was running on fumes to not have
found that when grepping around the omap code :/

2022-06-09 10:00:16

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 33/36] cpuidle,omap3: Use WFI for omap3_pm_idle()

On Thu, Jun 09, 2022 at 10:39:22AM +0300, Tony Lindgren wrote:
> * Arnd Bergmann <[email protected]> [220608 18:18]:
> > On Wed, Jun 8, 2022 at 4:27 PM Peter Zijlstra <[email protected]> wrote:
> > >
> > > arch_cpu_idle() is a very simple idle interface and exposes only a
> > > single idle state and is expected to not require RCU and not do any
> > > tracing/instrumentation.
> > >
> > > As such, omap_sram_idle() is not a valid implementation. Replace it
> > > with the simple (shallow) omap3_do_wfi() call. Leaving the more
> > > complicated idle states for the cpuidle driver.
>
> Agreed it makes sense to limit deeper idle states to cpuidle. Hopefully
> there is some informative splat for attempting to use arch_cpu_ide()
> for deeper idle states :)

The arch_cpu_idle() interface doesn't allow one to express a desire for
deeper states. I'm not sure how anyone could even attempt this.

But given what OMAP needs to go deeper, this would involve things that
require RCU, combine that with the follow up patches that rip out all
the trace_.*_rcuidle() hackery from the power and clock domain code,
PROVE_RCU should scream if anybody were to attempt it.

2022-06-13 16:38:59

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH 33/36] cpuidle,omap3: Use WFI for omap3_pm_idle()

* Peter Zijlstra <[email protected]> [220608 14:52]:
> arch_cpu_idle() is a very simple idle interface and exposes only a
> single idle state and is expected to not require RCU and not do any
> tracing/instrumentation.
>
> As such, omap_sram_idle() is not a valid implementation. Replace it
> with the simple (shallow) omap3_do_wfi() call. Leaving the more
> complicated idle states for the cpuidle driver.

Acked-by: Tony Lindgren <[email protected]>