From patchwork Wed Jul 19 10:12:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 108262 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp664780obm; Wed, 19 Jul 2017 03:13:40 -0700 (PDT) X-Received: by 10.98.14.10 with SMTP id w10mr2270258pfi.72.1500459220130; Wed, 19 Jul 2017 03:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500459220; cv=none; d=google.com; s=arc-20160816; b=BMISl3kp1ZeXQzZDE/Nof3ZWUm1MHnTR/oaREkEOhzgFziNzkZMsdPjKVLhcpIhMC6 EoK4Za9NFjXZqEHNftyXFnehalWJmxG3i1WqOoYGzAR/kMRIfvrIpFsWAIu2nqmVBk2J 0dwUApyUcFyZt3Z2k1Ce2e460yiohikPhex9nAvMyO1nS+Nyks725z7c/eCPV1brE9OB Xylr5ZaQ15RyvpNDZIGz1Oyco2X59TwHCe2+ReSl20m4zw4TGKvxfWIT27UfJR39NgEW nd0ZK6uNTPf1vx8tqB7U+njkzbDGFbmzK3k/TjQ/l/NlkgYOKczSML3t4GuGcd6/R+Ps ZaFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=z5UNf7VrM+9cFdUN6YbY4wfTj6yz61m2f+fQfecyokw=; b=GSNP8GFv8Z3+QZ9MU74slMQfwX9J9ZIduzfuj7rsF7cmWFXbC2O1ooS5p0n33/9fPF J3zE4xx3jJcUctuFgnBldEWToZa1dSefHHAdCE0tpv2gMOjKV4FnPLuEMugO7tYu1pd4 A+S9M49lGWtBZlIvjpJtJ135dWBDIGH+Ux+C//DwcMjhlwnpbeFmGuwAJPJEMrPGonag jx9TOkdgXv/y9YgqCXg8+w9+nqW9TYbMKrOgjSGUlaHz6YDJkU1rYnviLayBcUcWDFLu LwioTFQfvYUa2kMunr/Dfis7mxxkx1K6+m1C5IHZnOX+LFWGji7c6mtA8KVyH5OXdEmF 5wEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=WwMhbrOj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e10si3986482pgp.440.2017.07.19.03.13.39; Wed, 19 Jul 2017 03:13:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=WwMhbrOj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932311AbdGSKNd (ORCPT + 25 others); Wed, 19 Jul 2017 06:13:33 -0400 Received: from mail-pg0-f43.google.com ([74.125.83.43]:36025 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752840AbdGSKN3 (ORCPT ); Wed, 19 Jul 2017 06:13:29 -0400 Received: by mail-pg0-f43.google.com with SMTP id 125so5372068pgi.3 for ; Wed, 19 Jul 2017 03:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=z5UNf7VrM+9cFdUN6YbY4wfTj6yz61m2f+fQfecyokw=; b=WwMhbrOjOz3gdKogLzocUfkTkT/wsd0H1pp1tXyURp1VNFBTWCChnDrbRxlgpJ/faK qERDfnGLT3NDamXO38aB0hShKs+QXowDBiS2oWJACWMey9yoTtLciBuFEa/8SbvqKrHf 4iVzd/kmdQZfz6e7nKox1WGH5Vbe64BPWUh4w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=z5UNf7VrM+9cFdUN6YbY4wfTj6yz61m2f+fQfecyokw=; b=MDm8tWLO3rIfzLBqzJdeI8MK/p+I4TJJw5OrFFJp9JcCHWkABpP4/LhyYvMKHmppT2 IRKo7nL7HflVd9K9E2qkQljilPZsyPxK8H6CweUl+1CsMD5tnnqG72LGEJhP9F3RmT8t tkLJ9sskkQIgHY4TBnanSa2AumJiI+g7Di28U7lNGN18+3joBKS97Y2olOTcMZwajJFu jEZBw2ue1EXMeBnP7oMFxa6iPajdCtgcSQDa8PBo7aNhB2YZfRQTBP8l1oSpDQaq/DXw SO1Gp/Qsn9lgF0JZYFmAqpxQYLcmmcRd+CgtnFPcEG0asUv0i+I2209wvlJ3otXYXapx HdVw== X-Gm-Message-State: AIVw1120ldAZAiY7fF2h1Lvmivz7bq8bRziV9xL5PuHeCwzETii21IY7 WIzgGTf/2ejxYQ7u X-Received: by 10.84.224.141 with SMTP id s13mr2432345plj.212.1500459209198; Wed, 19 Jul 2017 03:13:29 -0700 (PDT) Received: from localhost ([122.167.171.93]) by smtp.gmail.com with ESMTPSA id x81sm5474658pfi.20.2017.07.19.03.13.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jul 2017 03:13:28 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux@dominikbrodowski.net, linux-kernel@vger.kernel.org Subject: [PATCH V3 6/9] cpufreq: Replace "max_transition_latency" with "dynamic_switching" Date: Wed, 19 Jul 2017 15:42:46 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/cpufreq/cpufreq.c | 8 ++++---- drivers/cpufreq/cpufreq_governor.h | 2 +- include/linux/cpufreq.h | 9 ++------- 3 files changed, 7 insertions(+), 12 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d00cde871c15..2debfb5f9126 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2014,13 +2014,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 { diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 95f207eb820e..8463f5def0f5 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h @@ -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, \ diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index aaadfc543f63..e141dbbb9d1c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -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; };