From patchwork Mon Sep 22 16:24:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Rasmussen X-Patchwork-Id: 37689 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 34C6A202A1 for ; Mon, 22 Sep 2014 16:24:19 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id hi2sf1684720wib.11 for ; Mon, 22 Sep 2014 09:24:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=ZoEQn2CvBq2g2xGQ2V5OzRdqO58IWiv7bAqnumx6QHw=; b=aGV6p1mYsmvrhsz6Cbf8nPFTKetiSHyB7fMOEQhQLuBboie60QnlSlVqnPtPBI/KjQ PSSZkKmM3orvQbtjKQlWk0P9fqI8elDb5rbGinxyysjwy8zVhL6YKr4F9O1EM3eHLiBd Ttg4Z/DZdtNKLIn2JcmFTB+hgZwHFHrcBVDEJAhxZC+n+uXOCSwFmm0hEkT1WFLrPQoJ g9UdylMea16WNOkSsVciWQJdXErMpe+xuzk65NvE7uprqX8BDox3ZECWmE94/vxbvC7/ FO8Km0XIBW/9Sp51bAMzwbstJjbk3WXF78F6zNIEOUq/5BrQdTnTStX+AFlZZfN6ZBoW VzOQ== X-Gm-Message-State: ALoCoQl/G9g5UeqUJpl9KPdAROI5V/ze4cxNhlWo0EtZHCvzPdKESRbRLcRaboX7SZvH5GJw9YBG X-Received: by 10.112.151.3 with SMTP id um3mr548558lbb.15.1411403058396; Mon, 22 Sep 2014 09:24:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.8 with SMTP id f8ls523370lah.85.gmail; Mon, 22 Sep 2014 09:24:18 -0700 (PDT) X-Received: by 10.152.21.6 with SMTP id r6mr27004406lae.6.1411403058064; Mon, 22 Sep 2014 09:24:18 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by mx.google.com with ESMTPS id py9si14925080lbb.46.2014.09.22.09.24.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Sep 2014 09:24:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id l4so7122251lbv.16 for ; Mon, 22 Sep 2014 09:24:17 -0700 (PDT) X-Received: by 10.152.204.231 with SMTP id lb7mr26730366lac.44.1411403057817; Mon, 22 Sep 2014 09:24:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp269420lbb; Mon, 22 Sep 2014 09:24:17 -0700 (PDT) X-Received: by 10.66.66.163 with SMTP id g3mr5114064pat.150.1411403056225; Mon, 22 Sep 2014 09:24:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4si14053808pdp.184.2014.09.22.09.24.15 for ; Mon, 22 Sep 2014 09:24:16 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754577AbaIVQYK (ORCPT + 27 others); Mon, 22 Sep 2014 12:24:10 -0400 Received: from service87.mimecast.com ([91.220.42.44]:60178 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754138AbaIVQYF (ORCPT ); Mon, 22 Sep 2014 12:24:05 -0400 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 22 Sep 2014 17:24:03 +0100 Received: from e103034-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 22 Sep 2014 17:24:03 +0100 From: Morten Rasmussen To: peterz@infradead.org, mingo@redhat.com Cc: dietmar.eggemann@arm.com, pjt@google.com, bsegall@google.com, vincent.guittot@linaro.org, nicolas.pitre@linaro.org, mturquette@linaro.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, Morten Rasmussen Subject: [PATCH 2/7] cpufreq: Architecture specific callback for frequency changes Date: Mon, 22 Sep 2014 17:24:02 +0100 Message-Id: <1411403047-32010-3-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1411403047-32010-1-git-send-email-morten.rasmussen@arm.com> References: <1411403047-32010-1-git-send-email-morten.rasmussen@arm.com> X-OriginalArrivalTime: 22 Sep 2014 16:24:03.0331 (UTC) FILETIME=[9F921530:01CFD681] X-MC-Unique: 114092217240312301 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: morten.rasmussen@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Architectures that don't have any other means for tracking cpu frequency changes need a callback from cpufreq to implement a scaling factor to enable scale-invariant per-entity load-tracking in the scheduler. To compute the scale invariance correction factor the architecture would need to know both the max frequency and the current frequency. This patch defines weak functions for setting both from cpufreq. Related architecture specific functions use weak function definitions. The same approach is followed here. These callbacks can be used to implement frequency scaling of cpu capacity later. Signed-off-by: Morten Rasmussen --- drivers/cpufreq/cpufreq.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d9fdedd..e911f6b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -278,6 +278,10 @@ static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) } #endif +void __weak arch_scale_set_curr_freq(int cpu, unsigned long freq) {} + +void __weak arch_scale_set_max_freq(int cpu, unsigned long freq) {} + static void __cpufreq_notify_transition(struct cpufreq_policy *policy, struct cpufreq_freqs *freqs, unsigned int state) { @@ -315,6 +319,7 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy, pr_debug("FREQ: %lu - CPU: %lu\n", (unsigned long)freqs->new, (unsigned long)freqs->cpu); trace_cpu_frequency(freqs->new, freqs->cpu); + arch_scale_set_curr_freq(freqs->cpu, freqs->new); srcu_notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_POSTCHANGE, freqs); if (likely(policy) && likely(policy->cpu == freqs->cpu)) @@ -2135,7 +2140,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, struct cpufreq_policy *new_policy) { struct cpufreq_governor *old_gov; - int ret; + int ret, cpu; pr_debug("setting new policy for CPU %u: %u - %u kHz\n", new_policy->cpu, new_policy->min, new_policy->max); @@ -2173,6 +2178,9 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, policy->min = new_policy->min; policy->max = new_policy->max; + for_each_cpu(cpu, policy->cpus) + arch_scale_set_max_freq(cpu, policy->max); + pr_debug("new min and max freqs are %u - %u kHz\n", policy->min, policy->max);