From patchwork Wed Oct 7 17:39:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 54613 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 37C0422FEF for ; Wed, 7 Oct 2015 17:39:31 +0000 (UTC) Received: by lbcao8 with SMTP id ao8sf10799209lbc.1 for ; Wed, 07 Oct 2015 10:39:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=mjyTtmeGbdm1wjLj4MfPM6tLshu980gbcDCK+2eadOU=; b=akHFeDJcT+Cq2N15Mw8eUxYbJOAXkFVeuRXVEGh6O7ZH+elIXw+wuMni+5Hj+JyTHf K2wsQjXgXM3gWBkX35cqVmp9w/pnSmCjpxOZq9azKZlDIuHEMW+5ny0ALMtOVYWGhOnN fX35plCFraT6ZFJ2k8dabEVPRLynkP2WVbJP7Ncs043NOdRccusqZMwoywj3v4GjKJOi 5rFKUpug3CasESKsI90xm6OBsJGjKey2VA9HupZOY8caaO4QDpLEI/UGlroqQRI2ksL0 24ha3csrfQZ7fH52PpO57YKAqsGjb8OUAIf+evFGTqx44qXi9wNOSmZRZC1WxB0hIJdk BW4w== X-Gm-Message-State: ALoCoQmqsmVugJIqJh7uxwR3IIgIYHLoQyABPSGiju+cIoumJrTVPLDTCUXlhdQMh4Iif9oWy93y X-Received: by 10.112.158.202 with SMTP id ww10mr505609lbb.13.1444239570141; Wed, 07 Oct 2015 10:39:30 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.25.67 with SMTP id 64ls97383lfz.41.gmail; Wed, 07 Oct 2015 10:39:29 -0700 (PDT) X-Received: by 10.112.139.201 with SMTP id ra9mr1298933lbb.29.1444239569928; Wed, 07 Oct 2015 10:39:29 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id tn8si26111740lbb.170.2015.10.07.10.39.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Oct 2015 10:39:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbos8 with SMTP id s8so19658190lbo.0 for ; Wed, 07 Oct 2015 10:39:29 -0700 (PDT) X-Received: by 10.112.17.34 with SMTP id l2mr1280485lbd.117.1444239569615; Wed, 07 Oct 2015 10:39:29 -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.59.35 with SMTP id w3csp114741lbq; Wed, 7 Oct 2015 10:39:28 -0700 (PDT) X-Received: by 10.50.43.170 with SMTP id x10mr23339250igl.68.1444239568490; Wed, 07 Oct 2015 10:39:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c192si28379888ioe.50.2015.10.07.10.39.28; Wed, 07 Oct 2015 10:39:28 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754598AbbJGRj1 (ORCPT + 12 others); Wed, 7 Oct 2015 13:39:27 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35640 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754389AbbJGRj0 (ORCPT ); Wed, 7 Oct 2015 13:39:26 -0400 Received: by pacfv12 with SMTP id fv12so27916934pac.2 for ; Wed, 07 Oct 2015 10:39:25 -0700 (PDT) X-Received: by 10.68.68.133 with SMTP id w5mr2325884pbt.143.1444239565666; Wed, 07 Oct 2015 10:39:25 -0700 (PDT) Received: from localhost ([122.171.124.154]) by smtp.gmail.com with ESMTPSA id gv1sm40634039pbc.38.2015.10.07.10.39.23 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 07 Oct 2015 10:39:24 -0700 (PDT) Date: Wed, 7 Oct 2015 23:09:20 +0530 From: Viresh Kumar To: "Jon Medhurst (Tixy)" Cc: Sudeep Holla , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Turquette Subject: Re: [PATCH] cpufreq: arm_big_little: fix frequency check when bL switcher is active Message-ID: <20151007173920.GG4557@linux> References: <1443807532.2845.25.camel@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1443807532.2845.25.camel@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org 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.182 as permitted sender) smtp.mailfrom=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: , On 02-10-15, 18:38, Jon Medhurst (Tixy) wrote: > The check for correct frequency being set in bL_cpufreq_set_rate is > broken when the big.LITTLE switcher is active, for two reasons. > > 1. The 'new_rate' variable gets overwritten before the test by the > code calculating the frequency of the old cluster. > > 2. The frequency returned by bL_cpufreq_get_rate will be the virtual > frequency, not the actual one the intended version of new_rate contains. > > This means the function always returns an error causing an endless > stream of: "cpufreq: __target_index: Failed to change cpu frequency: -5" > > As the comment for the test indicates that it is temporary and limited > lets not bother fixing it to work when the bL switcher is active and > instead just bypass the test in that case. > > Fixes: 0a95e630b49a ("cpufreq: arm_big_little: check if the frequency is set correctly") > > Signed-off-by: Jon Medhurst > --- > drivers/cpufreq/arm_big_little.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) And why not fix it properly by doing this: diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index f1e42f8ce0fc..5b36657a76d6 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c @@ -128,7 +128,7 @@ static unsigned int bL_cpufreq_get_rate(unsigned int cpu) static unsigned int bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate) { - u32 new_rate, prev_rate; + u32 new_rate, prev_rate, target_rate; int ret; bool bLs = is_bL_switching_enabled(); @@ -140,9 +140,11 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate) per_cpu(physical_cluster, cpu) = new_cluster; new_rate = find_cluster_maxfreq(new_cluster); + target_rate = new_rate; new_rate = ACTUAL_FREQ(new_cluster, new_rate); } else { new_rate = rate; + target_rate = new_rate; } pr_debug("%s: cpu: %d, old cluster: %d, new cluster: %d, freq: %d\n", @@ -196,7 +198,7 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate) * be reading only the cached value anyway. This needs to be removed * once clk core is fixed. */ - if (bL_cpufreq_get_rate(cpu) != new_rate) + if (bL_cpufreq_get_rate(cpu) != target_rate) return -EIO; return 0; }