linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] cpuidle: tegra: Annotate tegra_pm_set_cpu_in_lp2() with RCU_NONIDLE
@ 2020-11-04 13:21 Dmitry Osipenko
  2020-11-12 16:03 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Osipenko @ 2020-11-04 13:21 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Rafael J. Wysocki,
	Daniel Lezcano, Peter Geis
  Cc: linux-pm, linux-tegra

Annotate tegra_pm_set[clear]_cpu_in_lp2() with RCU_NONIDLE in order to
fix lockdep warning about suspicious RCU usage of a spinlock during late
idling phase.

 WARNING: suspicious RCU usage
 ...
 include/trace/events/lock.h:13 suspicious rcu_dereference_check() usage!
 ...
  (dump_stack) from (lock_acquire)
  (lock_acquire) from (_raw_spin_lock)
  (_raw_spin_lock) from (tegra_pm_set_cpu_in_lp2)
  (tegra_pm_set_cpu_in_lp2) from (tegra_cpuidle_enter)
  (tegra_cpuidle_enter) from (cpuidle_enter_state)
  (cpuidle_enter_state) from (cpuidle_enter_state_coupled)
  (cpuidle_enter_state_coupled) from (cpuidle_enter)
  (cpuidle_enter) from (do_idle)
 ...

Tested-by: Peter Geis <pgwipeout@gmail.com>
Reported-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/cpuidle/cpuidle-tegra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c
index e8956706a291..191966dc8d02 100644
--- a/drivers/cpuidle/cpuidle-tegra.c
+++ b/drivers/cpuidle/cpuidle-tegra.c
@@ -189,7 +189,7 @@ static int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
 	}
 
 	local_fiq_disable();
-	tegra_pm_set_cpu_in_lp2();
+	RCU_NONIDLE(tegra_pm_set_cpu_in_lp2());
 	cpu_pm_enter();
 
 	switch (index) {
@@ -207,7 +207,7 @@ static int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
 	}
 
 	cpu_pm_exit();
-	tegra_pm_clear_cpu_in_lp2();
+	RCU_NONIDLE(tegra_pm_clear_cpu_in_lp2());
 	local_fiq_enable();
 
 	return err ?: index;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] cpuidle: tegra: Annotate tegra_pm_set_cpu_in_lp2() with RCU_NONIDLE
  2020-11-04 13:21 [PATCH v1] cpuidle: tegra: Annotate tegra_pm_set_cpu_in_lp2() with RCU_NONIDLE Dmitry Osipenko
@ 2020-11-12 16:03 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2020-11-12 16:03 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Rafael J. Wysocki,
	Daniel Lezcano, Peter Geis, Linux PM, linux-tegra

On Wed, Nov 4, 2020 at 2:21 PM Dmitry Osipenko <digetx@gmail.com> wrote:
>
> Annotate tegra_pm_set[clear]_cpu_in_lp2() with RCU_NONIDLE in order to
> fix lockdep warning about suspicious RCU usage of a spinlock during late
> idling phase.
>
>  WARNING: suspicious RCU usage
>  ...
>  include/trace/events/lock.h:13 suspicious rcu_dereference_check() usage!
>  ...
>   (dump_stack) from (lock_acquire)
>   (lock_acquire) from (_raw_spin_lock)
>   (_raw_spin_lock) from (tegra_pm_set_cpu_in_lp2)
>   (tegra_pm_set_cpu_in_lp2) from (tegra_cpuidle_enter)
>   (tegra_cpuidle_enter) from (cpuidle_enter_state)
>   (cpuidle_enter_state) from (cpuidle_enter_state_coupled)
>   (cpuidle_enter_state_coupled) from (cpuidle_enter)
>   (cpuidle_enter) from (do_idle)
>  ...
>
> Tested-by: Peter Geis <pgwipeout@gmail.com>
> Reported-by: Peter Geis <pgwipeout@gmail.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/cpuidle/cpuidle-tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c
> index e8956706a291..191966dc8d02 100644
> --- a/drivers/cpuidle/cpuidle-tegra.c
> +++ b/drivers/cpuidle/cpuidle-tegra.c
> @@ -189,7 +189,7 @@ static int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
>         }
>
>         local_fiq_disable();
> -       tegra_pm_set_cpu_in_lp2();
> +       RCU_NONIDLE(tegra_pm_set_cpu_in_lp2());
>         cpu_pm_enter();
>
>         switch (index) {
> @@ -207,7 +207,7 @@ static int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
>         }
>
>         cpu_pm_exit();
> -       tegra_pm_clear_cpu_in_lp2();
> +       RCU_NONIDLE(tegra_pm_clear_cpu_in_lp2());
>         local_fiq_enable();
>
>         return err ?: index;
> --

Applied as a fix for 5.10-rc, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-12 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 13:21 [PATCH v1] cpuidle: tegra: Annotate tegra_pm_set_cpu_in_lp2() with RCU_NONIDLE Dmitry Osipenko
2020-11-12 16:03 ` 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;
as well as URLs for NNTP newsgroup(s).