From: Christian Loehle <christian.loehle@arm.com>
To: Xuewen Yan <xuewen.yan94@gmail.com>
Cc: Xuewen Yan <xuewen.yan@unisoc.com>,
rafael@kernel.org, viresh.kumar@linaro.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
guohua.yan@unisoc.com, ke.wang@unisoc.com
Subject: Re: [RFC PATCH] cpufreq: userspace: Add fast-switch support for userspace
Date: Tue, 10 Dec 2024 10:20:40 +0000 [thread overview]
Message-ID: <a3a4852f-5d22-4440-ac0c-f24f97d3b3d4@arm.com> (raw)
In-Reply-To: <CAB8ipk92xYEkZ_+m+xKnn2Z0DNOkum+6cgHUhSd_gbdzjAbOXA@mail.gmail.com>
On 12/10/24 03:27, Xuewen Yan wrote:
> On Mon, Dec 9, 2024 at 6:36 PM Christian Loehle
> <christian.loehle@arm.com> wrote:
>>
>> On 12/9/24 08:14, Xuewen Yan wrote:
>>> Now, the userspace governor does not support userspace,
>>> if the driver only use the fast-switch and not add target_index(),
>>
>> Which driver does that? Is that actually valid?
>> No mainline driver from what I can see.
>>
>
> Yes, indeed no mainline driver, It's on our own driver.
Fair enough.
There seems to be handling for that case in cpufreq anyway.
>
>>> it will cause uerspace not work.
>>
>> s/uerspace/userspace
>> to not work?
>>
>>> So add fast-switch support for userspace governor.
>>>
>>> Co-developed-by: Guohua Yan <guohua.yan@unisoc.com>
>>> Signed-off-by: Guohua Yan <guohua.yan@unisoc.com>
>>> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
>>> ---
>>> drivers/cpufreq/cpufreq_userspace.c | 35 +++++++++++++++++++++++++----
>>> 1 file changed, 31 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
>>> index 2c42fee76daa..3a99197246ed 100644
>>> --- a/drivers/cpufreq/cpufreq_userspace.c
>>> +++ b/drivers/cpufreq/cpufreq_userspace.c
>>> @@ -21,6 +21,30 @@ struct userspace_policy {
>>> struct mutex mutex;
>>> };
>>>
>>> +static int cpufreq_userspace_target_freq(struct cpufreq_policy *policy,
>>> + unsigned int target_freq, unsigned int relation)
>>> +{
>>> + int ret;
>>
>> not really necessary
>
> In cpufreq_set(), we need the return value.
Sorry for not being clear enough, I suggested rewriting it
like this, although personal preference.
---
static int cpufreq_userspace_target_freq(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int relation)
{
unsigned int idx;
if (!policy->fast_switch_enabled)
return __cpufreq_driver_target(policy, target_freq, relation);
target_freq = clamp_val(target_freq, policy->min, policy->max);
if (!policy->freq_table)
return target_freq;
idx = cpufreq_frequency_table_target(policy, target_freq, relation);
policy->cached_resolved_idx = idx;
policy->cached_target_freq = target_freq;
return !cpufreq_driver_fast_switch(policy, policy->freq_table[idx].frequency);
}
next prev parent reply other threads:[~2024-12-10 10:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 8:14 Xuewen Yan
2024-12-09 10:36 ` Christian Loehle
2024-12-10 3:27 ` Xuewen Yan
2024-12-10 10:20 ` Christian Loehle [this message]
2024-12-12 6:56 ` Viresh Kumar
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=a3a4852f-5d22-4440-ac0c-f24f97d3b3d4@arm.com \
--to=christian.loehle@arm.com \
--cc=guohua.yan@unisoc.com \
--cc=ke.wang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=xuewen.yan94@gmail.com \
--cc=xuewen.yan@unisoc.com \
/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®