From patchwork Thu Jun 8 07:55:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 103336 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp2123655obh; Thu, 8 Jun 2017 00:55:51 -0700 (PDT) X-Received: by 10.84.233.143 with SMTP id l15mr29997782plk.216.1496908551024; Thu, 08 Jun 2017 00:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496908551; cv=none; d=google.com; s=arc-20160816; b=xjxIx3QtUANPfbulMatmzKeI/RLpUK05lnJ7cejNEQeBQSd+hjiUISQhVOOsX4EfV+ MaztzToGcRF4yPe+1vmMyLDL3jC42vODzt4dv97xbU3brPGGjvCwTKRxGrFWSMudPUx7 0AVFTjNl6zzVAXgYjEusukTrVN4E3/+wtABMTXv01dwTzlvzSu6LT4Yq44K51I+PxLgm 9ao8ow9mupwKlR9BE3Mxav7PAyettlvO2I4+ANyK5ZizF4Uo7s3MXOS1DcsPaHP9o3pD o1QHUtk5VpgxTbU/Aozgz6fow8gcaMzCR96gyw92YBiTQGksrB7IRWlnnt7v53MQfG1D JAJg== 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:message-id:date :subject:cc:to:from:arc-authentication-results; bh=5MiYl3AjgZJUvO6xdH7CSEpETixMFIL+zPahkLykJGw=; b=OCZu0Qg8Sm3s3cCkzcAzCKeDdtanIDuy7iwySyuWiShGaY5yCDlEtHIkoVHX36FyRk c0ot3fqsNohO4SMNeVUlcA0ivPcfbysHq+4iIMBORZhIFEz0hiD6jbCBQC8Hhl6KHQ+F SSLwDQtCIG9TGy5WhY5nknP77b/nOpok0UX6KlTg0GY/3o30CzGHna/KuvussgTBizM4 gCOcZCXygPiCF1UbfMQs/vKSSRVk6dYeSAcFYXtOcJ4K24Zi26rwJpOJmLJ6ERlEq1EM XhjloaDzuGj7BAf29KjMZxF7p1/OVi/D91fR3+XmTG4pYUK3NArtkigGHc87WIqvYVtO KNWQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h126si3781772pgc.62.2017.06.08.00.55.50; Thu, 08 Jun 2017 00:55: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751877AbdFHHzk (ORCPT + 25 others); Thu, 8 Jun 2017 03:55:40 -0400 Received: from foss.arm.com ([217.140.101.70]:43214 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751619AbdFHHzg (ORCPT ); Thu, 8 Jun 2017 03:55:36 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4271C15BF; Thu, 8 Jun 2017 00:55:36 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 47A583F3E1; Thu, 8 Jun 2017 00:55:34 -0700 (PDT) From: Dietmar Eggemann To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Russell King , Catalin Marinas , Will Deacon , Juri Lelli , Vincent Guittot , Peter Zijlstra , Morten Rasmussen Subject: [PATCH 1/6] drivers base/arch_topology: prepare cpufreq policy notifier for frequency-invariant load-tracking support Date: Thu, 8 Jun 2017 08:55:08 +0100 Message-Id: <20170608075513.12475-2-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170608075513.12475-1-dietmar.eggemann@arm.com> References: <20170608075513.12475-1-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch prepares the actual implementation of the frequency-invariant load-tracking support provided in the next patch ("drivers base/arch_topology: frequency-invariant load-tracking support"). The maximum supported frequency of a cpu (policy->cpuinfo.max_freq) has to be retrieved for frequency-invariant load-tracking. This can be achieved by coding this functionality into the existing cpufreq policy notifier (init_cpu_capacity_notifier) which is currently only used for setting up dt-based cpu capacities (cpu node property capacity-dmips-mhz). But frequency-invariant load-tracking has to work whether cpu capacity dt-parsing succeeded or not. Change init_cpu_capacity_notifier in such a way that even if the parsing of the cpu capacity information failed the notifier is called for each cpufreq policy to be able to set the maximum supported frequency. The exit condition in register_cpufreq_notifier() now only tests for !acpi_disabled because for frequency invariance the cpufreq policy notifier has to be enabled even if u32 *raw_capacity is NULL which occurs when there is no capacity-dmips-mhz property in the dt file or when the allocation for raw_capacity[cpu] has failed. The continue statement in init_cpu_capacity_callback() makes sure that we don't go on calculating capacity_scale in case the capacity parsing failed. It should be a break rather a continue here but the next patch introduces code to set the per-cpu variable max_freq in this for_each_cpu loop before the check if cap_parsing_failed so it has to be a continue. Cc: Catalin Marinas Cc: Will Deacon Cc: Russell King Cc: Greg Kroah-Hartman Cc: Juri Lelli Signed-off-by: Dietmar Eggemann --- drivers/base/arch_topology.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 2.11.0 diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index d1c33a85059e..272831c89feb 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -173,7 +173,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, struct cpufreq_policy *policy = data; int cpu; - if (cap_parsing_failed || cap_parsing_done) + if (cap_parsing_done) return 0; switch (val) { @@ -185,13 +185,17 @@ init_cpu_capacity_callback(struct notifier_block *nb, cpus_to_visit, policy->related_cpus); for_each_cpu(cpu, policy->related_cpus) { + if (cap_parsing_failed) + continue; raw_capacity[cpu] = topology_get_cpu_scale(NULL, cpu) * policy->cpuinfo.max_freq / 1000UL; capacity_scale = max(raw_capacity[cpu], capacity_scale); } if (cpumask_empty(cpus_to_visit)) { - topology_normalize_cpu_scale(); - kfree(raw_capacity); + if (!cap_parsing_failed) { + topology_normalize_cpu_scale(); + kfree(raw_capacity); + } pr_debug("cpu_capacity: parsing done\n"); cap_parsing_done = true; schedule_work(&parsing_done_work); @@ -211,7 +215,7 @@ static int __init register_cpufreq_notifier(void) * until we have the necessary code to parse the cpu capacity, so * skip registering cpufreq notifier. */ - if (!acpi_disabled || !raw_capacity) + if (!acpi_disabled) return -EINVAL; if (!alloc_cpumask_var(&cpus_to_visit, GFP_KERNEL)) { From patchwork Thu Jun 8 07:55:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 103338 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp2123658obh; Thu, 8 Jun 2017 00:55:51 -0700 (PDT) X-Received: by 10.84.231.136 with SMTP id g8mr33892029plk.257.1496908551855; Thu, 08 Jun 2017 00:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496908551; cv=none; d=google.com; s=arc-20160816; b=oSdgJ7Lw8oOBRwE5ErUnxiUH9rFVc7vY8Fta99RtIxe629rp8SVl+gEndNWKL2i1Mf keDzLYse65xin/AUA3wpWHGRvEB+KHuw/7zdMYm4VC8zjIvOt4N62bmtYSx1jv0RkuS2 SufjIDxfzD0KTk+TVIwLQt9dg4vKL9JGae5L5J33ySm7V4t0FzYA1CdgqeksZAZfZoPH 4qX5yxK5oQgmaD8AkiFqN58a/VnHuRT4fDCL9nkPihkp9V/7YwZ9brGXFlHjCNYqAP+9 mzkjDCmYwaWHs3UDC/5Vy9xOdVjKE5lszR24i5a65ESexo5cz28ZESFi+jMdrrDePLbX stnA== 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:message-id:date :subject:cc:to:from:arc-authentication-results; bh=8GEACDALr7r8V3bnlmbe8m0/ebRDrjsiye74tv4P1ds=; b=okM4lXkb35AYMMEUM5I3PvJyhLMApUjqM39cDdDCzw3UXhTPLB0lG2eSwI4gVCWZYY YO2tni21VrC/wEm9si5GK5VrA7v0M33LpjNlNshHT6sBWXTuWTokTZ3R4aPL7qHpk9ht NTDsTnBS1Yy9U35qagCpGmOFH+nM55sd+07C+cFlXibs9nldmNYa53Nt81uqh5ts5n4o Yl/31rAMGm43cIFAzRGuD5e9H6JBtald8XKzfxzhIZouEzIhE87oEUMD7cFkSpVtAnjz XmTiX3g5zOwN9ZV0cX5oIH3/iFPsgEx/XGrMzNoTFQyMPCgtBbdxAieqa3+1LEOa4l9f Hvrg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h126si3781772pgc.62.2017.06.08.00.55.51; Thu, 08 Jun 2017 00:55: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751923AbdFHHzq (ORCPT + 25 others); Thu, 8 Jun 2017 03:55:46 -0400 Received: from foss.arm.com ([217.140.101.70]:43226 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751619AbdFHHzo (ORCPT ); Thu, 8 Jun 2017 03:55:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7D3A3164F; Thu, 8 Jun 2017 00:55:38 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8231B3F3E1; Thu, 8 Jun 2017 00:55:36 -0700 (PDT) From: Dietmar Eggemann To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Russell King , Catalin Marinas , Will Deacon , Juri Lelli , Vincent Guittot , Peter Zijlstra , Morten Rasmussen Subject: [PATCH 2/6] drivers base/arch_topology: frequency-invariant load-tracking support Date: Thu, 8 Jun 2017 08:55:09 +0100 Message-Id: <20170608075513.12475-3-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170608075513.12475-1-dietmar.eggemann@arm.com> References: <20170608075513.12475-1-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implements an arch-specific frequency-scaling function topology_get_freq_scale() which provides the following frequency scaling factor: current_freq(cpu) << SCHED_CAPACITY_SHIFT / max_supported_freq(cpu) The debug output in init_cpu_capacity_callback() has been changed to be able to distinguish whether cpu capacity and max frequency or only max frequency has been set. The latter case happens on systems where there is no or broken cpu capacity binding (cpu node property capacity-dmips-mhz) information. One possible consumer of this is the Per-Entity Load Tracking (PELT) mechanism of the task scheduler. Cc: Catalin Marinas Cc: Will Deacon Cc: Russell King Cc: Greg Kroah-Hartman Cc: Juri Lelli Signed-off-by: Dietmar Eggemann --- drivers/base/arch_topology.c | 52 ++++++++++++++++++++++++++++++++++++++++--- include/linux/arch_topology.h | 2 ++ 2 files changed, 51 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 272831c89feb..f6f14670bdab 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -24,12 +24,18 @@ static DEFINE_MUTEX(cpu_scale_mutex); static DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE; +static DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE; unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu) { return per_cpu(cpu_scale, cpu); } +unsigned long topology_get_freq_scale(struct sched_domain *sd, int cpu) +{ + return per_cpu(freq_scale, cpu); +} + void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity) { per_cpu(cpu_scale, cpu) = capacity; @@ -164,6 +170,7 @@ static cpumask_var_t cpus_to_visit; static bool cap_parsing_done; static void parsing_done_workfn(struct work_struct *work); static DECLARE_WORK(parsing_done_work, parsing_done_workfn); +static DEFINE_PER_CPU(unsigned long, max_freq); static int init_cpu_capacity_callback(struct notifier_block *nb, @@ -185,6 +192,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, cpus_to_visit, policy->related_cpus); for_each_cpu(cpu, policy->related_cpus) { + per_cpu(max_freq, cpu) = policy->cpuinfo.max_freq; if (cap_parsing_failed) continue; raw_capacity[cpu] = topology_get_cpu_scale(NULL, cpu) * @@ -195,8 +203,10 @@ init_cpu_capacity_callback(struct notifier_block *nb, if (!cap_parsing_failed) { topology_normalize_cpu_scale(); kfree(raw_capacity); + pr_debug("cpu_capacity: parsing done\n"); + } else { + pr_debug("cpu_capacity: max frequency parsing done\n"); } - pr_debug("cpu_capacity: parsing done\n"); cap_parsing_done = true; schedule_work(&parsing_done_work); } @@ -208,8 +218,38 @@ static struct notifier_block init_cpu_capacity_notifier = { .notifier_call = init_cpu_capacity_callback, }; +static void set_freq_scale(unsigned int cpu, unsigned long freq) +{ + unsigned long max = per_cpu(max_freq, cpu); + + if (!max) + return; + + per_cpu(freq_scale, cpu) = (freq << SCHED_CAPACITY_SHIFT) / max; +} + +static int set_freq_scale_callback(struct notifier_block *nb, + unsigned long val, + void *data) +{ + struct cpufreq_freqs *freq = data; + + switch (val) { + case CPUFREQ_PRECHANGE: + set_freq_scale(freq->cpu, freq->new); + } + + return 0; +} + +static struct notifier_block set_freq_scale_notifier = { + .notifier_call = set_freq_scale_callback, +}; + static int __init register_cpufreq_notifier(void) { + int ret; + /* * on ACPI-based systems we need to use the default cpu capacity * until we have the necessary code to parse the cpu capacity, so @@ -225,8 +265,14 @@ static int __init register_cpufreq_notifier(void) cpumask_copy(cpus_to_visit, cpu_possible_mask); - return cpufreq_register_notifier(&init_cpu_capacity_notifier, - CPUFREQ_POLICY_NOTIFIER); + ret = cpufreq_register_notifier(&init_cpu_capacity_notifier, + CPUFREQ_POLICY_NOTIFIER); + + if (ret) + return ret; + + return cpufreq_register_notifier(&set_freq_scale_notifier, + CPUFREQ_TRANSITION_NOTIFIER); } core_initcall(register_cpufreq_notifier); diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h index 9af3c174c03a..3fb4d8ccb179 100644 --- a/include/linux/arch_topology.h +++ b/include/linux/arch_topology.h @@ -12,6 +12,8 @@ int topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu); struct sched_domain; unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu); +unsigned long topology_get_freq_scale(struct sched_domain *sd, int cpu); + void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity); #endif /* _LINUX_ARCH_TOPOLOGY_H_ */ From patchwork Thu Jun 8 07:55:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 103337 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp2123656obh; Thu, 8 Jun 2017 00:55:51 -0700 (PDT) X-Received: by 10.98.36.72 with SMTP id r69mr29382681pfj.86.1496908551407; Thu, 08 Jun 2017 00:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496908551; cv=none; d=google.com; s=arc-20160816; b=Z2c0di/QuO07owv5JC+bS6WPytJdSLUg6p8d3Ft2RLcHGQgI1++zsNwsks2HVctKDD ILTSOQxaZl0dsFyiojxq/xDjJr/TiCQViUMcYiwR98WQj7W6KymMpkWDlVmK1R/kCXm8 527OI2OPDm4n1O8UsijwQV7m47xYM2AAYPYMtynZK4pjzh3lr7Q7QjsAGx8bElEfWPgc OqmrT5yJfKP04NEwpXUw3t4jzJi1bGWD7SpC8w/li0hs0+HC1LK2Qi4PM0ZlntpMmHgy Uaa9YfbJVlPjAvl2K0P39WKm9OyB7HFO2XRwW9meOS8S4LiLhEY5BExsq6ad30pxBgyM 2YFg== 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:message-id:date :subject:cc:to:from:arc-authentication-results; bh=J7nDxFcpVHzgHKrPh3zI7aq3Cpa2kpf7KSWVxMty+Ws=; b=Qj5pzfbje8HPMXIfCvbPiau33ZnaTlkDgHPd/LIBTneP//TKScule8cXF91Do8MQij oQ/g1hzrfsqUnaq0P4DWufkrlnC+UDqFnTPvonpR43R0QBM2/Ys/6nkJBBPp8X1m1QOV jidjxesnZZw6s6sv2q12s8bTdZCSRpMlD1XeCMfz9fCfeS2mPUalb46OgNeOcfUTf/8n KvQlVTNV64t/wtyz/wXwwnhoSG2cWcRgmlAgovvd20hgR7FR7oduxbfd9uY+rSYd20Cv zyMxkL1FSgp9jg20WsWPzVcG+Ppc/QFFG4gFtIfEhpL27+nIIf00Vnb0U4iiCg+5njrJ 0+Ow== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h126si3781772pgc.62.2017.06.08.00.55.51; Thu, 08 Jun 2017 00:55: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751899AbdFHHzn (ORCPT + 25 others); Thu, 8 Jun 2017 03:55:43 -0400 Received: from foss.arm.com ([217.140.101.70]:43242 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751619AbdFHHzl (ORCPT ); Thu, 8 Jun 2017 03:55:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B88CA1682; Thu, 8 Jun 2017 00:55:40 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BDD4A3F3E1; Thu, 8 Jun 2017 00:55:38 -0700 (PDT) From: Dietmar Eggemann To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Russell King , Catalin Marinas , Will Deacon , Juri Lelli , Vincent Guittot , Peter Zijlstra , Morten Rasmussen Subject: [PATCH 3/6] arm: wire frequency-invariant accounting support up to the task scheduler Date: Thu, 8 Jun 2017 08:55:10 +0100 Message-Id: <20170608075513.12475-4-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170608075513.12475-1-dietmar.eggemann@arm.com> References: <20170608075513.12475-1-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit dfbca41f3479 ("sched: Optimize freq invariant accounting") changed the wiring which now has to be done by associating arch_scale_freq_capacity with the actual implementation provided by the architecture. Define arch_scale_freq_capacity to use the arch_topology "driver" function topology_get_freq_scale() for the task scheduler's frequency-invariant accounting instead of the default arch_scale_freq_capacity() in kernel/sched/sched.h. Cc: Russell King Cc: Juri Lelli Signed-off-by: Dietmar Eggemann --- arch/arm/include/asm/topology.h | 5 +++++ arch/arm/kernel/topology.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h index 370f7a732900..a56a9e24f4c0 100644 --- a/arch/arm/include/asm/topology.h +++ b/arch/arm/include/asm/topology.h @@ -24,6 +24,11 @@ void init_cpu_topology(void); void store_cpu_topology(unsigned int cpuid); const struct cpumask *cpu_coregroup_mask(int cpu); +#include + +/* Replace task scheduler's default frequency-invariant accounting */ +#define arch_scale_freq_capacity topology_get_freq_scale + #else static inline void init_cpu_topology(void) { } diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index bf949a763dbe..2c47a76c67b0 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -11,7 +11,6 @@ * for more details. */ -#include #include #include #include From patchwork Thu Jun 8 07:55:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 103341 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp2123788obh; Thu, 8 Jun 2017 00:56:26 -0700 (PDT) X-Received: by 10.98.78.70 with SMTP id c67mr10846649pfb.155.1496908586580; Thu, 08 Jun 2017 00:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496908586; cv=none; d=google.com; s=arc-20160816; b=X3pDMSKf+WYVDNCyBQkxc6K3OAm6vQxGqnZE3C3Nmf0hsMAF4dAWDfGnl8f9Jyxgke Wp+wrw8XslvCugWHj9nl1PiqFDJEfWRtzR2elv47UEV84+buy2Un+ghQ6kR3hTuy3fUE XTqHqLwCMmkONZxvQvnUa8wjkduJuL3qyUoXx1pv+LyfpUayGw8lUl26H/Gd3Btkost/ 4Jmd/yLF9ZbBysuq2KC4SS2DoD9y4K+Xuuw4mOU0+hUTKtOfzPPHirX1MVEvcBMTGox/ zxDCorbvFmNxKxfyglBLrXAaiqFT7l36AIdJO3jQ4NC/MD1xptRw0qVsVbCkzQa5kebO WmxQ== 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:message-id:date :subject:cc:to:from:arc-authentication-results; bh=uZ1tOuXvdIpsx3CTkJoPB0/p9WdcdzNCvlfbwE86wDM=; b=SloD7ZMpGqRJNG/TnQL4pQwZxIGRRWUUhNuN4wSj3Ov/qABReedB1VaVJD5JeKY/Ev +dG7ar9yiNZ/+EJYPbeOKDLClQUPGq9o0vSmQ2vdRZbtH0BNx5qvuoYISgfQY0olC5ag T/AmRhz3BlUFCOCuaPVva1F6X+4pynMz8tpjKBm//CNHYKgfuwwL7zAhcXPUthhJsMz+ NLIV2Zdt8ChBJX1tQMOQMMHfQSGfM0l7htQJJSvhjSW9HGoqQM7+jenA+z2rY4ddXY4R 6XWSV8bx56m8ILN0+//4QFVOt637EJfSInz98YwRibT40EsAOHVLN1/FnFwSCzHuGB9h WQzg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si3869049pgc.126.2017.06.08.00.56.26; Thu, 08 Jun 2017 00:56:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751944AbdFHHzu (ORCPT + 25 others); Thu, 8 Jun 2017 03:55:50 -0400 Received: from foss.arm.com ([217.140.101.70]:43258 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751902AbdFHHzs (ORCPT ); Thu, 8 Jun 2017 03:55:48 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F3317168F; Thu, 8 Jun 2017 00:55:42 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0504E3F3E1; Thu, 8 Jun 2017 00:55:40 -0700 (PDT) From: Dietmar Eggemann To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Russell King , Catalin Marinas , Will Deacon , Juri Lelli , Vincent Guittot , Peter Zijlstra , Morten Rasmussen Subject: [PATCH 4/6] arm: wire cpu-invariant accounting support up to the task scheduler Date: Thu, 8 Jun 2017 08:55:11 +0100 Message-Id: <20170608075513.12475-5-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170608075513.12475-1-dietmar.eggemann@arm.com> References: <20170608075513.12475-1-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 8cd5601c5060 ("sched/fair: Convert arch_scale_cpu_capacity() from weak function to #define") changed the wiring which now has to be done by associating arch_scale_cpu_capacity with the actual implementation provided by the architecture. Define arch_scale_cpu_capacity to use the arch_topology "driver" function topology_get_cpu_scale() for the task scheduler's cpu-invariant accounting instead of the default arch_scale_cpu_capacity() in kernel/sched/sched.h. Cc: Russell King Cc: Juri Lelli Signed-off-by: Dietmar Eggemann --- arch/arm/include/asm/topology.h | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h index a56a9e24f4c0..b713e7223bc4 100644 --- a/arch/arm/include/asm/topology.h +++ b/arch/arm/include/asm/topology.h @@ -29,6 +29,9 @@ const struct cpumask *cpu_coregroup_mask(int cpu); /* Replace task scheduler's default frequency-invariant accounting */ #define arch_scale_freq_capacity topology_get_freq_scale +/* Replace task scheduler's default cpu-invariant accounting */ +#define arch_scale_cpu_capacity topology_get_cpu_scale + #else static inline void init_cpu_topology(void) { } From patchwork Thu Jun 8 07:55:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 103340 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp2123784obh; Thu, 8 Jun 2017 00:56:25 -0700 (PDT) X-Received: by 10.101.86.76 with SMTP id m12mr19733460pgs.137.1496908585820; Thu, 08 Jun 2017 00:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496908585; cv=none; d=google.com; s=arc-20160816; b=FvDbFr9/pUERYe8V5CTw0iCTz0wh60IXxAbiqcny82l/WKf9XxmmR8XnEvDFGDgyZr yQtPdNbvwuGV5AkDGpYBsSeK15EE0l7P1Bjav/1YFPOt3uETtfUm6PCWja7mzHSjEfwW 4D7ArX/3kP16mTQN7sSOzAwHHZdZzf6pXTsQ8F19c8vLwR//ilEoJwWJ+hv2U3N2b4J0 qOPJ8TfgEwi/eqrofg+d3w4zwnlx8X4hkBjqjj6kAu9DrE40dRhiwzQ//S5mvxALH1Lr M0Th4RWhhHfavx/V9+TgkBCYDlYUp/WLsP9bHqM7dpChmKQFkOqxp2S275LxkDd2Uz3i BGyA== 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:message-id:date :subject:cc:to:from:arc-authentication-results; bh=qXJIQ2hBHNEpyvMBxYyDqGDOj0pcIvZf1r0EzPwc7Oc=; b=bUwY1tSuxzogeNWlZqDoY6C59YWZzEcgCdV4bj5ohRTmGXO6F45gVdQ/5xVQkdIjed 2FyyZ/kcVnCeF4SbQyy2DwYTn17FNIIvVa7srClAfskQL9Y5Fy38Mritr8s3UMeUVCw6 AwTd4ohccLKQyjuQeqtqNpEOfHDtAlfvYN9E4Lo9ZWl0CDYUoku0rvM4MIC+COkfi+ta uxSXiqo69i4GNMdftkYfPPEBdtHvvlJLSXu68fDgVBCnRH1i88wYAin4wmPgWLguwV2E EUzvufGCCkvYnYFRRlzx1x9EsWbFPkDpvWW9mTfTXXpbssNww7wUDL1xHY1l1ZSbauep vpWw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si3869049pgc.126.2017.06.08.00.56.25; Thu, 08 Jun 2017 00:56:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751984AbdFHH4A (ORCPT + 25 others); Thu, 8 Jun 2017 03:56:00 -0400 Received: from foss.arm.com ([217.140.101.70]:43268 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751577AbdFHHz6 (ORCPT ); Thu, 8 Jun 2017 03:55:58 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7546616EA; Thu, 8 Jun 2017 00:55:47 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7A5103F3E1; Thu, 8 Jun 2017 00:55:45 -0700 (PDT) From: Dietmar Eggemann To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Russell King , Catalin Marinas , Will Deacon , Juri Lelli , Vincent Guittot , Peter Zijlstra , Morten Rasmussen Subject: [PATCH 6/6] arm64: wire cpu-invariant accounting support up to the task scheduler Date: Thu, 8 Jun 2017 08:55:13 +0100 Message-Id: <20170608075513.12475-7-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170608075513.12475-1-dietmar.eggemann@arm.com> References: <20170608075513.12475-1-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 8cd5601c5060 ("sched/fair: Convert arch_scale_cpu_capacity() from weak function to #define") changed the wiring which now has to be done by associating arch_scale_cpu_capacity with the actual implementation provided by the architecture. Define arch_scale_cpu_capacity to use the arch_topology "driver" function topology_get_cpu_scale() for the task scheduler's cpu-invariant accounting instead of the default arch_scale_cpu_capacity() in kernel/sched/sched.h. Cc: Catalin Marinas Cc: Will Deacon Cc: Juri Lelli Signed-off-by: Dietmar Eggemann --- arch/arm64/include/asm/topology.h | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 Acked-by: Catalin Marinas diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h index 44598a86ec4a..e313eeb10756 100644 --- a/arch/arm64/include/asm/topology.h +++ b/arch/arm64/include/asm/topology.h @@ -37,6 +37,9 @@ int pcibus_to_node(struct pci_bus *bus); /* Replace task scheduler's default frequency-invariant accounting */ #define arch_scale_freq_capacity topology_get_freq_scale +/* Replace task scheduler's default cpu-invariant accounting */ +#define arch_scale_cpu_capacity topology_get_cpu_scale + #include #endif /* _ASM_ARM_TOPOLOGY_H */