Re: [PATCH v2] cpufreq: Fix per-policy boost behavior after CPU hotplug

From: PoShao Chen
Date: Mon Jun 17 2024 - 01:49:57 EST


On Thu, 2024-06-13 at 14:50 +0530, Viresh Kumar wrote:
> Please try this instead:
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 7c6879efe9ef..bd9fe2b0f032 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -43,6 +43,9 @@ static LIST_HEAD(cpufreq_policy_list);
> #define for_each_inactive_policy(__policy) \
> for_each_suitable_policy(__policy, false)
>
> +#define for_each_policy(__policy) \
> + list_for_each_entry(__policy, &cpufreq_policy_list,
> policy_list)
> +
> /* Iterate over governors */
> static LIST_HEAD(cpufreq_governor_list);
> #define for_each_governor(__governor) \
> @@ -2815,7 +2818,7 @@ int cpufreq_boost_trigger_state(int state)
> write_unlock_irqrestore(&cpufreq_driver_lock, flags);
>
> cpus_read_lock();
> - for_each_active_policy(policy) {
> + for_each_policy(policy) {
> policy->boost_enabled = state;
> ret = cpufreq_driver->set_boost(policy, state);
> if (ret) {
>
> --
> viresh

Thank you for the suggestion. However, calling ->set_boost when
the policy is inactive will fail in two ways:

1. policy->freq_table will be NULL.
2. freq_qos_update_request will fail to refresh the frequency limit.

--
poshao