ANDROID: cpuidle-psci: Fix suspicious RCU usage

This change fixes suspicious RCU usage warnings from vendor hook.

    =============================
    WARNING: suspicious RCU usage
    5.15.41-debug-gc1163f69ba3b-dirty #1 Not tainted
    -----------------------------
    include/trace/events/lock.h:37 suspicious rcu_dereference_check() usage!

    other info that might help us debug this:

    rcu_scheduler_active = 2, debug_locks = 1
    RCU used illegally from extended quiescent state!
    no locks held by swapper/0/0.

    stack backtrace:
    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.41-debug-gc1163f69ba3b-dirty #1

    Call trace:
     dump_backtrace+0x0/0x1d8
     dump_stack+0x1c/0x4c
    ..
    ..
     _printk+0x58/0x84
     lockdep_rcu_suspicious+0x44/0x15c
     trace_android_vh_printk_caller_id+0xc4/0x13c
     vprintk_store+0x54/0x59c
     vprintk_emit+0x8c/0x130
     vprintk_default+0x48/0x74
     vprintk+0xf8/0x13c
     _printk+0x58/0x84
     lockdep_rcu_suspicious+0x44/0x15c
     trace_android_vh_cpuidle_psci_enter+0xc4/0x144
     __psci_enter_domain_idle_state+0x64/0x118
     psci_enter_domain_idle_state+0x1c/0x2c
     cpuidle_enter_state+0x14c/0x2fc
     cpuidle_enter+0x3c/0x58

Bug: 267847290
Fixes: 3567f51602 ("ANDROID: cpuidle-psci: Add vendor hook for cpuidle psci enter and exit")
Change-Id: I910a6a0595c3a79b75e581297eb56d512ce5885c
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
This commit is contained in:
Maulik Shah 2023-01-09 14:33:03 +05:30 committed by Treehugger Robot
parent c747c01851
commit 31f5f41bff

View File

@ -69,10 +69,12 @@ static int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
if (ret)
return -1;
trace_android_vh_cpuidle_psci_enter(dev, s2idle);
/* Do runtime PM to manage a hierarchical CPU toplogy. */
ct_irq_enter_irqson();
trace_android_vh_cpuidle_psci_enter(dev, s2idle);
if (s2idle)
dev_pm_genpd_suspend(pd_dev);
else
@ -90,10 +92,11 @@ static int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
dev_pm_genpd_resume(pd_dev);
else
pm_runtime_get_sync(pd_dev);
ct_irq_exit_irqson();
trace_android_vh_cpuidle_psci_exit(dev, s2idle);
ct_irq_exit_irqson();
cpu_pm_exit();
/* Clear the domain state to start fresh when back from idle. */