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)) {