[email protected]>, Frederic Weisbecker <[email protected]>, Len 
Brown <[email protected]>, [email protected], Sascha Hauer 
<[email protected]>, Vasily Gorbik <[email protected]>, linux-arm-msm 
<[email protected]>, [email protected], linux-m68k 
<[email protected]>, Stafford Horne <[email protected]>, Linux ARM 
<[email protected]>, Chris Zankel <[email protected]>, 
Stephen Boyd <[email protected]>, [email protected], Daniel Bristot de 
Oliveira <[email protected]>, Alexander Shishkin 
<[email protected]>, Lorenzo Pieralisi 
<[email protected]>, Rasmus Villemoes <[email protected]>, Joel 
Fernandes <[email protected]>, Will Deacon <[email protected]>, Boris 
Ostrovsky <[email protected]>, Kevin Hilman <[email protected]>, 
[email protected], [email protected], 
[email protected], Mel Gorman <[email protected]>, Jacob Pan 
<[email protected]
 l.com>, Arnd Bergmann <[email protected]>, [email protected], 
[email protected], linux-clk <[email protected]>, Josh Triplett 
<[email protected]>, Steven Rostedt <[email protected]>, 
[email protected], Borislav Petkov <[email protected]>, [email protected], 
Thomas Bogendoerfer <[email protected]>, Parisc List 
<[email protected]>, Sudeep Holla <[email protected]>, Shawn Guo 
<[email protected]>, David Miller <[email protected]>, Rich Felker 
<[email protected]>, Tony Lindgren <[email protected]>, [email protected], 
Bjorn Andersson <[email protected]>, "H. Peter Anvin" 
<[email protected]>, [email protected], [email protected], 
linux-riscv <[email protected]>, [email protected], 
[email protected], Yury Norov <[email protected]>, Richard Weinberger 
<[email protected]>, the arch/x86 maintainers <[email protected]>, Russell King - 
ARM Linux <[email protected]>, Ingo Molnar <[email protected]>, Al
 bert Ou <[email protected]>, "Paul E. McKenney" <
[email protected]>, Heiko Carstens <[email protected]>, 
[email protected], [email protected], Paul Walmsley 
<[email protected]>, linux-tegra <[email protected]>, 
[email protected], Andy Shevchenko <[email protected]>, 
[email protected], Juergen Gross <[email protected]>, Michal Simek 
<[email protected]>, "open list:BROADCOM NVRAM DRIVER" 
<[email protected]>, Palmer Dabbelt <[email protected]>, Anup Patel 
<[email protected]>, [email protected], Johannes Berg 
<[email protected]>, linuxppc-dev <[email protected]>
Errors-To: [email protected]
Sender: "Linuxppc-dev" 
<[email protected]>

On Wed, Jun 8, 2022 at 4:47 PM Peter Zijlstra <[email protected]> wrote:
>
> All the idle routines are called with RCU disabled, as such there must
> not be any tracing inside.
>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>

This actually does some additional code duplication cleanup which
would be good to mention in the changelog.  Or even move to a separate
patch for that matter.

Otherwise LGTM.

> ---
>  drivers/acpi/processor_idle.c |   24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
>
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -108,8 +108,8 @@ static const struct dmi_system_id proces
>  static void __cpuidle acpi_safe_halt(void)
>  {
>         if (!tif_need_resched()) {
> -               safe_halt();
> -               local_irq_disable();
> +               raw_safe_halt();
> +               raw_local_irq_disable();
>         }
>  }
>
> @@ -524,16 +524,21 @@ static int acpi_idle_bm_check(void)
>         return bm_status;
>  }
>
> -static void wait_for_freeze(void)
> +static __cpuidle void io_idle(unsigned long addr)
>  {
> +       /* IO port based C-state */
> +       inb(addr);
> +
>  #ifdef CONFIG_X86
>         /* No delay is needed if we are in guest */
>         if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
>                 return;
>  #endif
> -       /* Dummy wait op - must do something useless after P_LVL2 read
> -          because chipsets cannot guarantee that STPCLK# signal
> -          gets asserted in time to freeze execution properly. */
> +       /*
> +        * Dummy wait op - must do something useless after P_LVL2 read
> +        * because chipsets cannot guarantee that STPCLK# signal
> +        * gets asserted in time to freeze execution properly.
> +        */
>         inl(acpi_gbl_FADT.xpm_timer_block.address);
>  }
>
> @@ -553,9 +558,7 @@ static void __cpuidle acpi_idle_do_entry
>         } else if (cx->entry_method == ACPI_CSTATE_HALT) {
>                 acpi_safe_halt();
>         } else {
> -               /* IO port based C-state */
> -               inb(cx->address);
> -               wait_for_freeze();
> +               io_idle(cx->address);
>         }
>
>         perf_lopwr_cb(false);
> @@ -577,8 +580,7 @@ static int acpi_idle_play_dead(struct cp
>                 if (cx->entry_method == ACPI_CSTATE_HALT)
>                         safe_halt();
>                 else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) {
> -                       inb(cx->address);
> -                       wait_for_freeze();
> +                       io_idle(cx->address);
>                 } else
>                         return -ENODEV;
>
>
>

Reply via email to