From: Preeti U Murthy <preeti@linux.vnet.ibm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Dirk Brandewie <dirk.brandewie@gmail.com>,
Dirk Brandewie <dirk.j.brandewie@intel.com>,
Linux PM list <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Patrick Marlier <patrick.marlier@gmail.com>
Subject: Re: [PATCH 0/2] Add exit_prepare callback to the cpufreq_driver interface.
Date: Thu, 04 Sep 2014 15:33:07 +0530 [thread overview]
Message-ID: <540838DB.1070202@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAKohpokvpWDbCbPYcV+fzzpaztZSi=yacdmyYfBLoSs4U2YO9A@mail.gmail.com>
On 09/04/2014 02:46 PM, Viresh Kumar wrote:
> On 4 September 2014 14:40, Preeti U Murthy <preeti@linux.vnet.ibm.com> wrote:
>> cpufreq: Allow stop CPU callback to be used by all cpufreq drivers
>>
>> Commit 367dc4aa introduced the stop CPU callback for intel_pstate
>> drivers. During the CPU_DOWN_PREPARE stage, this callback is invoked
>> so that drivers can take some action on the pstate of the cpu
>> before it is taken offline. This callback was assumed to be useful
>> only for those drivers which have implemented the set_policy CPU
>> callback because they have no other way to take action about the
>> cpufreq of a CPU which is being hotplugged out except in the exit
>> callback which is called very late in the offline process.
>>
>> The drivers which implement the target/target_index callbacks were
>> expected to take care of requirements like the ones that commit
>> 367dc4aa addresses in the GOV_STOP notification event. But there
>> are disadvantages to restricting the usage of stop CPU callback
>> to cpufreq drivers that implement the set_policy callbacks and who
>> want to take explicit action on the setting the cpufreq during a
>> hotplug operation.
>>
>> 1.GOV_STOP gets called for every CPU offline and drivers would usually
>> want to take action when the last cpu in the policy->cpus mask
>> is taken offline. As long as there is more than one cpu in the
>> policy->cpus mask, cpufreq core itself makes sure that the freq
>> for the other cpus in this mask is set according to the maximum load.
>> This is sensible and drivers which implement the target_index callback
>> would mostly not want to modify that. However the cpufreq core leaves a
>> loose end when the cpu in the policy->cpus mask is the last one to go offline;
>> it does nothing explicit to the frequency of the core. Drivers may need
>> a way to take some action here and stop CPU callback mechanism is the
>> best way to do it today.
>>
>> 2.We cannot implement driver specific actions in the GOV_STOP mechanism.
>> So we will need another driver callback which is invoked from here which is
>> unnecessary.
>>
>> Therefore this patch extends the usage of stop CPU callback to be used
>> by all cpufreq drivers as long as they have this callback implemented
>> and irrespective of whether they are set_policy/target_index drivers.
>> The assumption is if the drivers find the GOV_STOP path to be a suitable
>> way of implementing what they want to do with the freq of the cpu
>> going offine,they will not implement the stop CPU callback at all.
>>
>> Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index d9fdedd..6463f35 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -1380,7 +1380,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
>> if (!cpufreq_suspended)
>> pr_debug("%s: policy Kobject moved to cpu: %d from: %d\n",
>> __func__, new_cpu, cpu);
>> - } else if (cpufreq_driver->stop_cpu && cpufreq_driver->setpolicy) {
>> + } else if (cpufreq_driver->stop_cpu) {
>> cpufreq_driver->stop_cpu(policy);
>> }
>
> Rafael explicitly said earlier that he want to see a separate callback for
> ->target() drivers, don't know why..
I think Rafael's point was that since no driver that had implemented the
target_index callback was using it at the time that this patch was
proposed, it was be best to couple the check on existence of stop_cpu
callback with the the check on the kind of cpufreq driver. However
powerpc is also in need of this today and we implement the target_index
callback and find it convenient to use the stop CPU callback.
Rafael, in which case would it not make sense to remove the check on
driver->setpolicy above?
Besides, I don't understand very well why we had this double check in
the first place. Only if the drivers are in need of the functionality
like stop_cpu, would they have implemented this callback right? If we
are to assume that the drivers which have implemented the target_index
callback should never be needing it, they would not have implemented the
stop CPU callback either. So what was that, which was blatantly wrong
with just having a check on stop_cpu? I did go through the discussion
but did not find a convincing answer to this.
Rafael?
Regards
Preeti U Murthy
>
> It looks fine to me though.
>
next prev parent reply other threads:[~2014-09-04 10:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-13 17:36 [PATCH 0/2] Add exit_prepare callback to the cpufreq_driver interface dirk.brandewie
2014-03-13 17:36 ` [PATCH 1/2] cpufreq: Add exit_prepare callback to " dirk.brandewie
2014-03-18 12:12 ` Srivatsa S. Bhat
2014-03-13 17:36 ` [PATCH 2/2] intel_pstate: Set core to min P state during core offline dirk.brandewie
2014-03-14 4:59 ` [PATCH 0/2] Add exit_prepare callback to the cpufreq_driver interface Viresh Kumar
2014-03-14 15:10 ` Dirk Brandewie
2014-03-14 17:07 ` Viresh Kumar
2014-03-14 18:29 ` Dirk Brandewie
2014-03-15 1:59 ` Rafael J. Wysocki
2014-03-18 5:09 ` Viresh Kumar
2014-03-18 12:16 ` Srivatsa S. Bhat
2014-03-19 5:03 ` Viresh Kumar
2014-03-19 10:00 ` Srivatsa S. Bhat
2014-03-19 14:19 ` Rafael J. Wysocki
2014-09-04 6:08 ` Viresh Kumar
2014-09-04 9:10 ` Preeti U Murthy
2014-09-04 9:16 ` Viresh Kumar
2014-09-04 10:03 ` Preeti U Murthy [this message]
2014-09-04 10:37 ` Viresh Kumar
2014-09-04 19:56 ` Rafael J. Wysocki
2014-03-18 5:06 ` 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=540838DB.1070202@linux.vnet.ibm.com \
--to=preeti@linux.vnet.ibm.com \
--cc=dirk.brandewie@gmail.com \
--cc=dirk.j.brandewie@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=patrick.marlier@gmail.com \
--cc=rjw@rjwysocki.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.