From: Lukasz Luba <lukasz.luba@arm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com,
rafael@kernel.org, dietmar.eggemann@arm.com, rostedt@goodmis.org,
mingo@redhat.com
Subject: Re: [PATCH v2 1/4] thermal: cpufreq_cooling: Use private callback ops for each cooling device
Date: Tue, 14 Jun 2022 10:50:53 +0100 [thread overview]
Message-ID: <8325cebd-ddf5-c6aa-16b9-c7c4282d790f@arm.com> (raw)
In-Reply-To: <20220614022448.pqld3zhqucsfofss@vireshk-i7>
On 6/14/22 03:24, Viresh Kumar wrote:
> On 13-06-22, 13:43, Lukasz Luba wrote:
>> It is very unlikely that one CPU cluster would have the EM and some other
>> won't have it (because EM registration failed or DT lacks needed entry).
>> Although, we should avoid modifying global variable with callbacks anyway.
>> Redesign this and add safety for such situation.
>>
>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
>> ---
>> drivers/thermal/cpufreq_cooling.c | 15 ++++++---------
>> 1 file changed, 6 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
>> index b8151d95a806..ad8b86f5281b 100644
>> --- a/drivers/thermal/cpufreq_cooling.c
>> +++ b/drivers/thermal/cpufreq_cooling.c
>> @@ -59,6 +59,7 @@ struct time_in_idle {
>> * @cdev: thermal_cooling_device pointer to keep track of the
>> * registered cooling device.
>> * @policy: cpufreq policy.
>> + * @cooling_ops: cpufreq callbacks to thermal cooling device ops
>> * @idle_time: idle time stats
>> * @qos_req: PM QoS contraint to apply
>> *
>> @@ -71,6 +72,7 @@ struct cpufreq_cooling_device {
>> unsigned int max_level;
>> struct em_perf_domain *em;
>> struct cpufreq_policy *policy;
>> + struct thermal_cooling_device_ops cooling_ops;
>> #ifndef CONFIG_SMP
>> struct time_in_idle *idle_time;
>> #endif
>> @@ -485,14 +487,6 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>> return ret;
>> }
>>
>> -/* Bind cpufreq callbacks to thermal cooling device ops */
>> -
>> -static struct thermal_cooling_device_ops cpufreq_cooling_ops = {
>> - .get_max_state = cpufreq_get_max_state,
>> - .get_cur_state = cpufreq_get_cur_state,
>> - .set_cur_state = cpufreq_set_cur_state,
>> -};
>> -
>> /**
>> * __cpufreq_cooling_register - helper function to create cpufreq cooling device
>> * @np: a valid struct device_node to the cooling device device tree node
>> @@ -554,7 +548,10 @@ __cpufreq_cooling_register(struct device_node *np,
>> /* max_level is an index, not a counter */
>> cpufreq_cdev->max_level = i - 1;
>>
>> - cooling_ops = &cpufreq_cooling_ops;
>> + cooling_ops = &cpufreq_cdev->cooling_ops;
>> + cooling_ops->get_max_state = cpufreq_get_max_state;
>> + cooling_ops->get_cur_state = cpufreq_get_cur_state;
>> + cooling_ops->set_cur_state = cpufreq_set_cur_state;
>>
>> #ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR
>> if (em_is_sane(cpufreq_cdev, em)) {
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
>
Thank you Viresh for the ACK!
next prev parent reply other threads:[~2022-06-14 9:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 12:43 [PATCH v2 0/4] Thermal cpufreq & devfreq cooling minor clean-ups Lukasz Luba
2022-06-13 12:43 ` [PATCH v2 1/4] thermal: cpufreq_cooling: Use private callback ops for each cooling device Lukasz Luba
2022-06-14 2:24 ` Viresh Kumar
2022-06-14 9:50 ` Lukasz Luba [this message]
2022-06-13 12:43 ` [PATCH v2 2/4] thermal: cpufreq_cooling : Refactor thermal_power_cpu_get_power tracing Lukasz Luba
2022-06-13 12:43 ` [PATCH v2 3/4] thermal: cpufreq_cooling: Update outdated comments Lukasz Luba
2022-06-13 12:43 ` [PATCH v2 4/4] thermal: devfreq_cooling: Extend the devfreq_cooling_device with ops Lukasz Luba
2022-06-14 12:51 ` [PATCH v2 0/4] Thermal cpufreq & devfreq cooling minor clean-ups Lukasz Luba
2022-06-14 18:26 ` Daniel Lezcano
2022-06-15 7:47 ` Lukasz Luba
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=8325cebd-ddf5-c6aa-16b9-c7c4282d790f@arm.com \
--to=lukasz.luba@arm.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=rui.zhang@intel.com \
--cc=viresh.kumar@linaro.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
all inboxes | Powered by JetHome®