From: Frederic Weisbecker <frederic@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: paulmck@kernel.org, rjw@rjwysocki.net, x86@kernel.org,
linux-kernel@vger.kernel.org, jpoimboe@kernel.org
Subject: Re: [RFC][PATCH 3/9] cpuidle: Move IRQ state validation
Date: Mon, 30 May 2022 13:36:40 +0200 [thread overview]
Message-ID: <20220530113640.GC1257179@lothringen> (raw)
In-Reply-To: <20220519213421.748352112@infradead.org>
On Thu, May 19, 2022 at 11:27:53PM +0200, Peter Zijlstra 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@infradead.org>
> ---
> 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_ON_ONCE(!irqs_disabled()))
> + raw_local_irq_disable();
So it means that idle functions are supposed to return with IRQs disabled
without tracing, right? I can see that at least acpi_safe_halt() is using
the non-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();
>
>
next prev parent reply other threads:[~2022-05-30 11:36 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 21:27 [RFC][PATCH 0/9] Rework cpuidle vs instrumentation Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 1/9] x86/perf/amd: Remove tracing from perf_lopwr_cb() Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 2/9] x86/idle: Replace x86_idle with a static_call Peter Zijlstra
2022-05-30 11:07 ` Frederic Weisbecker
2022-05-19 21:27 ` [RFC][PATCH 3/9] cpuidle: Move IRQ state validation Peter Zijlstra
2022-05-30 11:36 ` Frederic Weisbecker [this message]
2022-05-30 12:00 ` Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 4/9] idle: Fix rcu_idle_*() usage Peter Zijlstra
2022-05-23 9:46 ` Gautham R. Shenoy
2022-05-31 9:33 ` Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 5/9] rcu: Fix rcu_idle_exit() Peter Zijlstra
2022-05-20 21:00 ` Paul E. McKenney
2022-05-19 21:27 ` [RFC][PATCH 6/9] acpi_idle: Remove tracing Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 7/9] cpuidle: Annotate poll_idle() Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 8/9] objtool/idle: Validate __cpuidle code as noinstr Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 9/9] arch/idle: Change arch_cpu_idle() IRQ behaviour Peter Zijlstra
2022-05-19 22:03 ` Peter Zijlstra
2022-05-20 2:20 ` Kirill A. Shutemov
2022-05-20 7:06 ` Peter Zijlstra
2022-05-20 10:13 ` Kirill A. Shutemov
2022-05-20 12:58 ` Peter Zijlstra
2022-05-24 14:55 ` Isaku Yamahata
2022-05-23 10:02 ` Gautham R. Shenoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220530113640.GC1257179@lothringen \
--to=frederic@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rjw@rjwysocki.net \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox