* [PATCH] intel_idle: Fix false positive RCU splats due to incorrect hardirqs state
@ 2022-07-23 19:59 Waiman Long
2022-07-25 17:41 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Waiman Long @ 2022-07-23 19:59 UTC (permalink / raw)
To: Jacob Pan, Len Brown, Rafael J. Wysocki, Peter Zijlstra
Cc: linux-pm, linux-kernel, Waiman Long
Commit 32d4fd5751ea ("cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE")
uses raw_local_irq_enable/local_irq_disable() around call to
__intel_idle() in intel_idle_irq().
With interrupt enabled, timer tick interrupt can happen and a
subsequently call to __do_softirq() may change the lockdep hardirqs state
of a debug kernel back to 'on'. This will result in a mismatch between
the cpu hardirqs state (off) and the lockdep hardirqs state (on) causing
a number of false positive "WARNING: suspicious RCU usage" splats.
Fix that by using local_irq_disable() to disable interrupt in
intel_idle_irq().
Fixes: 32d4fd5751ea ("cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE")
Signed-off-by: Waiman Long <longman@redhat.com>
---
drivers/idle/intel_idle.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index f5c6802aa6c3..907700d1e78e 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -162,7 +162,13 @@ static __cpuidle int intel_idle_irq(struct cpuidle_device *dev,
raw_local_irq_enable();
ret = __intel_idle(dev, drv, index);
- raw_local_irq_disable();
+
+ /*
+ * The lockdep hardirqs state may be changed to 'on' with timer
+ * tick interrupt followed by __do_softirq(). Use local_irq_disable()
+ * to keep the hardirqs state correct.
+ */
+ local_irq_disable();
return ret;
}
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] intel_idle: Fix false positive RCU splats due to incorrect hardirqs state
2022-07-23 19:59 [PATCH] intel_idle: Fix false positive RCU splats due to incorrect hardirqs state Waiman Long
@ 2022-07-25 17:41 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2022-07-25 17:41 UTC (permalink / raw)
To: Waiman Long, Peter Zijlstra
Cc: Jacob Pan, Len Brown, Rafael J. Wysocki, Linux PM,
Linux Kernel Mailing List
On Sat, Jul 23, 2022 at 10:00 PM Waiman Long <longman@redhat.com> wrote:
>
> Commit 32d4fd5751ea ("cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE")
> uses raw_local_irq_enable/local_irq_disable() around call to
> __intel_idle() in intel_idle_irq().
>
> With interrupt enabled, timer tick interrupt can happen and a
> subsequently call to __do_softirq() may change the lockdep hardirqs state
> of a debug kernel back to 'on'. This will result in a mismatch between
> the cpu hardirqs state (off) and the lockdep hardirqs state (on) causing
> a number of false positive "WARNING: suspicious RCU usage" splats.
>
> Fix that by using local_irq_disable() to disable interrupt in
> intel_idle_irq().
>
> Fixes: 32d4fd5751ea ("cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE")
> Signed-off-by: Waiman Long <longman@redhat.com>
Applied as 5.19-rc material.
Peter, please let me know if you have concerns.
> ---
> drivers/idle/intel_idle.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> index f5c6802aa6c3..907700d1e78e 100644
> --- a/drivers/idle/intel_idle.c
> +++ b/drivers/idle/intel_idle.c
> @@ -162,7 +162,13 @@ static __cpuidle int intel_idle_irq(struct cpuidle_device *dev,
>
> raw_local_irq_enable();
> ret = __intel_idle(dev, drv, index);
> - raw_local_irq_disable();
> +
> + /*
> + * The lockdep hardirqs state may be changed to 'on' with timer
> + * tick interrupt followed by __do_softirq(). Use local_irq_disable()
> + * to keep the hardirqs state correct.
> + */
> + local_irq_disable();
>
> return ret;
> }
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-25 17:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-23 19:59 [PATCH] intel_idle: Fix false positive RCU splats due to incorrect hardirqs state Waiman Long
2022-07-25 17:41 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®