From patchwork Thu Jun 29 10:59:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106626 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp4553543obb; Thu, 29 Jun 2017 03:59:20 -0700 (PDT) X-Received: by 10.98.86.3 with SMTP id k3mr10071158pfb.144.1498733960003; Thu, 29 Jun 2017 03:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498733959; cv=none; d=google.com; s=arc-20160816; b=ZXIS2cu57NEEB5zfEHZpKfJH1dQRnY0WMHYuexCRCCI02sIZif3qgmnrkhcI4ASFVr PQ3V8BogRbzp1OfNltRfn16z5PkOx7/R/cWrqOFpgiRdIEeNy9oYpJWMkeO1NbWIZ7D5 eaaaGs4epzTwg9oggRbg2wf+8ZmTEZB4VlCNWHXlDvz/q52lLcb7zpFmbdgYB0HE8Q/T Sy8ivvzOWHtlfVIGqKkRyzpf9zZ2mhx8ZqsBQry8orO/7EeO8Y3MVeCevL/Cgdd6g4YH rMdalCqPFDquy3XZjYC62yJLTe+xdjnSautVlWcyJ3jfMRxABvqrCl5cE5FESbEpkeNK V9zg== 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=Al/xZgSM6SZzr6Mzr2dz6GxkNO9nE0hAkMWS5HXPbCE=; b=jBdM4U3srnR3BkgPBrRIiYqgiS+05f5DNk/cDhfMhFH9a8U07qxi2aZWU/EU2AMRaU dHZutIPP8NTh+Q/22UswzJ/8ZDVfodi/IW/m+O0znnS0RWOCQ5Xkv6Ar5uXuLfhuWNg7 lhpR3VpDIPHGjGlGMoHg64W62n6HmiyhUhNeT2cHtwX1Mx2ejAcKZHimZrFPZR79TXeE bOoAaWYyXNokluL78djVA6S0Eqc9WLXynGlW03zcCwcLqe7Wc1vl8/75OsqNsriVljZS 7dPizXH3tDvVcg4GQw6CRXObbHK3heAUWSIgrmM+dEiYVedcJVK//9vo8YYfeGYry+I8 nFJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=X4eehn1F; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 d6si3888652plj.558.2017.06.29.03.59.19; Thu, 29 Jun 2017 03:59:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=X4eehn1F; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1752626AbdF2K7S (ORCPT + 14 others); Thu, 29 Jun 2017 06:59:18 -0400 Received: from mail-pg0-f50.google.com ([74.125.83.50]:36143 "EHLO mail-pg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752440AbdF2K7R (ORCPT ); Thu, 29 Jun 2017 06:59:17 -0400 Received: by mail-pg0-f50.google.com with SMTP id u62so46261953pgb.3 for ; Thu, 29 Jun 2017 03:59:17 -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=Al/xZgSM6SZzr6Mzr2dz6GxkNO9nE0hAkMWS5HXPbCE=; b=X4eehn1FtiFsVSnLFQQyPAwFykDx0CtiPVcPywUnJJO0DXWnIPlNq07ANnvKLLB4hw McQ0GE6ihp9KdSwumQ4IVZtXrwgnOC9y1BEW6txpLxgH37rTj89qQyreU9unmQcZY4F8 KfPfiCZNrV0UQyZlYwPOBLjZMUF2rNqO7pt68= 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=Al/xZgSM6SZzr6Mzr2dz6GxkNO9nE0hAkMWS5HXPbCE=; b=LUDWDDJwc3bRBqxrwSpVLZN88CVyNHF0twaTMlpVx7lQX6Gvt0HckNnoZHlxpNEzCr wfvajouwdQ+epqPdc3qfioxBCXvrx4qEYO2hP28h/Ou5wpumXShTv8xJH4s81E7WgkZy iEU6ewVeTXzAn8hma5QXtE2Z02yoJj2J5AGJETkrXR2Yi7ncqhlF9dnqabWw2WVY/mI7 d3Xlb8Vzx6Bqr1wU5GWcjfw+hEuvrj3BZOvOue3E0b3T7aM6fjN0o0b1GXfC2UB+XGA4 n7wjC3ykSVgiHbYUCswuHoddjK9XmOzBMSFcmw12QYx43Qm4nkOpQH0+Wnnov4vIOkp6 97LQ== X-Gm-Message-State: AKS2vOyyFueiy2Jvc9UGWFbkSKraBd531fjPetbbo24DiY0KBBwNcN6e sH8C0VdWORpvM+GNo2NK1g== X-Received: by 10.99.115.2 with SMTP id o2mr15315769pgc.48.1498733957150; Thu, 29 Jun 2017 03:59:17 -0700 (PDT) Received: from localhost ([122.171.238.149]) by smtp.gmail.com with ESMTPSA id t26sm4231118pfl.41.2017.06.29.03.59.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2017 03:59:16 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH 1/6] cpufreq: Don't check for max_transition_latency Date: Thu, 29 Jun 2017 16:29:04 +0530 Message-Id: <9924a30ffcce1b83fd6b3d199753a039a1d6f5ef.1498733506.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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This check is there only for drivers that set transition_latency to CPUFREQ_ETERNAL. And the "max_transition_latency" field is only set for ondemand and conservative governors (i.e. This code doesn't run for schedutil governor). With CPUFREQ_ETERNAL, transition latency becomes around 4 seconds (yeah its practically impossible). But even then there is nothing particular in the governor's code that will not function if the latency is over 10ms (TRANSITION_LATENCY_LIMIT). Why disable use of the governor completely ? And if its about falling back to the performance governor for such platforms, then we aren't doing the same for schedutil governor. This patch get rids of this particular check and let platforms decide if they want to use legacy governors or not. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 14 -------------- include/linux/cpufreq.h | 3 --- 2 files changed, 17 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6e7424d12de9..34dbbf3122c8 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1988,20 +1988,6 @@ 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) { - 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", - policy->governor->name, gov->name); - policy->governor = gov; - } else { - return -EINVAL; - } - } - if (!try_module_get(policy->governor->owner)) return -EINVAL; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 905117bd5012..0818bdc3ebf2 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -487,9 +487,6 @@ 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 MIN_SAMPLING_RATE_RATIO (2) #define LATENCY_MULTIPLIER (1000) From patchwork Thu Jun 29 10:59:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106628 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp4553996obb; Thu, 29 Jun 2017 03:59:51 -0700 (PDT) X-Received: by 10.84.224.74 with SMTP id a10mr17164054plt.210.1498733991119; Thu, 29 Jun 2017 03:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498733991; cv=none; d=google.com; s=arc-20160816; b=WQhS7c3hSpn6Gi69cTllhSJWJdsYMUyZCx3ftxHZmQ++yjJAo9PbUILfRTv+oXA4Ya mwaJWZDJvRIKoUtJsY8j5hmE2ls3djgw2u0nHnhTwa/lVHv48ZrdYMeDfBLL+fQLtcQe nVWAxoGJ27DWVa2yvIbTTKsKSbrQo5kEeUZ0ZoRGDQqWkCab+bg93L0LVCkECsK+YK4B vcUukY6J86ZGwRgf4YRtvGP9g6P3yPQmdCLJVRVHoE/ACSEQIU3m/qZb9rlbp0UBNwXs Yit5Gm39GvKC9KRDNA0jEw4tkRv51QRnMgR29UCaNy+Osc2mdXkLjdnROj7X/7OoOXZ1 ya9w== 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=qPVvYc84LptGQAGHA/9Dq8YtE/gBu9DViWNgekh6T5s=; b=v7HdBjJ4zf9NOzOYHo5/W11CKxx5uf8eyMU9ylKAmMmM6kDFFQCW9G3hSu6GyqKFoy YL/JikJTVDnmC97J1n+1GUsH3av9hGEOdWzJ3zaJct+RreVnHaMq2dQP2mpBoi6zlLX8 z9NpOPRfGIbFMb1/EyK8SgXW4KaQbhxFQ4DOG+Q8nYeVQfBiRPfieFQ8Nscly/xh1nvK FZ1mSCGcnztWUqtZXvbG3cXHLZYDUHq9YzA3RXQzBFVlamMcaTcOG7e61STZdLLlY9E7 WXNnK7rfeHjdUHsA6QCF82owfBobWXqi/uJHBRAWER5+T6pZw/ttIcI4XM5erc8Mi1EE jcew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=KcZDiKn+; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 n1si3772598pld.585.2017.06.29.03.59.50; Thu, 29 Jun 2017 03:59:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=KcZDiKn+; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1752727AbdF2K7l (ORCPT + 14 others); Thu, 29 Jun 2017 06:59:41 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:36169 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752658AbdF2K7Z (ORCPT ); Thu, 29 Jun 2017 06:59:25 -0400 Received: by mail-pg0-f53.google.com with SMTP id u62so46263107pgb.3 for ; Thu, 29 Jun 2017 03:59:24 -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=qPVvYc84LptGQAGHA/9Dq8YtE/gBu9DViWNgekh6T5s=; b=KcZDiKn+tWfuhH1uxAOJ+4P8wWROURfPUmBzwTMM+o3qn3UgQ6ErBqufkK06AECdTS /V/5xZOvZ8r1+k3uVWzQaQ5vyqtm/JAdaSPglLAQwAwucfRIHEHGLnE0FbQZmIWCjnlU DhjBn3lY1urbeVaAfw4ecgWQmcg3GEtZXMuZ8= 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=qPVvYc84LptGQAGHA/9Dq8YtE/gBu9DViWNgekh6T5s=; b=a/6G9asd/SeXTRwL6uDTR+8ya8nX46p/Tl0JP2+IYx1UEmvchGGksYgSX32hSZuxT5 oihEJXWLzy5vqArtAneiTgRDrCJUE1CJP7Sf+nF6NgoMV7ga6yqq1Z3tv+cm7AGGnWI4 X2d3EaWkMzHQbnL4C/QU5f740bqsU+BkkhaH6aHsys23ydLVuUt+o8rS1KoXRBcdn3fA nTq6W0JLcOq+3M+EZuEcd/b9W8Vxrngax87egCFELIYMBSIAdGOIXOWcD3cUtvAGSg2E rLUOQ/ZLoRcG/vDj33v285A2zSk7w+ACB7nLn1xgD2nNS52Erc1YM8Nv5weuMladjVLK t3Fw== X-Gm-Message-State: AKS2vOzIZXOF9Vp9vSUlVHyppMOv9GW0Nfz2NaN9MO7qkJ591+HgUOuv adK6+v2H/Cd91ZK/ X-Received: by 10.101.76.140 with SMTP id m12mr14784147pgt.159.1498733963302; Thu, 29 Jun 2017 03:59:23 -0700 (PDT) Received: from localhost ([122.171.238.149]) by smtp.gmail.com with ESMTPSA id 66sm10862637pfm.82.2017.06.29.03.59.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2017 03:59:22 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] cpufreq: governor: Drop min_sampling_rate Date: Thu, 29 Jun 2017 16:29:06 +0530 Message-Id: <713af1a417a9a77f0c41976b25874687ac235e8e.1498733506.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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 09aa2e949787..6adbe1ed58b9 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 7cbb07512e4c..06d9f90ede93 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 54dfa1bdf138..083e7f3c23dd 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -488,9 +488,7 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, * ondemand governor will work on any processor with transition latency <= 10ms, * using appropriate sampling rate. */ -#define MIN_SAMPLING_RATE_RATIO (2) #define LATENCY_MULTIPLIER (1000) -#define MIN_LATENCY_MULTIPLIER (20) struct cpufreq_governor { char name[CPUFREQ_NAME_LEN]; From patchwork Thu Jun 29 10:59:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106631 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp4554517obb; Thu, 29 Jun 2017 04:00:20 -0700 (PDT) X-Received: by 10.84.231.131 with SMTP id g3mr8580079plk.176.1498734020770; Thu, 29 Jun 2017 04:00:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498734020; cv=none; d=google.com; s=arc-20160816; b=TnPFoRYtpCp0oH40GMG7Tsn0Sbvbxs6PiS25WycGjOl7d+hsvY6sT8wyXMEteBd5rI 4sdf3ZWTZ47KGdbt4xkKVE1h4CzoyjNgF1qQy7eLbhueTEOpFBm65Bbqg1mDT67hFwbi a/Df9r04xuH90hUB1KRbjw1efiIobjDcKUoxtx60Dg3JLrhSTIMCQjn69sR4GBPrXvZB lBO87dq3dUQ3M8sLh963F5ctMCuD2+Dqnl8GMyzutnXsx1U6ZbLLAge4sfYsGa0KqSQL NEY6MLnj26fGKV1fRbtjOTV9dfJVFPrN/r10jWg92aUAeD7Q8tSz+jkAQ9/zCyjA0ijW bRIg== 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=hFl0al/TBsLP+Sq+C2OlskkhJVMU1+PVxYPlO9xb75c=; b=yUO7YYcx50BmYwHGqhNaDWWhCErC0jVMeo01ReDnxTdOZONjp2bnG3TrZFbj0P/PxC D3ZQ6cPfJ+NmpGhIB5MdbFKK3ChSxpURuW6vmUOVwfZvX2kt2NjWKSMaNsEdnQA9a/tJ /Kzk9lWWSbgCiJ6vsAqp1bTXCtTLqZeI6TmVVuGkOFe7PRQalU+3mN1Oalb9z282CPF/ MgeF+yMzqiwVT7o/zjss9FNvi3ZlU1tUWMbkrHTl422xB7qaDgoFKKpfeLns+drBTfHz 4K94l8NqVF81B/yiCBnqMONFsCaxubQh0f2fho2BqH/wvqdi8kBxHCZHdkXYbA8jaMIJ myQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=BDbiGWG3; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 73si4037945pld.428.2017.06.29.04.00.20; Thu, 29 Jun 2017 04:00:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=BDbiGWG3; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1752562AbdF2LAL (ORCPT + 14 others); Thu, 29 Jun 2017 07:00:11 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:35561 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752670AbdF2K71 (ORCPT ); Thu, 29 Jun 2017 06:59:27 -0400 Received: by mail-pg0-f52.google.com with SMTP id j186so46254435pge.2 for ; Thu, 29 Jun 2017 03:59:27 -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=hFl0al/TBsLP+Sq+C2OlskkhJVMU1+PVxYPlO9xb75c=; b=BDbiGWG3h6zxd6DD2cT7DK7QJsDaIF59PJPjjtRESZOhcBbW/j9cQTq6/0f6EUdqSR sAPLoObPNbj3KxbNDhX7xIN6XM3yrAktgh3e58mqjZ91Evt68K+JzYoLXMMCk+GUlupo v4Sn1jg98nLuszXXGJ+4NBj4lYkjDbDDVALbk= 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=hFl0al/TBsLP+Sq+C2OlskkhJVMU1+PVxYPlO9xb75c=; b=SoWp0KpK5HTEjriBHzOIw1xKp+PECmzeES0698j6IrPkKzO5V8/3GTV+QITFtgojOJ NdnBuP7tPMbyfRsiNofhXgHJwEEmvs/QRzIZxcQnMWaSITEKngONFGVTVS4H2GM/YqNB /rIyqOjLI3DPw9opAKz2u6TqTwP6HfY7vhfkZKlM9V0tybt01cneWeWWqOsALUtdf87Z 70pcjmuLxjXgytFK1SdK8/gLsueGWU6xJsSQNrrDRBktomTmsQc4lJ/5klySVrXWnizT m+eBgVJMh1wWbAgI+yFMY9ckWIoYU84dAuoXoqu8qLNsDe46WZpm0VhA/+RcRSLmj5wU n+kQ== X-Gm-Message-State: AKS2vOwgschTX8uFSfkIRgK5FtzEY39fF6cvPanP06X1EqRpu5d5gvHq +rUqGgFhtjNGd0xk X-Received: by 10.98.10.153 with SMTP id 25mr2755890pfk.200.1498733966380; Thu, 29 Jun 2017 03:59:26 -0700 (PDT) Received: from localhost ([122.171.238.149]) by smtp.gmail.com with ESMTPSA id k194sm7678857pgc.31.2017.06.29.03.59.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2017 03:59:25 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Ingo Molnar , Peter Zijlstra Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH 4/6] cpufreq: Use transition_delay_us for legacy governors as well Date: Thu, 29 Jun 2017 16:29:07 +0530 Message-Id: <157b6fdb97615e47126fcad7d7bc40370ed672f0.1498733506.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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The policy->transition_delay_us field is used only by the schedutil governor currently, but it should rather be a common thing across all governors. 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_governor.c | 9 +-------- include/linux/cpufreq.h | 15 +++++++++++++++ kernel/sched/cpufreq_schedutil.c | 11 +---------- 3 files changed, 17 insertions(+), 18 deletions(-) -- 2.13.0.71.gd7076ec9c9cb 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 083e7f3c23dd..dee6fe3d8af0 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -529,6 +529,21 @@ static inline void cpufreq_policy_apply_limits(struct cpufreq_policy *policy) __cpufreq_driver_target(policy, policy->min, CPUFREQ_RELATION_L); } +static inline unsigned int +cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy) +{ + unsigned int delay_us = LATENCY_MULTIPLIER, latency; + + if (policy->transition_delay_us) + return policy->transition_delay_us; + + latency = policy->cpuinfo.transition_latency / NSEC_PER_USEC; + if (latency) + delay_us *= latency; + + return delay_us; +} + /* Governor attribute set */ struct gov_attr_set { struct kobject kobj; diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 076a2e31951c..3bdec2a08e1e 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 Thu Jun 29 10:59:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106630 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp4554488obb; Thu, 29 Jun 2017 04:00:19 -0700 (PDT) X-Received: by 10.98.14.130 with SMTP id 2mr16107840pfo.218.1498734019532; Thu, 29 Jun 2017 04:00:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498734019; cv=none; d=google.com; s=arc-20160816; b=pR+uEp/H/i6V+tkzYwD/pa7Ocn8N8R/LtcdUxOTovkzM6hDk5Eb0oeUyqOzL6/v7BX z1qfVj7H+ro58hkq9aMPyB1Lh0mJQntIEsCxHSOYw9NVEblOSVc/9RvifmZj3hrYm2UV ujPYJrkzg4T37y3GVBMa55jyNpQlce0Mse94k8zDHEmCr/kOJydzGvKw5NHIIDI3Oc2T fN+LA65lP402VnPRuTf1GDsKg0NNfJFOkmchaIU/noCnp59BILwHKyhOyE5ZWjdrG73F iR78qBucLtttJlAaEplTM3PiVBFUcu/0LMDE7GU03E4WJnI16+RFBkXIxf4yn1FZTJYV gSQQ== 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=ZpS7jWqMqi8s3ETI7+Xp7hSqbXO9sF0SbgmI/BCVAgY=; b=opdkT7zgN89Sbiq2XEFkQVW0UCYOKaYU0EV7JQsp2M/Vv7ld1KVVdGOJFcKnmDC8dW TRk+RhRfu3ww+yjIjMojmvTwg1o5HasHgJCuSyuHPu1EoJJa3x0QeZZPpSMwCl/gi9vj ite2G0phK1pfIN5PziCLMGBrKK9lGwmUBBOMiO8K/JetLZUWJZrkCq6eUaOEANflUkmE rWanskXbIgB2wpq/eGP1nA5p5EN8wi5+vC/fTg4HFlGq7GExL+b3/iVe1HXbOiA1CHs6 nfo1H2Td9nkVy9xHbEwqTvf4hYvLv/30SP0SO5sfPU+le/wnZP8WlBAJyj/i0a/ltb3i vV7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=e2miLbh/; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 73si4037945pld.428.2017.06.29.04.00.18; Thu, 29 Jun 2017 04:00:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=e2miLbh/; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1752593AbdF2LAH (ORCPT + 14 others); Thu, 29 Jun 2017 07:00:07 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:35588 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752689AbdF2K7d (ORCPT ); Thu, 29 Jun 2017 06:59:33 -0400 Received: by mail-pg0-f42.google.com with SMTP id j186so46255610pge.2 for ; Thu, 29 Jun 2017 03:59:32 -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=ZpS7jWqMqi8s3ETI7+Xp7hSqbXO9sF0SbgmI/BCVAgY=; b=e2miLbh/tWwdNy10tXLb/hvWFmJ7X4IiyCkkpQCXXiMmIl2J6VVazGHwPyLCcc9ESX f+zdPIKq+SQ3Vb23B/XmKJDXF7qjUesBgbRoHtJpWW6dcACOCA7FYNf8/83C6TwrtcMi Hdj6hU7GOF0GDllI9CKStT7wmY/DcT9Rglv0c= 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=ZpS7jWqMqi8s3ETI7+Xp7hSqbXO9sF0SbgmI/BCVAgY=; b=cXEple3VmMNbwRmem5zOc+4UyJB2FWhN82Oolp92h4q+7TTGQoi14BMSVVHapqIbyA E1acsKKzOgNP7JmnjtIA+faYL7EHrE15RV59B0THKeqhrKO8PO3OeyF9e32yzOvxfmc7 yiIfOJVwqekOuy64HnthwQjn5T5tmYoQdC7DuMhZROq8/Tfo/PtqAJEu6iJkkH/KuKUC B4ZkkkHJv40FDwvuq+HzZl1QUSq4RDciSjWCbm1aRPf1OoGDPCOYSkamanE0peFWHsj/ JVDyuUqag0HHuos4sRlqlzJtKPZ+YINx2zhB5x5is/Tl7zNOwdA5cGuIDG/obZ4m9ouI 3CgQ== X-Gm-Message-State: AKS2vOzpTNSjGdyr8Rnbnky1xM8bjHuegSu66pOppBNwyOGYjNIbQ8DQ 5zT+4MVEK+dPcuZsVHGeZQ== X-Received: by 10.99.62.65 with SMTP id l62mr15285634pga.106.1498733972463; Thu, 29 Jun 2017 03:59:32 -0700 (PDT) Received: from localhost ([122.171.238.149]) by smtp.gmail.com with ESMTPSA id l4sm8336090pgn.34.2017.06.29.03.59.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2017 03:59:31 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Sudeep Holla Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH 6/6] cpufreq: arm_big_little: Make ->get_transition_latency() mandatory Date: Thu, 29 Jun 2017 16:29:09 +0530 Message-Id: <2397694de67a66309815b7e38d5888f140a0f336.1498733506.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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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. 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 418042201e6d..d1eb2a53b61f 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; }