From patchwork Fri Mar 14 06:40:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 26244 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8993C20540 for ; Fri, 14 Mar 2014 06:41:31 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf7415584iec.0 for ; Thu, 13 Mar 2014 23:41:31 -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: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; bh=bFllXgYnyEGKwfNc38qZ65WbD581A9VTt44iEDFMyRA=; b=dxpzBgTBSPUPYHi8DpfxUh8Z7IhMK3k9cHR1g7tzRwuGRfIhlSOhOA8a/U1RHuIpQG DNd8GUsCQ7mpinvwfBPxKBHKqSJomaesez7gDZ3E9h9xWp6li5ZAT39JlWzz/XiUeVut E0ddXTKvgBUK5+3zKa47+6fh0Gt9+d+lwjGDuWzw7OU3fi4zUjy8ku2HauvnOxVVEM2B m+qtBR4tfVgl9ntfc7pRGzwbl/d8Whbizh3a+czCSBvW/wphOgkw9pTtqhSi9THy2Bsw 1fY6HNHQmGBHlY0Bz3W0Dbjy5NJv+dO7Yp45b20nYnjsavyjLTJZRrzryWPraHRRA2jS chHA== X-Gm-Message-State: ALoCoQkfe3i9e5OMisfc5WPree1AoeGANFsTLK2B6fZ7Crd9ZfTacHlOdS1JOgikzughqF40v6/N X-Received: by 10.182.104.70 with SMTP id gc6mr2495081obb.35.1394779291039; Thu, 13 Mar 2014 23:41:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.200 with SMTP id p66ls625107qgp.74.gmail; Thu, 13 Mar 2014 23:41:30 -0700 (PDT) X-Received: by 10.220.136.6 with SMTP id p6mr4989179vct.9.1394779290972; Thu, 13 Mar 2014 23:41:30 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id io9si1761322vcb.62.2014.03.13.23.41.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Mar 2014 23:41:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id lg15so2308947vcb.30 for ; Thu, 13 Mar 2014 23:41:30 -0700 (PDT) X-Received: by 10.52.248.138 with SMTP id ym10mr4182817vdc.18.1394779290883; Thu, 13 Mar 2014 23:41:30 -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.220.78.9 with SMTP id i9csp30939vck; Thu, 13 Mar 2014 23:41:30 -0700 (PDT) X-Received: by 10.66.49.74 with SMTP id s10mr7501978pan.0.1394779289449; Thu, 13 Mar 2014 23:41:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hj8si2111514pac.80.2014.03.13.23.41.28; Thu, 13 Mar 2014 23:41:28 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755789AbaCNGlM (ORCPT + 26 others); Fri, 14 Mar 2014 02:41:12 -0400 Received: from mail-we0-f172.google.com ([74.125.82.172]:47487 "EHLO mail-we0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755733AbaCNGlI (ORCPT ); Fri, 14 Mar 2014 02:41:08 -0400 Received: by mail-we0-f172.google.com with SMTP id t61so1752342wes.3 for ; Thu, 13 Mar 2014 23:41:07 -0700 (PDT) X-Received: by 10.180.7.130 with SMTP id j2mr4692180wia.25.1394779267444; Thu, 13 Mar 2014 23:41:07 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id bi8sm12283953wib.3.2014.03.13.23.41.03 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 13 Mar 2014 23:41:06 -0700 (PDT) From: Viresh Kumar To: rjw@rjwysocki.net Cc: linaro-kernel@lists.linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, xin.wang@arm.com, arvind.chauhan@arm.com, Sudeep.Holla@arm.com, Viresh Kumar Subject: [PATCH 2/2] cpufreq: arm_big_little: set 'physical_cluster' for each cpu Date: Fri, 14 Mar 2014 12:10:55 +0530 Message-Id: <354da516ba1facd6764bfc416ef13a59f9681d1c.1394779110.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <4689064c920e08d5667b38d7117620ab98150273.1394779110.git.viresh.kumar@linaro.org> References: <4689064c920e08d5667b38d7117620ab98150273.1394779110.git.viresh.kumar@linaro.org> In-Reply-To: <4689064c920e08d5667b38d7117620ab98150273.1394779110.git.viresh.kumar@linaro.org> References: <4689064c920e08d5667b38d7117620ab98150273.1394779110.git.viresh.kumar@linaro.org> 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: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , We have a per-cpu variable for managing which cluster does a CPU belong to. Currently physical_cluster is set only for the policy->cpu. And that results in following on some SoC's: - There are two clusters: - Cluster 0 has four ARM Cortex A7 CPUs (slower ones): 0,1,2,3 - Cluster 1 has four ARM Cortex A15 CPUs (faster ones): 4,5,6,7 - CPUs are booted in order 0,1..7 and so initially policy->cpu for A7 cluster would be 0 and for A15 cluster would be 4. - Now CPU4 (i.e. A15_0) is hotplugged out and so policy->cpu for A15 cluster becomes 5 (i.e. A15_1). - But physical cluster is only set for CPU0 and CPU4 in ARM big LITTLE driver and isn't updated. - Now freq change request comes for A15 cluster and we would try to update freq of physical_cluster of CPU5, i.e. A15_1. And it is currently set to zero (default value of uninitialized global variables). - And so we actually try to change freq of A7 cluster instead of A15. - This also results in kernel crash as sometimes we might request freq above A7's limit and CPU may behave badly.. Fix this by initializing physical_cluster for all CPUs of a policy. (Adding signed-off by Xin as he reported this issue and provided this diff) Signed-off-by: Xin Wang Signed-off-by: Viresh Kumar --- drivers/cpufreq/arm_big_little.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index 3d87078..bad2ed3 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c @@ -446,9 +446,12 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy) } if (cur_cluster < MAX_CLUSTERS) { + int cpu; + cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu)); - per_cpu(physical_cluster, policy->cpu) = cur_cluster; + for_each_cpu(cpu, policy->cpus) + per_cpu(physical_cluster, cpu) = cur_cluster; } else { /* Assumption: during init, we are always running on A15 */ per_cpu(physical_cluster, policy->cpu) = A15_CLUSTER;