Re: [Patch v3 3/6] cpufreq: qcom-cpufreq-hw: Add dcvs interrupt support

From: Thara Gopinath
Date: Wed Jul 14 2021 - 08:37:24 EST




On 7/12/21 11:18 PM, Viresh Kumar wrote:
On 12-07-21, 21:18, Thara Gopinath wrote:
So I really need the interrupt to fire and then the timer to kick in and
take up the monitoring. I can think of introducing a variable is_disabled
which is updated and read under a spinlock. qcom_cpufreq_hw_cpu_exit can
hold the spinlock and set is_disabled to true prior to cancelling the work
queue or disabling the interrupt. Before re-enabling the interrupt or
re-queuing the work in qcom_lmh_dcvs_notify, is_disabled can be read and
checked.

Or you can make the lmh_dcvs_poll_work item a pointer and mark it NULL in exit,
with proper locking etc.

Yes it could work. I will spin the next version with either this or introducing a new variable with locking.


But does this problem not exist in target_index , fast_switch etc also ? One
cpu can be disabling and the other one can be updating the target right?

The race doesn't happen there as cpufreq_unregister_driver() takes care of
stopping everything before removing the policy. To be more precise, governor's
->stop() function is responsible for making sure that frequency won't be updated
any further.


--
Warm Regards
Thara (She/Her/Hers)