[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231005105337.ozxgstfz45bskca5@vireshk-i7>
Date: Thu, 5 Oct 2023 16:23:37 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Liao Chang <liaochang1@...wei.com>
Cc: rafael@...nel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: ondemand: Allow powersave_bias_target() to bail
out if freq_table is unsorted
On 08-09-23, 03:16, Liao Chang wrote:
> The generic_powersave_bias_target() function uses the
> cpufreq_table_find_index_[h/l]() functions to calculate the frequency
> bounds for the powersave bias target. However, these two functions only
> work on sorted frequency tables. Therefore, the
> generic_powersave_bias_target() function should bail out early if the
> frequency table is unsorted.
>
> Signed-off-by: Liao Chang <liaochang1@...wei.com>
> ---
> drivers/cpufreq/cpufreq_ondemand.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
> index c52d19d67557..f7ff94f71395 100644
> --- a/drivers/cpufreq/cpufreq_ondemand.c
> +++ b/drivers/cpufreq/cpufreq_ondemand.c
> @@ -71,7 +71,8 @@ static unsigned int generic_powersave_bias_target(struct cpufreq_policy *policy,
> struct od_dbs_tuners *od_tuners = dbs_data->tuners;
> struct cpufreq_frequency_table *freq_table = policy->freq_table;
>
> - if (!freq_table) {
> + if (!freq_table ||
> + WARN_ON_ONCE(policy->freq_table_sorted == CPUFREQ_TABLE_UNSORTED)) {
> dbs_info->freq_lo = 0;
> dbs_info->freq_lo_delay_us = 0;
> return freq_next;
Shouldn't we make the governor use the generic functions then ?
cpufreq_frequency_table_target() ?
> --
> 2.34.1
--
viresh
Powered by blists - more mailing lists