[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 05/36] cpuidle: Move IRQ state validation
- To: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
- From: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
- Date: Wed, 6 Jul 2022 15:54:32 +0200
- Cc: rth@xxxxxxxxxxx, ink@xxxxxxxxxxxxxxxxxxxx, mattst88@xxxxxxxxx, vgupta@xxxxxxxxxx, Russell King - ARM Linux <linux@xxxxxxxxxxxxxxx>, ulli.kroll@xxxxxxxxxxxxxx, Linus Walleij <linus.walleij@xxxxxxxxxx>, Shawn Guo <shawnguo@xxxxxxxxxx>, Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>, Sascha Hauer <kernel@xxxxxxxxxxxxxx>, Fabio Estevam <festevam@xxxxxxxxx>, dl-linux-imx <linux-imx@xxxxxxx>, Tony Lindgren <tony@xxxxxxxxxxx>, Kevin Hilman <khilman@xxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, bcain@xxxxxxxxxxx, Huacai Chen <chenhuacai@xxxxxxxxxx>, kernel@xxxxxxxxxx, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>, sammy@xxxxxxxxx, Michal Simek <monstr@xxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, dinguyen@xxxxxxxxxx, jonas@xxxxxxxxxxxx, stefan.kristiansson@xxxxxxxxxxxxx, Stafford Horne <shorne@xxxxxxxxx>, James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxx>, Paul Walmsley <paul.walmsley@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Albert Ou <aou@xxxxxxxxxxxxxxxxx>, Heiko Carstens <hca@xxxxxxxxxxxxx>, Vasily Gorbik <gor@xxxxxxxxxxxxx>, Alexander Gordeev <agordeev@xxxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>, Sven Schnelle <svens@xxxxxxxxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, Rich Felker <dalias@xxxxxxxx>, David Miller <davem@xxxxxxxxxxxxx>, Richard Weinberger <richard@xxxxxx>, anton.ivanov@xxxxxxxxxxxxxxxxxx, Johannes Berg <johannes@xxxxxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "the arch/x86 maintainers" <x86@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, acme@xxxxxxxxxx, Mark Rutland <mark.rutland@xxxxxxx>, Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>, jolsa@xxxxxxxxxx, namhyung@xxxxxxxxxx, Juergen Gross <jgross@xxxxxxxx>, srivatsa@xxxxxxxxxxxxx, amakhalov@xxxxxxxxxx, pv-drivers@xxxxxxxxxx, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Chris Zankel <chris@xxxxxxxxxx>, jcmvbkbc@xxxxxxxxx, "Rafael J. Wysocki" <rafael@xxxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>, Pavel Machek <pavel@xxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Michael Turquette <mturquette@xxxxxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>, Lorenzo Pieralisi <lpieralisi@xxxxxxxxxx>, Sudeep Holla <sudeep.holla@xxxxxxx>, Andy Gross <agross@xxxxxxxxxx>, Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>, Anup Patel <anup@xxxxxxxxxxxxxx>, Thierry Reding <thierry.reding@xxxxxxxxx>, Jon Hunter <jonathanh@xxxxxxxxxx>, Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Yury Norov <yury.norov@xxxxxxxxx>, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>, Steven Rostedt <rostedt@xxxxxxxxxxx>, Petr Mladek <pmladek@xxxxxxxx>, senozhatsky@xxxxxxxxxxxx, John Ogness <john.ogness@xxxxxxxxxxxxx>, "Paul E. McKenney" <paulmck@xxxxxxxxxx>, Frederic Weisbecker <frederic@xxxxxxxxxx>, quic_neeraju@xxxxxxxxxxx, Josh Triplett <josh@xxxxxxxxxxxxxxxx>, Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>, Lai Jiangshan <jiangshanlai@xxxxxxxxx>, Joel Fernandes <joel@xxxxxxxxxxxxxxxxx>, Juri Lelli <juri.lelli@xxxxxxxxxx>, Vincent Guittot <vincent.guittot@xxxxxxxxxx>, Dietmar Eggemann <dietmar.eggemann@xxxxxxx>, Benjamin Segall <bsegall@xxxxxxxxxx>, Mel Gorman <mgorman@xxxxxxx>, Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>, vschneid@xxxxxxxxxx, jpoimboe@xxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, linux-snps-arc@xxxxxxxxxxxxxxxxxxx, Linux ARM <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, Linux OMAP Mailing List <linux-omap@xxxxxxxxxxxxxxx>, linux-csky@xxxxxxxxxxxxxxx, linux-hexagon@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k <linux-m68k@xxxxxxxxxxxxxxxxxxxx>, "open list:BROADCOM NVRAM DRIVER" <linux-mips@xxxxxxxxxxxxxxx>, openrisc@xxxxxxxxxxxxxxxxxxxx, Parisc List <linux-parisc@xxxxxxxxxxxxxxx>, linuxppc-dev <linuxppc-dev@xxxxxxxxxxxxxxxx>, linux-riscv <linux-riscv@xxxxxxxxxxxxxxxxxxx>, linux-s390@xxxxxxxxxxxxxxx, Linux-sh list <linux-sh@xxxxxxxxxxxxxxx>, sparclinux@xxxxxxxxxxxxxxx, linux-um@xxxxxxxxxxxxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, ACPI Devel Maling List <linux-acpi@xxxxxxxxxxxxxxx>, Linux PM <linux-pm@xxxxxxxxxxxxxxx>, linux-clk <linux-clk@xxxxxxxxxxxxxxx>, linux-arm-msm <linux-arm-msm@xxxxxxxxxxxxxxx>, linux-tegra <linux-tegra@xxxxxxxxxxxxxxx>, linux-arch <linux-arch@xxxxxxxxxxxxxxx>, rcu@xxxxxxxxxxxxxxx
- Delivery-date: Wed, 06 Jul 2022 13:58:31 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed, Jun 8, 2022 at 4:47 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> Make cpuidle_enter_state() consistent with the s2idle variant and
> verify ->enter() always returns with interrupts disabled.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> drivers/cpuidle/cpuidle.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -234,7 +234,11 @@ int cpuidle_enter_state(struct cpuidle_d
> stop_critical_timings();
> if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
> rcu_idle_enter();
> +
> entered_state = target_state->enter(dev, drv, index);
> + if (WARN_ONCE(!irqs_disabled(), "%ps leaked IRQ state",
> target_state->enter))
I'm not sure if dumping a call trace here is really useful and
WARN_ON() often gets converted to panic().
I would print an error message with pr_warn_once().
Otherwise LGTM.
> + raw_local_irq_disable();
> +
> if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
> rcu_idle_exit();
> start_critical_timings();
> @@ -246,12 +250,8 @@ int cpuidle_enter_state(struct cpuidle_d
> /* The cpu is no longer idle or about to enter idle. */
> sched_idle_set_state(NULL);
>
> - if (broadcast) {
> - if (WARN_ON_ONCE(!irqs_disabled()))
> - local_irq_disable();
> -
> + if (broadcast)
> tick_broadcast_exit();
> - }
>
> if (!cpuidle_state_is_coupled(drv, index))
> local_irq_enable();
>
>
|