From patchwork Wed Jul 19 10:12:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 108258 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp664463obm; Wed, 19 Jul 2017 03:13:23 -0700 (PDT) X-Received: by 10.99.171.66 with SMTP id k2mr2335567pgp.248.1500459202769; Wed, 19 Jul 2017 03:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500459202; cv=none; d=google.com; s=arc-20160816; b=O+AvrlobsJARm4MAZOWWU1ec3m50BF73jLAPJwW2Audgrdr9fTQB8agXRs87hSgj+b hPofbFhuliR6YoABStK4Nm/cleqOqHJfz26NkH4RcHf4clv4Kpt4ndC9kplZCCL3XhNB mZYFkEQz0weQdus9mIoP7oms6R5fBd5nCJCiNWhHGTpOIBGfpO1N8Uw3BhfXjwCaqFTJ s3t0LBiRD+8tkaMnR4/VP3f+PMm+mEyRGjPsKOCxF0Zrn4OEGHtrhClHjUmEzHxjXbdI gabFuVnWhAHkdrI58kJfMrHVx/+XrNj2VohPfkIB87qCOfsoFFxlBJp1OWE8pZI+PE8u yX7w== 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=hdrlmcep8/DfsOuwwAWy/4B6aZA3wwDtlExbsghns44=; b=JGj0h940jgyQCTtgu5BhMzKBugi3MNwzg2KFxhKCQX0V1sFEsnnSOgUJta/2SlNNjr +1t1I8+B9HuKSacS7ScCvXO3TaDC+afry+XHV6o97kYjxJfaSntcPM2PBnmehxZj0yd6 J1CyRhKlmrYUKOZHqu8uaLvqopjETtOFFRNSHR1Pvsl6+4JtTx3tcaRhxOgOLlrF1xZf ozlMi7O4mxZEryFYrZn71aYi50o7IvGQCikaVTwujAVCvEpVC1vkIog/ys3E7uLus6uc pACL0OHeaH7WEwFDiKv3u63fZUggr9f8mLB3pBTAgh0B06v0KtvNasyYsgBC3gB85ONv A36w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=hB+5jKir; 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 n27si3922715pfa.146.2017.07.19.03.13.22; Wed, 19 Jul 2017 03:13:22 -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=hB+5jKir; 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 S932299AbdGSKNS (ORCPT + 25 others); Wed, 19 Jul 2017 06:13:18 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:38801 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932078AbdGSKNP (ORCPT ); Wed, 19 Jul 2017 06:13:15 -0400 Received: by mail-pg0-f52.google.com with SMTP id s4so31175pgr.5 for ; Wed, 19 Jul 2017 03:13:15 -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=hdrlmcep8/DfsOuwwAWy/4B6aZA3wwDtlExbsghns44=; b=hB+5jKirA4si22gii/hRYcMCfzzRBSIduWOa22mDg3X/7aepJXIHiPrrAmK7rwj+JW KprTVtHeONNM1Zyw8H7F91qqr9dLUbbBmbYT5UgJNHdeAXtVz+fud4oQukshZzb42bdb BpWLLHVRT/kJtVElx16aP5MI/Im2dz/q4LdX8= 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=hdrlmcep8/DfsOuwwAWy/4B6aZA3wwDtlExbsghns44=; b=cRt+dcJheFwithr7Ct2+fHXCrBu2yV6U13UbAnejlpqhN3NX7NKwFsUsJ7rLtD6Y5v 38/die3i5f9PyZiKy0dvLoRBpMboPW8nh/5FBPyfzxRkn7GgskDuV4vCRG0YPVScGQD7 LajyJLr+iYhyIsJXRhKEh7Th6ujSrCp/zP3hE6Pzwewb8SzO1ggTrYsgaeQvUUdBIn0n aVr/gL6SL853IL6ovXr0oQjsEtiC2s6UPsz7j3SvYIeNZNurB6c4MrZuuKmwzE+di24k 2ZzK/3MuItZa/dOiEoVNs60SvEtA/iuA7fcfzSM9rHrYCE1bsqe+RTLPfY6Y1ouUM9T3 ko9w== X-Gm-Message-State: AIVw111vrlmRPY5ya3U2mq2/B0sRm7UJiVUEgULefy0+6Ym+UwubSdBW IJ9P4Df5Y5+QV0yo X-Received: by 10.98.137.81 with SMTP id v78mr2296095pfd.9.1500459194510; Wed, 19 Jul 2017 03:13:14 -0700 (PDT) Received: from localhost ([122.167.171.93]) by smtp.gmail.com with ESMTPSA id y62sm9695539pfb.3.2017.07.19.03.13.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jul 2017 03:13:13 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Jonathan Corbet , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux@dominikbrodowski.net, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 1/9] cpufreq: governor: Drop min_sampling_rate Date: Wed, 19 Jul 2017 15:42:41 +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 The cpufreq core and governors aren't supposed to set a limit on how fast we want to try changing the frequency. This is currently done for the legacy governors with help of min_sampling_rate. At worst, we may end up setting the sampling rate to a value lower than the rate at which frequency can be changed and then one of the CPUs in the policy will be only changing frequency for ever. But that is something for the user to decide and there is no need to have special handling for such cases in the core. Leave it for the user to figure out. Signed-off-by: Viresh Kumar --- Documentation/admin-guide/pm/cpufreq.rst | 8 -------- drivers/cpufreq/cpufreq_conservative.c | 6 ------ drivers/cpufreq/cpufreq_governor.c | 10 ++-------- drivers/cpufreq/cpufreq_governor.h | 1 - drivers/cpufreq/cpufreq_ondemand.c | 12 ------------ include/linux/cpufreq.h | 2 -- 6 files changed, 2 insertions(+), 37 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/Documentation/admin-guide/pm/cpufreq.rst b/Documentation/admin-guide/pm/cpufreq.rst index 463cf7e73db8..2eb3bf62393e 100644 --- a/Documentation/admin-guide/pm/cpufreq.rst +++ b/Documentation/admin-guide/pm/cpufreq.rst @@ -471,14 +471,6 @@ it is allowed to use (the ``scaling_max_freq`` policy limit). # echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) > ondemand/sampling_rate - -``min_sampling_rate`` - The minimum value of ``sampling_rate``. - - Equal to 10000 (10 ms) if :c:macro:`CONFIG_NO_HZ_COMMON` and - :c:data:`tick_nohz_active` are both set or to 20 times the value of - :c:data:`jiffies` in microseconds otherwise. - ``up_threshold`` If the estimated CPU load is above this value (in percent), the governor will set the frequency to the maximum value allowed for the policy. diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 88220ff3e1c2..f20f20a77d4d 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -246,7 +246,6 @@ gov_show_one_common(sampling_rate); gov_show_one_common(sampling_down_factor); gov_show_one_common(up_threshold); gov_show_one_common(ignore_nice_load); -gov_show_one_common(min_sampling_rate); gov_show_one(cs, down_threshold); gov_show_one(cs, freq_step); @@ -254,12 +253,10 @@ gov_attr_rw(sampling_rate); gov_attr_rw(sampling_down_factor); gov_attr_rw(up_threshold); gov_attr_rw(ignore_nice_load); -gov_attr_ro(min_sampling_rate); gov_attr_rw(down_threshold); gov_attr_rw(freq_step); static struct attribute *cs_attributes[] = { - &min_sampling_rate.attr, &sampling_rate.attr, &sampling_down_factor.attr, &up_threshold.attr, @@ -297,10 +294,7 @@ static int cs_init(struct dbs_data *dbs_data) dbs_data->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; dbs_data->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; dbs_data->ignore_nice_load = 0; - dbs_data->tuners = tuners; - dbs_data->min_sampling_rate = MIN_SAMPLING_RATE_RATIO * - jiffies_to_usecs(10); return 0; } diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 47e24b5384b3..858081f9c3d7 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -47,14 +47,11 @@ ssize_t store_sampling_rate(struct gov_attr_set *attr_set, const char *buf, { struct dbs_data *dbs_data = to_dbs_data(attr_set); struct policy_dbs_info *policy_dbs; - unsigned int rate; int ret; - ret = sscanf(buf, "%u", &rate); + ret = sscanf(buf, "%u", &dbs_data->sampling_rate); if (ret != 1) return -EINVAL; - dbs_data->sampling_rate = max(rate, dbs_data->min_sampling_rate); - /* * We are operating under dbs_data->mutex and so the list and its * entries can't be freed concurrently. @@ -437,10 +434,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) latency = 1; /* Bring kernel and HW constraints together */ - dbs_data->min_sampling_rate = max(dbs_data->min_sampling_rate, - MIN_LATENCY_MULTIPLIER * latency); - dbs_data->sampling_rate = max(dbs_data->min_sampling_rate, - LATENCY_MULTIPLIER * latency); + dbs_data->sampling_rate = LATENCY_MULTIPLIER * latency; if (!have_governor_per_policy()) gov->gdbs_data = dbs_data; diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 0236ec2cd654..95f207eb820e 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h @@ -41,7 +41,6 @@ enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE}; struct dbs_data { struct gov_attr_set attr_set; void *tuners; - unsigned int min_sampling_rate; unsigned int ignore_nice_load; unsigned int sampling_rate; unsigned int sampling_down_factor; diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 3937acf7e026..6b423eebfd5d 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -319,7 +319,6 @@ gov_show_one_common(sampling_rate); gov_show_one_common(up_threshold); gov_show_one_common(sampling_down_factor); gov_show_one_common(ignore_nice_load); -gov_show_one_common(min_sampling_rate); gov_show_one_common(io_is_busy); gov_show_one(od, powersave_bias); @@ -329,10 +328,8 @@ gov_attr_rw(up_threshold); gov_attr_rw(sampling_down_factor); gov_attr_rw(ignore_nice_load); gov_attr_rw(powersave_bias); -gov_attr_ro(min_sampling_rate); static struct attribute *od_attributes[] = { - &min_sampling_rate.attr, &sampling_rate.attr, &up_threshold.attr, &sampling_down_factor.attr, @@ -373,17 +370,8 @@ static int od_init(struct dbs_data *dbs_data) if (idle_time != -1ULL) { /* Idle micro accounting is supported. Use finer thresholds */ dbs_data->up_threshold = MICRO_FREQUENCY_UP_THRESHOLD; - /* - * In nohz/micro accounting case we set the minimum frequency - * not depending on HZ, but fixed (very low). - */ - dbs_data->min_sampling_rate = MICRO_FREQUENCY_MIN_SAMPLE_RATE; } else { dbs_data->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; - - /* For correct statistics, we need 10 ticks for each measure */ - dbs_data->min_sampling_rate = MIN_SAMPLING_RATE_RATIO * - jiffies_to_usecs(10); } dbs_data->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index f10a9b3761cd..02aec384cab9 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -491,9 +491,7 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, * 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 MIN_SAMPLING_RATE_RATIO (2) #define LATENCY_MULTIPLIER (1000) -#define MIN_LATENCY_MULTIPLIER (20) #define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000) struct cpufreq_governor { From patchwork Wed Jul 19 10:12:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 108259 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp664553obm; Wed, 19 Jul 2017 03:13:28 -0700 (PDT) X-Received: by 10.98.49.67 with SMTP id x64mr2331599pfx.22.1500459208198; Wed, 19 Jul 2017 03:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500459208; cv=none; d=google.com; s=arc-20160816; b=tBogeZi1coOhXYWSyKLBTpSPsD0cr+sDkkyonR5suRGFnK9OPez2WkF3VOUKYjxtOc sIo5LtQt64UpwMhQohMZgdXalQsmY3tydISbyodhUwkM5xiYA7K+q8IVbJqPlmsb3ZLM 5aRq8uI76YfHj6yABOd/fPTrVaTN0JPDxFpYsMN6FDxgZcsRobTu7h/8GKC/hxkL2h9T YG+7a9cKH7T6UNDeqlXXTnqs8LSKso/DT64MWUZAuX8Vv3n1uIEfwC+mxxRp7rb50czl 6sS/JFfTiwi8JA18VeJ4xN+QohRZQFt3sYffU345UfbsaybalNS7isfZs5lFVzSyQ0eB 1ltA== 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=6JQWWAPw3OgjMp6jQEqIs4Yl7udrFl5rkcFTz7cxYNw=; b=Y5k3nZkYZdaBr+DLh1c5Iy26pezBN+yLcBBA/S8OKGQGggLAbr9KB9ptuH3810pfBo HFulvMT7r3owvMjrray/fPUAhY140AvJesnzTWe0FTrNKg8Zv/IV8P3cVR8xt58bcgUs ASga4Y5pPvI5ADRoMJc0QKjIfvPD6XtfTnfM33lAfSpUseZ/NbGeRz2t41rRH1/gOKKx /QtCrRlsN1PywpLQnXVcH+jow7T+8MOyGCNB7lx39jyzOxU/4+6TnK3qnHThj8079RK8 sqpCg0VzdwxN+N05Tyh28ib0C+GEpY7kwncIl5stVuCUsFlJwNDRpz/PexJaC8w0xKby h+zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Rcdz6vm9; 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 n27si3922715pfa.146.2017.07.19.03.13.27; Wed, 19 Jul 2017 03:13:28 -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=Rcdz6vm9; 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 S1754246AbdGSKNX (ORCPT + 25 others); Wed, 19 Jul 2017 06:13:23 -0400 Received: from mail-pg0-f50.google.com ([74.125.83.50]:38815 "EHLO mail-pg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754126AbdGSKNS (ORCPT ); Wed, 19 Jul 2017 06:13:18 -0400 Received: by mail-pg0-f50.google.com with SMTP id s4so31813pgr.5 for ; Wed, 19 Jul 2017 03:13:18 -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=6JQWWAPw3OgjMp6jQEqIs4Yl7udrFl5rkcFTz7cxYNw=; b=Rcdz6vm9V1DiLMsCH69Ig7vUU3Ud7Efmf/gpqRih5fU8hZO81HGm7tq7y5P1Vjfd0s sYMewr8ziUM+vbqTNJfykrN2W5Qi3XJiDhivBLea3qDEEraeE8RbNH1Fimtc+c3OQp4C MXZns1pBDrwCJsrOgYE3P1+yvQzYw/XcpFEnY= 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=6JQWWAPw3OgjMp6jQEqIs4Yl7udrFl5rkcFTz7cxYNw=; b=ftKH9u5G/n9ZI86390p2YGY7XtEoOfvqmFKTCvRAgRw8tcRtoCRXbNHVESuE4G7Dxs 6PWYCifjWjDqcH+QS+VLJKaw4BG78pdhaS2DOEJlz+JamfBRFvqozuMpidH1Wx1Dj/c3 wR5BEX7UJkhvytq8VTo+HEep55QZlOB6BXvtS9ZYY5bSwafW0M2Zt+le8wY5EhhVYwgo U3yQAbwhpw+2oBYWnNaVrb39WYUmxIjijvcMGsSiviW1I9rImT4/i+VdZYVVHD6GUrXN GF1fKSd2A5fupy7+YmiMCg5NSGRdz9RX4MylWASgkHYHt8H+kmLlILVyRI6QfsELhLMa WthQ== X-Gm-Message-State: AIVw112XoV28oFvGcBTK8RQ1TkkF/8gFAckuV6os6+lBv31kNBumwsgW kyf4GfRUu2N0Izxo X-Received: by 10.98.65.76 with SMTP id o73mr2287270pfa.88.1500459197614; Wed, 19 Jul 2017 03:13:17 -0700 (PDT) Received: from localhost ([122.167.171.93]) by smtp.gmail.com with ESMTPSA id e131sm9705801pgc.64.2017.07.19.03.13.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jul 2017 03:13:17 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Ingo Molnar , Peter Zijlstra Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux@dominikbrodowski.net, linux-kernel@vger.kernel.org Subject: [PATCH V3 2/9] cpufreq: Use transition_delay_us for legacy governors as well Date: Wed, 19 Jul 2017 15:42:42 +0530 Message-Id: <46734e7c365a024632e8b1d52990d4400899727b.1500373914.git.viresh.kumar@linaro.org> 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 The policy->transition_delay_us field is used only by the schedutil governor currently, and this field describes how fast the driver wants the cpufreq governor to change CPUs frequency. It should rather be a common thing across all governors, as it doesn't have any schedutil dependency here. Create a new helper cpufreq_policy_transition_delay_us() to get the transition delay across all governors. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 15 +++++++++++++++ drivers/cpufreq/cpufreq_governor.c | 9 +-------- include/linux/cpufreq.h | 1 + kernel/sched/cpufreq_schedutil.c | 11 +---------- 4 files changed, 18 insertions(+), 18 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 9bf97a366029..c426d21822f7 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -524,6 +524,21 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy, } EXPORT_SYMBOL_GPL(cpufreq_driver_resolve_freq); +unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy) +{ + unsigned int latency; + + if (policy->transition_delay_us) + return policy->transition_delay_us; + + latency = policy->cpuinfo.transition_latency / NSEC_PER_USEC; + if (latency) + return latency * LATENCY_MULTIPLIER; + + return LATENCY_MULTIPLIER; +} +EXPORT_SYMBOL_GPL(cpufreq_policy_transition_delay_us); + /********************************************************************* * SYSFS INTERFACE * *********************************************************************/ diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 858081f9c3d7..eed069ecfd5e 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -389,7 +389,6 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) struct dbs_governor *gov = dbs_governor_of(policy); struct dbs_data *dbs_data; struct policy_dbs_info *policy_dbs; - unsigned int latency; int ret = 0; /* State should be equivalent to EXIT */ @@ -428,13 +427,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) if (ret) goto free_policy_dbs_info; - /* policy latency is in ns. Convert it to us first */ - latency = policy->cpuinfo.transition_latency / 1000; - if (latency == 0) - latency = 1; - - /* Bring kernel and HW constraints together */ - dbs_data->sampling_rate = LATENCY_MULTIPLIER * latency; + dbs_data->sampling_rate = cpufreq_policy_transition_delay_us(policy); if (!have_governor_per_policy()) gov->gdbs_data = dbs_data; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 02aec384cab9..aaadfc543f63 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -523,6 +523,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, unsigned int relation); unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy, unsigned int target_freq); +unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy); int cpufreq_register_governor(struct cpufreq_governor *governor); void cpufreq_unregister_governor(struct cpufreq_governor *governor); diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 29a397067ffa..89c4dd9777bb 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -528,16 +528,7 @@ static int sugov_init(struct cpufreq_policy *policy) goto stop_kthread; } - if (policy->transition_delay_us) { - tunables->rate_limit_us = policy->transition_delay_us; - } else { - unsigned int lat; - - tunables->rate_limit_us = LATENCY_MULTIPLIER; - lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC; - if (lat) - tunables->rate_limit_us *= lat; - } + tunables->rate_limit_us = cpufreq_policy_transition_delay_us(policy); policy->governor_data = sg_policy; sg_policy->tunables = tunables; From patchwork Wed Jul 19 10:12:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 108260 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp664599obm; Wed, 19 Jul 2017 03:13:31 -0700 (PDT) X-Received: by 10.98.63.83 with SMTP id m80mr2203852pfa.161.1500459211076; Wed, 19 Jul 2017 03:13:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500459211; cv=none; d=google.com; s=arc-20160816; b=aMadkshvNwiPNTdVC6s+w2QSQLEz9rMPgOUi9z1MsiFvW9sBUkhtA9hySLHcx7hY0+ Yz5nG+2tfUKl04Apv6a+vX/vABCHtlmotZXsadCNUsFJhLMV4BBhMFylvyjUmOvp6W0v hrZaM8CFqzO/erkwpRuTO8p6hwkblIgVIeo/Czg7Yi9ZFOHxI51H9MBvrczNKmFrBx3+ 1XxbBOjZX+PYEdYutTrKUKdpVTjd/zzO/wFnMXzJWmjL4rbW/S2v2Sj/wYubcDcs9lag hk0FHFxIqwOq0HBJbbEGHO29oFEacWPk2r9dmOTpXZGyNRsdDpwqkrIcRo4P82bkBTAA nUvw== 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=cqCybcpXLY0cxkBwFZgpljmVkHlGtO8cyFu1JVIO9os=; b=JaqVckhhriqe6z0+g06Gg52W21ldttlscl9uA8GdvZACJgAMIa7VLB4bxsTIMN7opR 3OiWwvtYBLnIY1TEzCBpV7EKcUiED17I3DNfZ8bHMmW3De6GfGi8ffXq4yARmoUrXECB Pa/pOQ2rDmq6pFYRDcF8llUeHsVJO7E/z1/g8JrcvvLqxF/mmX5oxBUeSqjmF33PJqiI mKWxHxYzhgXNf+iCzWqT/9tNuHsrU1mGlFc6ysCiqeT47Kisuso1tU4u++BWNzB4sDq6 t+zhAu3h5cHIzB+f1gmCRJE0avWwbf6iS35WOlJ766NJv4tWIMg37kDyYyirCjvfhz+K kzww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=fH2iks+p; 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 44si4052476plb.248.2017.07.19.03.13.30; Wed, 19 Jul 2017 03:13:31 -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=fH2iks+p; 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 S1754340AbdGSKN2 (ORCPT + 25 others); Wed, 19 Jul 2017 06:13:28 -0400 Received: from mail-pg0-f51.google.com ([74.125.83.51]:35240 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754255AbdGSKNX (ORCPT ); Wed, 19 Jul 2017 06:13:23 -0400 Received: by mail-pg0-f51.google.com with SMTP id v190so28708245pgv.2 for ; Wed, 19 Jul 2017 03:13:23 -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=cqCybcpXLY0cxkBwFZgpljmVkHlGtO8cyFu1JVIO9os=; b=fH2iks+p0dgCGjjiVET+pS+qJvyXTplSgx2uNSZ3i0IQGihXVArQUkChCtVcAk8ZOU oQYvHcHEWJNqkX4sdtmm0h491DAUSwBFnQpbtFedck0VGCd7ghR0Sn2zzPmNqvI6xW8D kSsTmFdBovhsNxHIAYjRH1CyOBP2b8cgjiMzQ= 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=cqCybcpXLY0cxkBwFZgpljmVkHlGtO8cyFu1JVIO9os=; b=SDUirplQ21+r1oKySgiL7DUYDm7oQ9kLYcKJhEjydbkmmo3LD5/rOScmdRemxGbV79 +f1s0HaCscFKdm4NhJRuwKZIrtpKQoHJh0Q7LspeBUMKMCntwMKUyV/kV0NN7LkOiKug wQX0+3y1Y+7fkScQa6l2t7nduusvRqk6NEJCo9TBAWtfBJ3rV3+XZEuvF/UIvJ4FIXQM tPUMXgyHOMwiMWocrVmG57DNXSKiFpB2jBQlmX+XNmt/GO3Ouc0+VrDi7u8GxPGJAxZZ YOKeyuC7IlIR+4o6jVO8KG+ASYMDbdBnWcSYP7CvdaXygD7aatW+l5MMbPrGRsI0QhfF EKpA== X-Gm-Message-State: AIVw113W5NGo/KiZB3tzjremF76TFuDuyd8JCFJzMrmb2qQSVMXuQqep m7TZzKf+uCuPgMPq X-Received: by 10.84.142.129 with SMTP id 1mr2542998plx.10.1500459203386; Wed, 19 Jul 2017 03:13:23 -0700 (PDT) Received: from localhost ([122.167.171.93]) by smtp.gmail.com with ESMTPSA id e15sm9799829pfh.81.2017.07.19.03.13.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jul 2017 03:13:22 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Srinivas Pandruvada , Len Brown , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux@dominikbrodowski.net, linux-kernel@vger.kernel.org Subject: [PATCH V3 4/9] cpufreq: Don't set transition_latency for setpolicy drivers Date: Wed, 19 Jul 2017 15:42:44 +0530 Message-Id: <8f030aa6194cf1e67306f929e993e36971d1257b.1500373914.git.viresh.kumar@linaro.org> 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 The transition_latency field isn't used for drivers with ->setpolicy() callback present and there is no point setting it from the drivers. Signed-off-by: Viresh Kumar --- drivers/cpufreq/intel_pstate.c | 1 - drivers/cpufreq/longrun.c | 1 - 2 files changed, 2 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index b7fb8b7c980d..c1100a3e3325 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2138,7 +2138,6 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) if (ret) return ret; - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; if (IS_ENABLED(CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE)) policy->policy = CPUFREQ_POLICY_PERFORMANCE; else diff --git a/drivers/cpufreq/longrun.c b/drivers/cpufreq/longrun.c index 074971b12635..542aa9adba1a 100644 --- a/drivers/cpufreq/longrun.c +++ b/drivers/cpufreq/longrun.c @@ -270,7 +270,6 @@ static int longrun_cpu_init(struct cpufreq_policy *policy) /* cpuinfo and default policy values */ policy->cpuinfo.min_freq = longrun_low_freq; policy->cpuinfo.max_freq = longrun_high_freq; - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; longrun_get_policy(policy); return 0; From patchwork Wed Jul 19 10:12:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 108265 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp665795obm; Wed, 19 Jul 2017 03:14:44 -0700 (PDT) X-Received: by 10.98.24.21 with SMTP id 21mr2295181pfy.190.1500459284151; Wed, 19 Jul 2017 03:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500459284; cv=none; d=google.com; s=arc-20160816; b=ndmVI/wUbNlxNjoDBBxfO1YZCQ2gzsJzbR5rpoPA/I0KityAuxw9W3leUfX2pwsYbe kBGWjc/sajCWss0UIMmfdH26YO6vMSFeGXRpVrjSX/1VYajQ6qgywYGsyXFhb4DTLdXl Pg3kyexmaQtKL1wGcKG3nU3TcdL3NcpnyXWAJmyqrB5WLXvxclAbyV9fgyxNlgbe5Ug+ KIZcxsj88HnepZ5VAqPD9OTFKQ0gWFkCTYUjWFF3WpDsVdRAtHOfINPSG0lXbGE5+vSb AtYvde12AQbanGUdVza2NTF1vqigThQOHXNrZR4QGfKgmY+7ezUCT2HBWcoSBvt18QV9 wRrA== 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=wyFymjBuTZYWacJf584+rWHVYXX3cte10CYWu8ToLTI=; b=oPzjiw1VoEm0ONOq1EApv28nxu6zK/hxjDcBFU0hC+MSabhN9DCC6kCu/EMYUeD18b jGi/1fNf8XbvsU1MVgpgtB8be16UdqGwaUGeezqN6XEaQKI5fUyxtT54cLPZ0aTnYqdK vF9OXAJMvZ6RAdfTS1myl1xDbVF3QqumooU9yh1dzSBq+gtBVOhwxAPkfJ4HgNODAsa0 EhgvpXvVjaBhZhIzy/MqLz1XNA7RjQqxp3F0fizb4LubeiGicPPkDXpgm5z0Lfbiljnt PDZqM5s/Ca+PyDd66MaKUyEVvinJZ86PyTZaXzkpGCvg/GKShIUUUwvPC1Y3gpMf9b2Q veiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=KSWmfFfs; 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 1si2487200pln.153.2017.07.19.03.14.43; Wed, 19 Jul 2017 03:14:44 -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=KSWmfFfs; 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 S1754469AbdGSKOl (ORCPT + 25 others); Wed, 19 Jul 2017 06:14:41 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:33605 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754278AbdGSKN0 (ORCPT ); Wed, 19 Jul 2017 06:13:26 -0400 Received: by mail-pf0-f179.google.com with SMTP id s70so16177198pfs.0 for ; Wed, 19 Jul 2017 03:13:26 -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=wyFymjBuTZYWacJf584+rWHVYXX3cte10CYWu8ToLTI=; b=KSWmfFfs+uET2KVucsv7z+My9NjiojOR2iYoJ/sNL/v+j1gINISjs8B74Mg5OnEDA9 5tIrQefADUdeHuY0ipck4LFtF1Dp4cG2O2LBnf188OS4BznKhk8BIVsSp98c2FJIBKRS 37f4SV2hrVK9HoziZ7n13/600hqeMuzbRK7Uk= 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=wyFymjBuTZYWacJf584+rWHVYXX3cte10CYWu8ToLTI=; b=BcPLd9jL7TQDctA1vmomJizEKA26ehXuS3Aw6x+9kL6mGybEaUwhEJQ06MHsDyyCpF STApuYz1pfE5viZ8OmtQ918kpiG9vCed2urNGrFKTg4+v242zOwxNKhef0hQYkDIC1mb OlpfGJzPxjxjIoBcy5mkab0kz9l8PI6NRPy1jZo0OYxSneqOTK0Q0LZGuYIM1Jx/NMmM +cnz+r7vZHigpH+A4mZuOHiMLO5/icNdoVzCKHqhjfCzKLqhNIMP+7FK7r0DlovsnDIY S21NlJHFSqPiZ+i0LoNrsQVVNmRXBEz5tqyg6mX5sd4XDIgxPrxi4orn+XUVRMhftYka VaxQ== X-Gm-Message-State: AIVw111qEkkHhGPeBARwC/WDB/lvoEt1gnR4Oh63KZqA9m1FcJB1MWd4 yZEvgfMKVEO8lIRe X-Received: by 10.99.102.65 with SMTP id a62mr2261995pgc.59.1500459206182; Wed, 19 Jul 2017 03:13:26 -0700 (PDT) Received: from localhost ([122.167.171.93]) by smtp.gmail.com with ESMTPSA id h3sm12188527pfj.72.2017.07.19.03.13.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jul 2017 03:13:25 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Sudeep Holla Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux@dominikbrodowski.net, linux-kernel@vger.kernel.org Subject: [PATCH V3 5/9] cpufreq: arm_big_little: Make ->get_transition_latency() mandatory Date: Wed, 19 Jul 2017 15:42:45 +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 All users of arm_big_little driver are defining it and there is no need to keep it optional. Make it mandatory to remove the always true conditional statement. Signed-off-by: Viresh Kumar --- drivers/cpufreq/arm_big_little.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index ea6d62547b10..17504129fd77 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c @@ -483,11 +483,8 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy) return ret; } - if (arm_bL_ops->get_transition_latency) - policy->cpuinfo.transition_latency = - arm_bL_ops->get_transition_latency(cpu_dev); - else - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; + policy->cpuinfo.transition_latency = + arm_bL_ops->get_transition_latency(cpu_dev); if (is_bL_switching_enabled()) per_cpu(cpu_last_req_freq, policy->cpu) = clk_get_cpu_rate(policy->cpu); @@ -622,7 +619,8 @@ int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops) return -EBUSY; } - if (!ops || !strlen(ops->name) || !ops->init_opp_table) { + if (!ops || !strlen(ops->name) || !ops->init_opp_table || + !ops->get_transition_latency) { pr_err("%s: Invalid arm_bL_ops, exiting\n", __func__); return -ENODEV; } 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; }; From patchwork Wed Jul 19 10:12:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 108263 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp664860obm; Wed, 19 Jul 2017 03:13:43 -0700 (PDT) X-Received: by 10.84.157.74 with SMTP id u10mr2373183plu.137.1500459223627; Wed, 19 Jul 2017 03:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500459223; cv=none; d=google.com; s=arc-20160816; b=a5sWAPC+FgZ8wwtsfIXxobQK5ZRyKQKolIyXY+cO5rBK8RaGSBYPJ0k8g49uu231bI wP1B1etv+KRTY5GexCLVpPwjd9T11xuu7UC0LOZNX8AnMZCc6EXtYaRY6kjPoAUd9pWL Rabvi7egaiK0ZSL50To8VKR34804WJBzwcr1QpywNOebQnLKMsVK+j2jv22yWXs6wEus gczM1EghZJ74/Wzrc7t+jFc0rUWyvY69QAE8mmwpRUOFOwxW/SMlhihsU2jmkqIiBWWf l1ZZVTsTqt5IaAOahaH58HL8VjiFBFgINergthjw83rsqzlRfiOHhcrVFVepcXH/yH21 xA/g== 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=/Q2sXw/gvOwAmoUDPheI6/qz1ViwA1PcSjsvkvRCwBg=; b=skXHABGxxpJSyxCboVauG3LDxKrnZIMoV5btbtXJ0NyKahmJGh6ZSpBnlyNkDPbv0n +eWUc8ChWMZlxFErz4QyYd+kJCa+3wtxdyQ9L05sc6Z0lxP7YSFwanUiuVqz1PWzOTBF XiktCUJV3t/HMiLnBN/3hEwvToFAGqQFrYV2rYQJlxakYPHjOhBhLtG8XqvfRbQV73x9 vUzKp5dhKjmnz22F1tkO781sOIFAdI9sOePTQp1J+diRzDz2J7cRQfZuruZWvDqhHoiS aWDnpVfG7aEmAuO/onKVHLRPqRi0Fss1TWKV/cnWI2NxNuUnx53U6nJfmj998OqtfUAD 1DtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=OzAsE4Pz; 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.43; Wed, 19 Jul 2017 03:13:43 -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=OzAsE4Pz; 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 S932330AbdGSKNk (ORCPT + 25 others); Wed, 19 Jul 2017 06:13:40 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:34619 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932314AbdGSKNg (ORCPT ); Wed, 19 Jul 2017 06:13:36 -0400 Received: by mail-pg0-f49.google.com with SMTP id 123so28705670pgj.1 for ; Wed, 19 Jul 2017 03:13:36 -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=/Q2sXw/gvOwAmoUDPheI6/qz1ViwA1PcSjsvkvRCwBg=; b=OzAsE4PzLVMRI2sGLWerTFD7dsPCOq8r67RIdQ36ZY1w1ZLIVfKqrudJvKcKnSDe43 77kkVon3xLohQ5xGeIjZg7FEySfPpJqhQdpnETBVhxJZ+rHz/pxX1B6mCGKsFv7/4LIj T95gtZrmo9la3Zbguz+6etkiF7+58DGSOcHPU= 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=/Q2sXw/gvOwAmoUDPheI6/qz1ViwA1PcSjsvkvRCwBg=; b=oNjHWCJN7xs16zUBXsTbW8Pw4xPwMMiOgTA1MSaUlciVvQkOl01peKdm54kvNRxlOT sK+FJCap5ctgAGWRYUncNVJX6nXWT/GBcRZ907geqMgJmqhX3dP64MkDgIIXFzTgO44s iv+iK0Tq0vNQXAMrwd5musUi5QKgyfKpHvvtHpuVd1w7LX7NvzVcH4KGiOU9uKyNJ3D7 AoOSUavz+eIweUFnYWosuCBqNrRl6CYUTweojzwp1kjduJVLPyDTp9QT1mtTNKwgE3za GoP8FGpE2GtQ2Th5it380SA9CSQRhN3bXuxwn8SBNGbRqoPoJtYzIfJBjjObr8Kow9JI exkQ== X-Gm-Message-State: AIVw1114cpXv5iCMzGKISJNDd7yi1wYGv383einqmG1hF2DCrVRYomy8 OqzEGmjQ9Ud8871y X-Received: by 10.99.106.69 with SMTP id f66mr2279081pgc.282.1500459215564; Wed, 19 Jul 2017 03:13:35 -0700 (PDT) Received: from localhost ([122.167.171.93]) by smtp.gmail.com with ESMTPSA id c22sm3429734pfh.21.2017.07.19.03.13.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jul 2017 03:13:35 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux@dominikbrodowski.net, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH V3 8/9] cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag Date: Wed, 19 Jul 2017 15:42:48 +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 The policy->transition_latency field is used for multiple purposes today and its not straight forward at all. This is how it is used: A. Set the correct transition_latency value. B. Set it to CPUFREQ_ETERNAL because: 1. We don't want automatic dynamic switching (with ondemand/conservative) to happen at all. 2. We don't know the transition latency. This patch handles the B.1. case in a more readable way. A new flag for the cpufreq drivers is added to disallow use of cpufreq governors which have dynamic_switching flag set. All the current cpufreq drivers which are setting transition_latency unconditionally to CPUFREQ_ETERNAL are updated to use it. They don't need to set transition_latency anymore. There shouldn't be any functional change after this patch. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-nforce2.c | 2 +- drivers/cpufreq/cpufreq.c | 5 +++-- drivers/cpufreq/elanfreq.c | 4 +--- drivers/cpufreq/gx-suspmod.c | 2 +- drivers/cpufreq/pmac32-cpufreq.c | 7 +++++-- drivers/cpufreq/sa1100-cpufreq.c | 5 +++-- drivers/cpufreq/sa1110-cpufreq.c | 5 +++-- drivers/cpufreq/sh-cpufreq.c | 3 +-- drivers/cpufreq/speedstep-smi.c | 2 +- drivers/cpufreq/unicore2-cpufreq.c | 3 +-- include/linux/cpufreq.h | 6 ++++++ 11 files changed, 26 insertions(+), 18 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/cpufreq/cpufreq-nforce2.c b/drivers/cpufreq/cpufreq-nforce2.c index 5503d491b016..dbf82f36d270 100644 --- a/drivers/cpufreq/cpufreq-nforce2.c +++ b/drivers/cpufreq/cpufreq-nforce2.c @@ -357,7 +357,6 @@ static int nforce2_cpu_init(struct cpufreq_policy *policy) /* cpuinfo and default policy values */ policy->min = policy->cpuinfo.min_freq = min_fsb * fid * 100; policy->max = policy->cpuinfo.max_freq = max_fsb * fid * 100; - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; return 0; } @@ -369,6 +368,7 @@ static int nforce2_cpu_exit(struct cpufreq_policy *policy) static struct cpufreq_driver nforce2_driver = { .name = "nforce2", + .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, .verify = nforce2_verify, .target = nforce2_target, .get = nforce2_get, diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 2debfb5f9126..a4d9b47c4af4 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2016,11 +2016,12 @@ static int cpufreq_init_governor(struct cpufreq_policy *policy) /* Platform doesn't want dynamic frequency switching ? */ if (policy->governor->dynamic_switching && - policy->cpuinfo.transition_latency == CPUFREQ_ETERNAL) { + (cpufreq_driver->flags & CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING || + policy->cpuinfo.transition_latency == CPUFREQ_ETERNAL)) { struct cpufreq_governor *gov = cpufreq_fallback_governor(); if (gov) { - pr_warn("Transition latency set to CPUFREQ_ETERNAL, can't use %s governor. Fallback to %s governor\n", + pr_warn("Can't use %s governor as dynamic switching is disallowed. Fallback to %s governor\n", policy->governor->name, gov->name); policy->governor = gov; } else { diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c index bfce11cba1df..45e2ca62515e 100644 --- a/drivers/cpufreq/elanfreq.c +++ b/drivers/cpufreq/elanfreq.c @@ -165,9 +165,6 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy) if (pos->frequency > max_freq) pos->frequency = CPUFREQ_ENTRY_INVALID; - /* cpuinfo and default policy values */ - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; - return cpufreq_table_validate_and_show(policy, elanfreq_table); } @@ -196,6 +193,7 @@ __setup("elanfreq=", elanfreq_setup); static struct cpufreq_driver elanfreq_driver = { .get = elanfreq_get_cpu_frequency, + .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, .verify = cpufreq_generic_frequency_table_verify, .target_index = elanfreq_target, .init = elanfreq_cpu_init, diff --git a/drivers/cpufreq/gx-suspmod.c b/drivers/cpufreq/gx-suspmod.c index 3488c9c175eb..8f52a06664e3 100644 --- a/drivers/cpufreq/gx-suspmod.c +++ b/drivers/cpufreq/gx-suspmod.c @@ -428,7 +428,6 @@ static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy) policy->max = maxfreq; policy->cpuinfo.min_freq = maxfreq / max_duration; policy->cpuinfo.max_freq = maxfreq; - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; return 0; } @@ -438,6 +437,7 @@ static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy) * MediaGX/Geode GX initialize cpufreq driver */ static struct cpufreq_driver gx_suspmod_driver = { + .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, .get = gx_get_cpuspeed, .verify = cpufreq_gx_verify, .target = cpufreq_gx_target, diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c index ff44016ea031..61ae06ca008e 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -442,7 +442,8 @@ static struct cpufreq_driver pmac_cpufreq_driver = { .init = pmac_cpufreq_cpu_init, .suspend = pmac_cpufreq_suspend, .resume = pmac_cpufreq_resume, - .flags = CPUFREQ_PM_NO_WARN, + .flags = CPUFREQ_PM_NO_WARN | + CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, .attr = cpufreq_generic_attr, .name = "powermac", }; @@ -626,14 +627,16 @@ static int __init pmac_cpufreq_setup(void) if (!value) goto out; cur_freq = (*value) / 1000; - transition_latency = CPUFREQ_ETERNAL; /* Check for 7447A based MacRISC3 */ if (of_machine_is_compatible("MacRISC3") && of_get_property(cpunode, "dynamic-power-step", NULL) && PVR_VER(mfspr(SPRN_PVR)) == 0x8003) { pmac_cpufreq_init_7447A(cpunode); + + /* Allow dynamic switching */ transition_latency = 8000000; + pmac_cpufreq_driver.flags &= ~CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING; /* Check for other MacRISC3 machines */ } else if (of_machine_is_compatible("PowerBook3,4") || of_machine_is_compatible("PowerBook3,5") || diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c index 728eab77e8e0..e2d8a77c36d5 100644 --- a/drivers/cpufreq/sa1100-cpufreq.c +++ b/drivers/cpufreq/sa1100-cpufreq.c @@ -197,11 +197,12 @@ static int sa1100_target(struct cpufreq_policy *policy, unsigned int ppcr) static int __init sa1100_cpu_init(struct cpufreq_policy *policy) { - return cpufreq_generic_init(policy, sa11x0_freq_table, CPUFREQ_ETERNAL); + return cpufreq_generic_init(policy, sa11x0_freq_table, 0); } static struct cpufreq_driver sa1100_driver __refdata = { - .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, + .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, .verify = cpufreq_generic_frequency_table_verify, .target_index = sa1100_target, .get = sa11x0_getspeed, diff --git a/drivers/cpufreq/sa1110-cpufreq.c b/drivers/cpufreq/sa1110-cpufreq.c index 2bac9b6cfeea..66e5fb088ecc 100644 --- a/drivers/cpufreq/sa1110-cpufreq.c +++ b/drivers/cpufreq/sa1110-cpufreq.c @@ -306,13 +306,14 @@ static int sa1110_target(struct cpufreq_policy *policy, unsigned int ppcr) static int __init sa1110_cpu_init(struct cpufreq_policy *policy) { - return cpufreq_generic_init(policy, sa11x0_freq_table, CPUFREQ_ETERNAL); + return cpufreq_generic_init(policy, sa11x0_freq_table, 0); } /* sa1110_driver needs __refdata because it must remain after init registers * it with cpufreq_register_driver() */ static struct cpufreq_driver sa1110_driver __refdata = { - .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, + .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, .verify = cpufreq_generic_frequency_table_verify, .target_index = sa1110_target, .get = sa11x0_getspeed, diff --git a/drivers/cpufreq/sh-cpufreq.c b/drivers/cpufreq/sh-cpufreq.c index 719c3d9f07fb..28893d435cf5 100644 --- a/drivers/cpufreq/sh-cpufreq.c +++ b/drivers/cpufreq/sh-cpufreq.c @@ -137,8 +137,6 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy) (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; } - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; - dev_info(dev, "CPU Frequencies - Minimum %u.%03u MHz, " "Maximum %u.%03u MHz.\n", policy->min / 1000, policy->min % 1000, @@ -159,6 +157,7 @@ static int sh_cpufreq_cpu_exit(struct cpufreq_policy *policy) static struct cpufreq_driver sh_cpufreq_driver = { .name = "sh", + .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, .get = sh_cpufreq_get, .target = sh_cpufreq_target, .verify = sh_cpufreq_verify, diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c index 37b30071c220..d23f24ccff38 100644 --- a/drivers/cpufreq/speedstep-smi.c +++ b/drivers/cpufreq/speedstep-smi.c @@ -266,7 +266,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) pr_debug("workaround worked.\n"); } - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; return cpufreq_table_validate_and_show(policy, speedstep_freqs); } @@ -290,6 +289,7 @@ static int speedstep_resume(struct cpufreq_policy *policy) static struct cpufreq_driver speedstep_driver = { .name = "speedstep-smi", + .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, .verify = cpufreq_generic_frequency_table_verify, .target_index = speedstep_target, .init = speedstep_cpu_init, diff --git a/drivers/cpufreq/unicore2-cpufreq.c b/drivers/cpufreq/unicore2-cpufreq.c index 6f9dfa80563a..db62d9844751 100644 --- a/drivers/cpufreq/unicore2-cpufreq.c +++ b/drivers/cpufreq/unicore2-cpufreq.c @@ -58,13 +58,12 @@ static int __init ucv2_cpu_init(struct cpufreq_policy *policy) policy->min = policy->cpuinfo.min_freq = 250000; policy->max = policy->cpuinfo.max_freq = 1000000; - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->clk = clk_get(NULL, "MAIN_CLK"); return PTR_ERR_OR_ZERO(policy->clk); } static struct cpufreq_driver ucv2_driver = { - .flags = CPUFREQ_STICKY, + .flags = CPUFREQ_STICKY | CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, .verify = ucv2_verify_speed, .target = ucv2_target, .get = cpufreq_generic_get, diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index e141dbbb9d1c..5f40522ec98c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -370,6 +370,12 @@ struct cpufreq_driver { */ #define CPUFREQ_NEED_INITIAL_FREQ_CHECK (1 << 5) +/* + * Set by drivers to disallow use of governors with "dynamic_switching" flag + * set. + */ +#define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING (1 << 6) + int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); From patchwork Wed Jul 19 10:12:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 108264 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp664952obm; Wed, 19 Jul 2017 03:13:51 -0700 (PDT) X-Received: by 10.99.112.3 with SMTP id l3mr2200851pgc.143.1500459231610; Wed, 19 Jul 2017 03:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500459231; cv=none; d=google.com; s=arc-20160816; b=nJAmexiA+pq4Qk9DB7/ztB8zTsNd3oabDulVmRwms3OCyuuojVQ6z0pPnvDIgHL5ea CSSE7P3Pugb0nIDMx3HhMGPIzQ/GhS2sQPcqJfWwJKpZV75UzSCJDIqZTRDqAC5DpfcJ BGWprnQ86piTBGh3CDFYrYOyuo9xUDhTUd57VGwnxJWrCA4nxKJqpXSsLkWL353QbS8x Fcjez3DsXRG7xbz31ecO4VAtGBcBb4dcIfT6hH8JYouxUZ/bhGCskXkHTc4KwIY3VdkJ xxFgWJ3SmLol8L/ct94Lkmd7sLeVexCXvkp1VDyNnN9GPvSV7/nNWwkC5jpY58AC2u8F x9Bg== 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=XwdCaH1/ceKa/aCZxa2glEli7oiuyYcxOYy5YfigPtQ=; b=WCcIeQcpeX1vXV7uR8NNk99KD0mJiyDr4OXGCcwJ8fPk3AmIqIBHx/uDHRHkp0xhIR Yiv4BsMKn6zupotPBs86cQNAKN2peSzrzsJ0H3ShfJumMGMwF/6ZpO0hC9+LOccM1Duz 8DR1gryaQqq1a3xGmV/+2WrePGKtq7XqSleaU96PotFI3/o+al+YR+Pi4949muQ+QmuN D+G8wTDIYEfWseqM7yVMo/v8/2DgLcDOKTAR8Cv2xJYe+mncPVy89lvk+YlUiwN9R5rt zXczLqfBxR6HvltuzofdMVfXWadvsckC3vwwVn7f4LmWrvczsRENk6gjTfM8QDKY7XZ3 3Gww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=HqI8ECNF; 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 y38si3889880plh.438.2017.07.19.03.13.51; Wed, 19 Jul 2017 03:13:51 -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=HqI8ECNF; 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 S932345AbdGSKNs (ORCPT + 25 others); Wed, 19 Jul 2017 06:13:48 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:36510 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932317AbdGSKNj (ORCPT ); Wed, 19 Jul 2017 06:13:39 -0400 Received: by mail-pf0-f179.google.com with SMTP id o88so18904467pfk.3 for ; Wed, 19 Jul 2017 03:13:38 -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=XwdCaH1/ceKa/aCZxa2glEli7oiuyYcxOYy5YfigPtQ=; b=HqI8ECNFfyWV+d46bZA03Z9GY/DSmqOwwm+zdmcOI2I3wIpC6rvLCK10hqmtcWFhyl JN3UEgK6EH0gXXPS1TRQRiZDWklrtmZOKHv7u+vdhSKmB8XlVb+qM1dkqTlaety9+EJ0 ko8nnZRJTB6GaEZ0cb8L37/HuPxmJ79GTEruM= 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=XwdCaH1/ceKa/aCZxa2glEli7oiuyYcxOYy5YfigPtQ=; b=gWurKX/ZKsXNFlxlZLBaxxJJk553nKsqmZt+K8MLZDA6s28QH8z8coRxkKy05/wFEF ml94JfMn3gXQ1dqo7zWis5TojKS67jDh2IoTbYNuVcLQen0G+APNkfniNQsVjsK6+MG9 DFXgwbc++RBTGH4DVb6o9z8pGdR5hDaujT0uv0U2/jaS9BmVs3zadShEja5uGBK4zIu3 thY9pBPAHRVeiUY0LMGgzdh0i6Krg0ZsMAvtFHHYwvZtrOYR0pzhIUHPg6fDTKePkcBW v49kvlbdhqDBgRA2Etf7sauxJOAvqnDJgAiwwAnCtL5OLBbYHT/Il3HAyQwT4nYxB0Qk lxCw== X-Gm-Message-State: AIVw1123nceXC7hpnaISXoau/GO97tf3x/PgNJe6paCwft2yyLuICYLy dJw0PQjk2l5NoKC3 X-Received: by 10.84.149.139 with SMTP id m11mr2425372pla.266.1500459218457; Wed, 19 Jul 2017 03:13:38 -0700 (PDT) Received: from localhost ([122.167.171.93]) by smtp.gmail.com with ESMTPSA id k19sm12221554pfk.16.2017.07.19.03.13.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jul 2017 03:13:37 -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 9/9] cpufreq: Allow dynamic switching with CPUFREQ_ETERNAL latency Date: Wed, 19 Jul 2017 15:42:49 +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 With the recent updates, CPUFREQ_ETERNAL is only used by the drivers which don't know their transition latency but want to use dynamic switching. Anyway, the routine cpufreq_policy_transition_delay_us() caps the value of transition latency to 10 ms now and that can be used safely with such platforms. Remove the check from cpufreq_init_governor() and allow dynamic switching for such configurations as well. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a4d9b47c4af4..c7ae67d6886d 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2016,8 +2016,7 @@ static int cpufreq_init_governor(struct cpufreq_policy *policy) /* Platform doesn't want dynamic frequency switching ? */ if (policy->governor->dynamic_switching && - (cpufreq_driver->flags & CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING || - policy->cpuinfo.transition_latency == CPUFREQ_ETERNAL)) { + cpufreq_driver->flags & CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING) { struct cpufreq_governor *gov = cpufreq_fallback_governor(); if (gov) {