]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
cpufreq: Replace "max_transition_latency" with "dynamic_switching"
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 19 Jul 2017 10:12:46 +0000 (15:42 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 25 Jul 2017 22:15:45 +0000 (00:15 +0200)
There is no limitation in the ondemand or conservative governors which
disallow the transition_latency to be greater than 10 ms.

The max_transition_latency field is rather used to disallow automatic
dynamic frequency switching for platforms which didn't wanted these
governors to run.

Replace max_transition_latency with a boolean (dynamic_switching) and
check for transition_latency == CPUFREQ_ETERNAL along with that. This
makes it pretty straight forward to read/understand now.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq_governor.h
include/linux/cpufreq.h

index c426d21822f7b6077678cc01c396bbfc3c95e27c..88139e5e87da31eda192fbdb817f08720f5b31b8 100644 (file)
@@ -2003,13 +2003,13 @@ static int cpufreq_init_governor(struct cpufreq_policy *policy)
        if (!policy->governor)
                return -EINVAL;
 
-       if (policy->governor->max_transition_latency &&
-           policy->cpuinfo.transition_latency >
-           policy->governor->max_transition_latency) {
+       /* Platform doesn't want dynamic frequency switching ? */
+       if (policy->governor->dynamic_switching &&
+           policy->cpuinfo.transition_latency == CPUFREQ_ETERNAL) {
                struct cpufreq_governor *gov = cpufreq_fallback_governor();
 
                if (gov) {
-                       pr_warn("%s governor failed, too long transition latency of HW, fallback to %s governor\n",
+                       pr_warn("Transition latency set to CPUFREQ_ETERNAL, can't use %s governor. Fallback to %s governor\n",
                                policy->governor->name, gov->name);
                        policy->governor = gov;
                } else {
index 95f207eb820e363a759aa504948e93aeb2812684..8463f5def0f596fb3424f6e2a25bb775460e05c7 100644 (file)
@@ -159,7 +159,7 @@ void cpufreq_dbs_governor_limits(struct cpufreq_policy *policy);
 #define CPUFREQ_DBS_GOVERNOR_INITIALIZER(_name_)                       \
        {                                                               \
                .name = _name_,                                         \
-               .max_transition_latency = TRANSITION_LATENCY_LIMIT,     \
+               .dynamic_switching = true,                              \
                .owner = THIS_MODULE,                                   \
                .init = cpufreq_dbs_governor_init,                      \
                .exit = cpufreq_dbs_governor_exit,                      \
index aaadfc543f633514582d0405137c99493a698b7a..e141dbbb9d1c03529271922b7db301c8c6c57cb9 100644 (file)
@@ -487,12 +487,8 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
  * polling frequency is 1000 times the transition latency of the processor. The
  * ondemand governor will work on any processor with transition latency <= 10ms,
  * using appropriate sampling rate.
- *
- * For CPUs with transition latency > 10ms (mostly drivers with CPUFREQ_ETERNAL)
- * the ondemand governor will not work. All times here are in us (microseconds).
  */
 #define LATENCY_MULTIPLIER             (1000)
-#define TRANSITION_LATENCY_LIMIT       (10 * 1000 * 1000)
 
 struct cpufreq_governor {
        char    name[CPUFREQ_NAME_LEN];
@@ -505,9 +501,8 @@ struct cpufreq_governor {
                                         char *buf);
        int     (*store_setspeed)       (struct cpufreq_policy *policy,
                                         unsigned int freq);
-       unsigned int max_transition_latency; /* HW must be able to switch to
-                       next freq faster than this value in nano secs or we
-                       will fallback to performance governor */
+       /* For governors which change frequency dynamically by themselves */
+       bool                    dynamic_switching;
        struct list_head        governor_list;
        struct module           *owner;
 };