[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <93262faa-7089-f2a2-3df7-058c338adfc6@arm.com>
Date: Thu, 28 Sep 2023 14:49:08 +0200
From: Pierre Gondois <pierre.gondois@....com>
To: Viresh Kumar <viresh.kumar@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>
Cc: linux-kernel@...r.kernel.org,
Shrikanth Hegde <sshegde@...ux.vnet.ibm.com>,
vschneid@...hat.com, "Rafael J. Wysocki" <rafael@...nel.org>,
linux-pm@...r.kernel.org
Subject: Re: [PATCH] cpufreq: Rebuild sched-domains when removing cpufreq
driver
Hello Viresh, Dietmar,
On 9/28/23 09:18, Viresh Kumar wrote:
> On 18-09-23, 13:29, Pierre Gondois wrote:
>> The Energy Aware Scheduler (EAS) relies on the schedutil governor.
>> When moving to/from the schedutil governor, sched domains must be
>> rebuilt to allow re-evaluating the enablement conditions of EAS.
>> This is done through sched_cpufreq_governor_change().
>>
>> Having a cpufreq governor assumes having a cpufreq driver running.
>> Inserting/removing a cpufreq driver should trigger a re-evaluation
>> of EAS enablement conditions, avoiding to see EAS enabled when
>> removing a running cpufreq driver.
>>
>> Add a sched_cpufreq_governor_change() call in cpufreq driver removal
>> path.
>>
>> Signed-off-by: Pierre Gondois <pierre.gondois@....com>
>> ---
>> drivers/cpufreq/cpufreq.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 60ed89000e82..0a4979c34fd1 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -1673,6 +1673,8 @@ static void __cpufreq_offline(unsigned int cpu, struct cpufreq_policy *policy)
>> cpufreq_driver->exit(policy);
>> policy->freq_table = NULL;
>> }
>> +
>> + sched_cpufreq_governor_change(policy, policy->governor);
>
> This is called from many paths. Consider using cpufreq_remove_dev() instead,
> before the policy is freed.
Another solution would be to call sched_cpufreq_governor_change()
from cpufreq_schedutil's init()/exit() callbacks. This would make
more sense as EAS/schedutil cpufreq are tightly bound, and it would
allow to cover all the possible paths.
When tried locally, it seems to cover all scenarios:
- insmod/rmmod a cpufreq driver
- changing the governor policy
- offlining all the CPUs of a pd
Dietmar:
The function would be static to cpufreq_schedutil, and the name can
be changed at the same time to (unless you think of a better name ?):
static void sugov_check_eas_state(void);
Regards,
Pierre
Powered by blists - more mailing lists