From patchwork Tue Sep 30 04:25:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 38114 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 35ECC202DB for ; Tue, 30 Sep 2014 04:25:40 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf2981273wgh.9 for ; Mon, 29 Sep 2014 21:25:39 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=NqYOP+gsjYcOy5rIfMQ6DlQjFGWl9hZ9H0wg2l/OZKc=; b=Bfvx0ZrkRsYo0t+POhQjFOzLYJ5/YeeMCvLved7crV0B2RB9r/WyRBI6FMpuLE4YKB yC7+KKyQEZuk+9Yy6vU0G7z6GPzIvlxirPgnonGjuGrK4/H//NdV44AQCl6wBqIkryk1 FOfDF9ARjbO8qrrKBpWQ1BLZYZh++90ZJAYozxiB/RTehcPB2+tNkluEl7BYIv8MoZlL 4bLSx+twsx3ehukf96rAOsECI7DT/rIqaeTQB1UGFCkWIzWdEoFxiszqd6YbHfdZIso2 7yZVb12qe/ZT5SFJaPLIbPIWuD6Uv+FpulnoeMQ4UwKDWwtENooHbtRRxDJFibBZAmy0 Lc5w== X-Gm-Message-State: ALoCoQkUQi1qPlT/2Zy3Ybns93IuJJ2Ba5JZKJ8bPrUVGOlMST3sj2hRWMuOl86YGqA7w5pm6pam X-Received: by 10.180.109.67 with SMTP id hq3mr811209wib.1.1412051139377; Mon, 29 Sep 2014 21:25:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.101 with SMTP id l5ls643429lam.103.gmail; Mon, 29 Sep 2014 21:25:39 -0700 (PDT) X-Received: by 10.152.206.35 with SMTP id ll3mr8235626lac.88.1412051139223; Mon, 29 Sep 2014 21:25:39 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id t1si20749382lbv.79.2014.09.29.21.25.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 29 Sep 2014 21:25:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id s18so3828529lam.37 for ; Mon, 29 Sep 2014 21:25:38 -0700 (PDT) X-Received: by 10.152.204.231 with SMTP id lb7mr43575277lac.44.1412051138769; Mon, 29 Sep 2014 21:25:38 -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 of9csp282620lbb; Mon, 29 Sep 2014 21:25:38 -0700 (PDT) X-Received: by 10.70.103.100 with SMTP id fv4mr31745680pdb.38.1412051137331; Mon, 29 Sep 2014 21:25:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dw9si25653626pab.191.2014.09.29.21.25.36 for ; Mon, 29 Sep 2014 21:25:37 -0700 (PDT) Received-SPF: none (google.com: stable-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 S1750879AbaI3EZf (ORCPT + 1 other); Tue, 30 Sep 2014 00:25:35 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:52523 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830AbaI3EZf (ORCPT ); Tue, 30 Sep 2014 00:25:35 -0400 Received: by mail-pd0-f172.google.com with SMTP id p10so2118754pdj.31 for ; Mon, 29 Sep 2014 21:25:34 -0700 (PDT) X-Received: by 10.67.4.163 with SMTP id cf3mr65851065pad.92.1412051134615; Mon, 29 Sep 2014 21:25:34 -0700 (PDT) Received: from localhost ([122.178.192.168]) by mx.google.com with ESMTPSA id q1sm13813196pds.69.2014.09.29.21.25.33 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 29 Sep 2014 21:25:34 -0700 (PDT) From: Viresh Kumar To: stable@vger.kernel.org Cc: Rafael Wysocki , linux-pm@vger.kernel.org, tixy@linaro.org, broonie@linaro.org, viresh kumar Subject: [PATCH] cpufreq: arm_big_little: set 'physical_cluster' for each CPU Date: Tue, 30 Sep 2014 09:55:20 +0530 Message-Id: X-Mailer: git-send-email 2.0.3.693.g996b0fd Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@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.215.50 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: , From: viresh kumar Upstream commit ID: 8f3ba3d3257be80636ed15cc221d6a2efb6a6e82 We have a per-CPU variable for managing which cluster a CPU belongs to. Currently, physical_cluster is set for policy->cpu only which leads to the 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. Based on previous work by Xin Wang. Cc: # 3.13 Cc: # 3.14 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 5519933..ee409f0 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;