From patchwork Thu Jul 13 05:40:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 107542 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1780084qge; Wed, 12 Jul 2017 22:41:52 -0700 (PDT) X-Received: by 10.84.254.11 with SMTP id b11mr8038002plm.250.1499924512467; Wed, 12 Jul 2017 22:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499924512; cv=none; d=google.com; s=arc-20160816; b=Kiq6k6l1WhXMtcCaZIpaBX8V7e/fySAbA/9CJl9Q5oZb/H9o7Kk7uY9QV9NHFG+4fI XJ8ep3q9hOEUueOVzWpzOXEjVb6kQxq6HemqXj3wWBCIYQR0C6yGJ0yq9zO37mT9yFm0 a0/RHnqmK++Qc5DUuSgjv3JzgPZ31UZwcrqseCyhcWXzxrvW4CU+SGXqbKQu+pH6kkhE g1dQIHqn4/Rg4LznoAvgHYE8dwOJBLL3+xapLVxMghXRG16HfnhHmVtel7LFffRFHbyF y1fRDEoO728v52eHrzg1DsMu5SaMqHQoS7fvfAiSrYmb6Sti1X+qV1nLKCcdgGZKlsLN GuLA== 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=LUNI3klLt2OmZnZGRqKlgKgCxloe6s+01vith2z1xgU=; b=WNmclLcThN6T6eL+9g7hRGzHwQZXOra6ZlXWkBGRzUcBvNmJevM3u1GG/WmX8PEBmJ AFpjCmW6cpVihZNmp6NZ+yU8mI/46+4DBi6o6nmU9ScmA2SxW7FZtUnnECTMDaQTsPoQ PCOfR9CDVWY7APm/Ey9Y7VYtw5XryCZCKjqokO+mRQk35qf7ahTtv/wiwlDtMxqFGZOs Cqegzuhi7k68hkNS/zWRWPMeyY7a88ghNhdWqGCpKQIaQYgmVnC12UIEBwtc9KqdevVO iquCS8C07GbFPGy8Qn7yEJ5j+JYZEcdXGUBOmp/qOzaZEYXKc5rCW11bK2ZmKBGDOaMs +O0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=cfTCNJHv; 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 q6si3490263pgq.8.2017.07.12.22.41.52; Wed, 12 Jul 2017 22:41:52 -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=cfTCNJHv; 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 S1751032AbdGMFli (ORCPT + 14 others); Thu, 13 Jul 2017 01:41:38 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:33125 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751083AbdGMFlg (ORCPT ); Thu, 13 Jul 2017 01:41:36 -0400 Received: by mail-pf0-f169.google.com with SMTP id e7so23993013pfk.0 for ; Wed, 12 Jul 2017 22:41:35 -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=LUNI3klLt2OmZnZGRqKlgKgCxloe6s+01vith2z1xgU=; b=cfTCNJHvXuz/ADxQ1PLcSR6+MtIne2L67WrXBVsyPrZaSNVodpSeCWDkrl29sleTSe F3zkoJlReG0uXLX5Axh9sIXqmZ9AuqUU8+IDPUSD4oF+USPt7V5hzAw6mytU3s8R8h2V 45keI/plED5Ad3BEuiaW7qfPrR8rNqj30RX6k= 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=LUNI3klLt2OmZnZGRqKlgKgCxloe6s+01vith2z1xgU=; b=eMUuAkGWu9Ft4Yvoqeyivi7AM+43vFZUNyZZoKc7hwk1GE2PGA2aKRmk5ChGmgho8G jiK6ZG4REHMjBQn6OIZpdbQqr3c9jIrniyTnLhTmaT5CEpkjLswaA+GIrhcKFbDAgULA Ma3VXSOSmhdQDatPYRpC8luJttu+cCYISYT+156hC0L4igffl9MWE7bFApW9cW0DD+GP 8RnQKmbVtna0KhtNpzyNNb04+WrMlY1kk+qqDktc+UtDHeJ/Whrdhiv6DVS0Z9zKFcU3 kYAMU+i8/POvC55diB5Ba4IGzB9qQ/C0C/nBPrxG3SskA3Gi/qStTqzIVp7N2/RVYcy0 1kcQ== X-Gm-Message-State: AIVw113GgFspbqAQ8SAvhcR3DaqfLZIBSwxn8zfiwgQu7690oLxzq77J 411QqJ/ZuGZgxoHp X-Received: by 10.99.104.74 with SMTP id d71mr7310839pgc.7.1499924495424; Wed, 12 Jul 2017 22:41:35 -0700 (PDT) Received: from localhost ([122.171.81.230]) by smtp.gmail.com with ESMTPSA id f24sm8784199pff.74.2017.07.12.22.41.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 22:41:34 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux@dominikbrodowski.net, linux-kernel@vger.kernel.org Subject: [RFC V2 2/6] cpufreq: schedutil: Set dynamic_switching to true Date: Thu, 13 Jul 2017 11:10:53 +0530 Message-Id: <2b68422c8b9ecd1561cc283bb2f8fa68517f07e7.1499853492.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 Set dynamic_switching to 'true' to disallow use of schedutil governor for platforms with transition_latency set to CPUFREQ_ETERNAL, as they may not want to do automatic dynamic frequency switching. Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 1 + 1 file changed, 1 insertion(+) -- 2.13.0.71.gd7076ec9c9cb diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 076a2e31951c..ab9d7a1b43dc 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -650,6 +650,7 @@ static void sugov_limits(struct cpufreq_policy *policy) static struct cpufreq_governor schedutil_gov = { .name = "schedutil", .owner = THIS_MODULE, + .dynamic_switching = true, .init = sugov_init, .exit = sugov_exit, .start = sugov_start, From patchwork Thu Jul 13 05:40:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 107544 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1780094qge; Wed, 12 Jul 2017 22:41:53 -0700 (PDT) X-Received: by 10.98.57.156 with SMTP id u28mr60487149pfj.111.1499924513332; Wed, 12 Jul 2017 22:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499924513; cv=none; d=google.com; s=arc-20160816; b=vngQ1tm1Glhaon503gaeR1pKK5UIiPGc9pZm5VQdExgL3nONzsrc+q95J6+jFsXIuR S4HJq6Dj1emZX73M+rGM6tzn+ykke6iVJ45z4u8Tf8IeYSJ93E3wEQzP3B/OjitD1XYp szIPd4a9e2MdK8+X9vn1l0Jiuu0+x08nB1euRXVkgU/nd2pcYPAFTDXN5nT6gNizWlsq 1IcCtlmJo01upVm8dscH/Ai4fzlMk4sJjpdsdCTaGfKqd28JvpX+GWH7i4+ppfeMLGDw ecNdZRNtQWeKvKEMzCvx65OBOfoyfAttZuzfYeaGPHVdlpDDL8Fhk8ZCVWtJTBcZcllQ +9RA== 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=RBE2w4SHuIwiVdwvp+OGCzZcpUHrq5r6lq+Dgu0h5YY=; b=lK09zhxeYjmqHm95qY/IIpepDI5aIsbmaSM0CxaUzXdh80hd6mrBSACRhFp3qK7Z2F 14F01PBwCKTHUTlX2B1ot/nqmLZZJIaVN/DQRdD/0KGnQQZYhkXw1N5I9zaFxh0ZDieg dAY2qPJ/T4PZ4jldprozPo6FjGbuW8xLMUvSYJjf/mQrqJP0V5KKu/LSYAUc1csXjqoW R/pbh6rAA7UmnNOlPxbO0+/K9v5GzkmXYaEiTjH8EqmEfMZ5lrA5x+SCkM3yfXOYn8nh UDP7uls55OsFjv2qzzx6N7H7EbR073hltckUDkZSFitUQ0CvBMYh7acap7lkZyZoqLKv cLwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=kHV7CYDY; 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 q6si3490263pgq.8.2017.07.12.22.41.53; Wed, 12 Jul 2017 22:41:53 -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=kHV7CYDY; 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 S1750977AbdGMFlp (ORCPT + 14 others); Thu, 13 Jul 2017 01:41:45 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:33171 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750789AbdGMFlo (ORCPT ); Thu, 13 Jul 2017 01:41:44 -0400 Received: by mail-pg0-f53.google.com with SMTP id k14so24200771pgr.0 for ; Wed, 12 Jul 2017 22:41:39 -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=RBE2w4SHuIwiVdwvp+OGCzZcpUHrq5r6lq+Dgu0h5YY=; b=kHV7CYDYb7g27k1plp6K6BHB6z6HRHPzzjF4xzcSQhYxtpdLauN1P18tieR4/5IGGi XltXnAhzIphrgAuLywF8V5FalsS+JxvoKu5M4cl5xaBxBvMG4K51oMZZYXnqRHsl8pTL UzUumZqB3KkA44TEBt3KsietJWp7bsPODuFXo= 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=RBE2w4SHuIwiVdwvp+OGCzZcpUHrq5r6lq+Dgu0h5YY=; b=iFdBrdwC00IyUSHJwcwPsv4LD5u6Y9/zO58oqriHbNVY8GyJjxU8EWe11LTJx+ZxAl RcRUoQ9do3gw6SqV5PKeCHCJbHGoHZQEHFkSVpbpfYBNurPkGQzsd/l/sRS0zgZEY5H/ UEjn66hM+9dfE1JLgSbXNpGZn6lAZfNHxQ6UZh1lH5z00/Jyf3AeaHg2LRbrkAaAL9J3 AhxidQgSZfgAZv73qNllv90KP4sVfYO/relg0GA6SDeQnbrUTX0tO3jLzasKWx3UIg80 4c1L7zHcabAHszsc3dw8dRbceRzYF15MKposXs0aVcsWtQWL5TipPyOhzTlxC3c5gM9U 5ZaA== X-Gm-Message-State: AIVw111szNJVjs+5K7wTo8UlnMmjwaBXSTnpT7ODLRylUbcV0nw9JiZe yzULTw6/0E4SCOFF X-Received: by 10.84.174.3 with SMTP id q3mr8155025plb.289.1499924498716; Wed, 12 Jul 2017 22:41:38 -0700 (PDT) Received: from localhost ([122.171.81.230]) by smtp.gmail.com with ESMTPSA id v70sm9340499pfi.110.2017.07.12.22.41.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 22:41:38 -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: [RFC V2 3/6] cpufreq: governor: Drop min_sampling_rate Date: Thu, 13 Jul 2017 11:10:54 +0530 Message-Id: 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 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 7b7839c45fba..8463f5def0f5 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 3d8c52b3b5df..00e4c40a3249 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 Jul 13 05:40:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 107545 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1780098qge; Wed, 12 Jul 2017 22:41:53 -0700 (PDT) X-Received: by 10.98.211.89 with SMTP id q86mr58966700pfg.37.1499924513744; Wed, 12 Jul 2017 22:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499924513; cv=none; d=google.com; s=arc-20160816; b=0/eZQixe+LazylV2+hMucqsrrTqqMN0WpILXuJcLqv+qxcQv5Gik0KfyAESd9Zuyx8 QFUjFXEg1/3/NuheTCLtFzIv3lNp4CExTGucYgSB3R2erTRAS99t6O5ec3VZi0zg57/h 6EZFbyonL9swNlvEzEKL5974uUy4AS7Ol2Y0cO/CLilpoAmlIgPsViOTsb4ZI/CrM7gr 26rRPtbRjMdfOExvdVbPnX2zj0O4jXvzjS+b+hGSLR5L8mK1nVOP9ogwqETmdVjEfe62 I4TwOkPjMiz+UrNg8fGtTOA1NSmp1m7zpK2VPWE/5pcnFFb8xBuZsb9CtU+bbaqoUKYk qqVg== 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=GmD+Rzwsi+aeXM5Vx6C8ltpYv6Sl8SmiJVYg3XjZOaw=; b=m4Vf292PYBRpqoHvWej8MaRSNgjq4t/9sKRVMbJ4fA2nDLe0ekkyfMyDm6d+xH5a8W qkQ+j8P2EWQUfjnHiuX3IQgyUemwmi70kbh4eyGCMt29oCWv1hgifBh5ASPCtcayx2VB q31N7dBV2wQ/1x09j+8clHecruWL1LueZeyIJ5I6MwWxb1N4ykHBgMuApZPuYwJPbIc7 C9c+z4PlzecVIUfsDStD2TNOSPM2quN6eNGSile+Ya+djdEd6UydDq2W7tCEvRagaUzg +eIj/CEDqvEZ1KYnA6PMSrLsCE+z/eBbWsrY9oNUZO6qx6ROmUmX7GG9ARzV8eMlfi0s nLBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=MFDX+5n+; 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 q6si3490263pgq.8.2017.07.12.22.41.53; Wed, 12 Jul 2017 22:41:53 -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=MFDX+5n+; 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 S1751170AbdGMFlr (ORCPT + 14 others); Thu, 13 Jul 2017 01:41:47 -0400 Received: from mail-pg0-f47.google.com ([74.125.83.47]:35400 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbdGMFlp (ORCPT ); Thu, 13 Jul 2017 01:41:45 -0400 Received: by mail-pg0-f47.google.com with SMTP id j186so24052235pge.2 for ; Wed, 12 Jul 2017 22:41:45 -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=GmD+Rzwsi+aeXM5Vx6C8ltpYv6Sl8SmiJVYg3XjZOaw=; b=MFDX+5n+k3I3aNQoIRTOsfQyQh0SYX1HV9KZbtBQrwyDEx0kifBXo2OH8a8VPCE2Uh oUfKC189+pJUCx4zk2z4GiccV+y4D4C6pdNaEGRNrfZdoJd7rULRZPo/PSgJE95AlXJ7 E59LKasG2H2L8vBp3UKoHZ4O0dhDP7K+vGb1w= 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=GmD+Rzwsi+aeXM5Vx6C8ltpYv6Sl8SmiJVYg3XjZOaw=; b=szBIDN7tC1wtOindtlvGOUi3jtnDxRWuwDCUmmbk1fqhbDdwUYjBevat569yEKl/SJ vTthfzIKRMrWjp16tadkvb9W1d+Qaa1mR4eEyhLZ0oagwiJaMNorb5HRCbGyh0LgzP5Q eYR2B0WJ+KduwJVo1MBjTRMTQlWpEhnY502W0rIhysbn2YDXipizH2/viPBvixKTBR4V sxZDdtWxjstmYL2SMuSagptRlao+qsmIivTvGOSUXetMavJ7Eu7KpMEkK57WUF+TZuXg VHAHa1qQ4z1KD0GJa6Joq07C28IB2YXBt8zM5JUmJl7n3P+xdD+9bbFCVRBy3+zo5IoA X8wA== X-Gm-Message-State: AIVw113tX+oNLtaeuN258fcAdoauTeL9wbMek0I9Wti6Yni4aovWwI/M 4uDPKmgJ+TeixeeW X-Received: by 10.98.14.79 with SMTP id w76mr58357550pfi.72.1499924504625; Wed, 12 Jul 2017 22:41:44 -0700 (PDT) Received: from localhost ([122.171.81.230]) by smtp.gmail.com with ESMTPSA id r1sm9916163pgo.42.2017.07.12.22.41.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 22:41:44 -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: [RFC V2 5/6] cpufreq: Cap the default transition delay value to 10 ms Date: Thu, 13 Jul 2017 11:10:56 +0530 Message-Id: <6534daba87803a0f2a14c385a20cbb416fe6cbd8.1499853492.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 If transition_delay_us isn't defined by the cpufreq driver, the default value of transition delay (time after which the cpufreq governor will try updating the frequency again) is currently calculated by multiplying transition_latency (nsec) with LATENCY_MULTIPLIER (1000) and then converting this time to usec. That gives the exact same value as transition_latency, just that the time unit is usec instead of nsec. With acpi-cpufreq for example, transition_latency is set to around 10 usec and we get transition delay as 10 ms. Which seems to be a reasonable amount of time to reevaluate the frequency again. But for platforms where frequency switching isn't that fast (like ARM), the transition_latency varies from 500 usec to 3 ms, and the transition delay becomes 500 ms to 3 seconds. Of course, that is a pretty bad default value to start with. We can try to come across a better formula (instead of multiplying with LATENCY_MULTIPLIER) to solve this problem, but will that be worth it ? This patch tries a simple approach and caps the maximum value of default transition delay to 10 ms. Of course, userspace can still come in and change this value anytime or individual drivers can rather provide transition_delay_us instead. Signed-off-by: Viresh Kumar --- include/linux/cpufreq.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 14f0ab61ed17..f691ec2793c0 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -544,7 +544,17 @@ cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy) if (latency) delay_us *= latency; - return delay_us; + /* + * For platforms that can change the frequency very fast (< 10 us), + * the above formula gives a decent transition delay. But for platforms + * where transition_latency is in milliseconds, it ends up giving + * unrealistic values. + * + * Cap the default transition delay to 10 ms, which seems to be a + * reasonable amount of time after which we should reevaluate the + * frequency. + */ + return min(delay_us, (unsigned int)10000); } /* Governor attribute set */ From patchwork Thu Jul 13 05:40:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 107546 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1780300qge; Wed, 12 Jul 2017 22:42:09 -0700 (PDT) X-Received: by 10.98.178.150 with SMTP id z22mr59097045pfl.165.1499924529183; Wed, 12 Jul 2017 22:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499924529; cv=none; d=google.com; s=arc-20160816; b=GEegCY0m1P6oIkvuD0efxaFwC/KN1W5iqtCae4MqUKrMz9NjHxmguswt3y+LYGGacj 1ExYiwZf+74PDcJNw1qvscq07sy/wgWGI1iOQK9xAwoDVsl49JJF+tJJJ1f/pAo8/hvL rV2E/fPNnF95ORA4KXkYOeRPtNfoNFbgbyFzxSQq0mvHzFGnzxBhwPBdf89qpf8OT0gR XII13zrmEjNwmAV22LjlJqHG46A4fF63TeE8YuKZFhkHEYVXpz6lRG377uDxHqh3dzon bvRexEUyxuwyVgeU6y6tUe9nh2eFetlaGVKEmS5Md30dZwfuS7WvZkXAzM69KsGagGBu l0iA== 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=k1rtmZWEmosz7Z2ks/yjwjhUuUT4g3R0I4NYWGFg4vs=; b=gDyWbTit90TNlRu6mDGz7FtblM8vW3AEIa06Yf/0BTZDaJlg6chm4yJOI20DUJotrX IBSJ1rdY31YH8LCXQTY+o+uJXptm1wq2u6gt0lxKWwDWdGr/S+QrL/Mfgq9+T6asgio2 Ik03lUH3bE181mIFfPXAwRmvQgOhfvPbgtuwSouncswtaXB+yrKwc2MhXSq+0SaQt8FM NczOC93NPL+IgoNudHnwNIXRMPRWrAjfmRUh77v4SGgUJyyovxTqMgcA3c/W9BKGwJQF unOFPvTEqLGUFGplaYMOumn8Hu8fYMMZLJ4CWVUNQiXiaFJsPuuScP5tX7dnTBBS6x+b bP1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=ReUYyUke; 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 c1si3609659pld.330.2017.07.12.22.42.08; Wed, 12 Jul 2017 22:42:09 -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=ReUYyUke; 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 S1751208AbdGMFlz (ORCPT + 14 others); Thu, 13 Jul 2017 01:41:55 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:34156 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751188AbdGMFlx (ORCPT ); Thu, 13 Jul 2017 01:41:53 -0400 Received: by mail-pf0-f176.google.com with SMTP id q85so23975185pfq.1 for ; Wed, 12 Jul 2017 22:41:48 -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=k1rtmZWEmosz7Z2ks/yjwjhUuUT4g3R0I4NYWGFg4vs=; b=ReUYyUkevFqvGlkG03E24KWsDuI3wpbZkDzBiuM5YS9GLvdpHoVfXGqi9fuZOSwY/c EesvjjZI/jRKp5GO+nt19UIClJ4cFA5Vpe7y1InBRYHrPWeHt1badX0g7ZvuXKkEJ9jo f2+CSMty+AQKYo0RcnMusnUeAkr/eFR/BcXy0= 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=k1rtmZWEmosz7Z2ks/yjwjhUuUT4g3R0I4NYWGFg4vs=; b=boftyyVziLx3fWIfxSJoaifuO5S3199JxTs+KHWfDjF4dybD27c+Fgiadz1hNMpAHn bRJEu3XVXnrkvrmlxlYNWDFe8SQJM6H4DdTKVExOyHJEBe1Uy3xpxjOAW2HhFvlZq7Il st5MXRw9kf1szC0MPllxYdDkZV/qXd8tVT2F41HrVQpJKeKEGoAClJ2Qml0/nsejgZdf LGJ17fyeSJnrIXBvIbPiiPGXf9JkniZ6NHffu71itNpNDMftlO1c2+wlDVbUze9E/tbq ARdVhF/I7OVzM+yEA4J/jlWQUlZ8ZoECg8tJyr2s0ZTt8tHhDeqQHmdOJmOZG1SwEqwt w6Rg== X-Gm-Message-State: AIVw112TyO2OHEoa2Mjdv59DZVKeUKqtWrsBES0EnGoL/V2g9UUArAV2 XkKLVW2RayKN4oskHxgJ3w== X-Received: by 10.84.229.13 with SMTP id b13mr8193561plk.1.1499924507540; Wed, 12 Jul 2017 22:41:47 -0700 (PDT) Received: from localhost ([122.171.81.230]) by smtp.gmail.com with ESMTPSA id a71sm9561578pfl.129.2017.07.12.22.41.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 22:41:47 -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: [RFC V2 6/6] cpufreq: arm_big_little: Make ->get_transition_latency() mandatory Date: Thu, 13 Jul 2017 11:10:57 +0530 Message-Id: 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 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 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; }