Thread (106 messages) 106 messages, 18 authors, 2022-07-30

Re: [PATCH 17/36] acpi_idle: Remove tracing

From: "Rafael J. Wysocki" <rafael@kernel.org>
Date: 2022-07-06 13:59:47
Also in: linux-acpi, linux-alpha, linux-arch, linux-arm-msm, linux-clk, linux-m68k, linux-mips, linux-omap, linux-perf-users, linux-pm, linux-riscv, linux-s390, linux-sh, linux-tegra, linux-um, lkml, rcu, sparclinux, virtualization, xen-devel

ieu.desnoyers@efficios.com>, Frederic Weisbecker [off-list ref], Len Brown [off-list ref], linux-xtensa@linux-xtensa.org, Sascha Hauer [off-list ref], Vasily Gorbik [off-list ref], linux-arm-msm [off-list ref], linux-alpha@vger.kernel.org, linux-m68k [off-list ref], Stafford Horne [off-list ref], Linux ARM [off-list ref], Chris Zankel [off-list ref], Stephen Boyd [off-list ref], dinguyen@kernel.org, Daniel Bristot de Oliveira [off-list ref], Alexander Shishkin [off-list ref], Lorenzo Pieralisi [off-list ref], Rasmus Villemoes [off-list ref], Joel Fernandes [off-list ref], Will Deacon [off-list ref], Boris Ostrovsky [off-list ref], Kevin Hilman [off-list ref], linux-csky@vger.kernel.org, pv-drivers@vmware.com, linux-snps-arc@lists.infradead.org, Mel Gorman [off-list ref], Jacob Pan <jacob.jun.pan@linux.inte
 l.com>, Arnd Bergmann [off-list ref], ulli.kroll@googlemail.com, vgupta@kernel.org, linux-clk [off-list ref], Josh Triplett [off-list ref], Steven Rostedt [off-list ref], rcu@vger.kernel.org, Borislav Petkov [off-list ref], bcain@quicinc.com, Thomas Bogendoerfer [off-list ref], Parisc List [off-list ref], Sudeep Holla [off-list ref], Shawn Guo [off-list ref], David Miller [off-list ref], Rich Felker [off-list ref], Tony Lindgren [off-list ref], amakhalov@vmware.com, Bjorn Andersson [off-list ref], "H. Peter Anvin" [off-list ref], sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-riscv [off-list ref], anton.ivanov@cambridgegreys.com, jonas@southpole.se, Yury Norov [off-list ref], Richard Weinberger [off-list ref], the arch/x86 maintainers [off-list ref], Russell King - ARM Linux [off-list ref], Ingo Molnar [off-list ref], Al
 bert Ou [off-list ref], "Paul E. McKenney" <
paulmck@kernel.org>, Heiko Carstens [off-list ref], stefan.kristiansson@saunalahti.fi, openrisc@lists.librecores.org, Paul Walmsley [off-list ref], linux-tegra [off-list ref], namhyung@kernel.org, Andy Shevchenko [off-list ref], jpoimboe@kernel.org, Juergen Gross [off-list ref], Michal Simek [off-list ref], "open list:BROADCOM NVRAM DRIVER" [off-list ref], Palmer Dabbelt [off-list ref], Anup Patel [off-list ref], ink@jurassic.park.msu.ru, Johannes Berg [off-list ref], linuxppc-dev [off-list ref]
Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org
Sender: "Linuxppc-dev" [off-list ref]

On Wed, Jun 8, 2022 at 4:47 PM Peter Zijlstra [off-list ref] 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) <peterz@infradead.org>
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.
quoted hunk ↗ jump to hunk
---
 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;

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help