From patchwork Wed Jun 22 17:03:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Rasmussen X-Patchwork-Id: 70674 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp15455qgy; Wed, 22 Jun 2016 10:04:32 -0700 (PDT) X-Received: by 10.98.152.76 with SMTP id q73mr35817334pfd.38.1466615072207; Wed, 22 Jun 2016 10:04:32 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bu9si864792pac.155.2016.06.22.10.04.31; Wed, 22 Jun 2016 10:04:32 -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 S1752959AbcFVRE3 (ORCPT + 30 others); Wed, 22 Jun 2016 13:04:29 -0400 Received: from foss.arm.com ([217.140.101.70]:49352 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753223AbcFVRCt (ORCPT ); Wed, 22 Jun 2016 13:02:49 -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 55DF2BF1; Wed, 22 Jun 2016 10:03:36 -0700 (PDT) Received: from e105550-lin.cambridge.arm.com (e105550-lin.cambridge.arm.com [10.1.207.130]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A826D3F246; Wed, 22 Jun 2016 10:02:47 -0700 (PDT) From: Morten Rasmussen To: peterz@infradead.org, mingo@redhat.com Cc: dietmar.eggemann@arm.com, yuyang.du@intel.com, vincent.guittot@linaro.org, mgalbraith@suse.de, linux-kernel@vger.kernel.org, Morten Rasmussen , Russell King Subject: [PATCH v2 12/13] arm: Set SD_ASYM_CPUCAPACITY for big.LITTLE platforms Date: Wed, 22 Jun 2016 18:03:23 +0100 Message-Id: <1466615004-3503-13-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466615004-3503-1-git-send-email-morten.rasmussen@arm.com> References: <1466615004-3503-1-git-send-email-morten.rasmussen@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set the SD_ASYM_CPUCAPACITY flag for DIE and MC level sched_domains on big.LITTLE systems. cc: Russell King Signed-off-by: Morten Rasmussen --- arch/arm/kernel/topology.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) -- 1.9.1 diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index ec279d161b32..ab6d9c1835a4 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -78,6 +78,7 @@ static unsigned long *__cpu_capacity; #define cpu_capacity(cpu) __cpu_capacity[cpu] static unsigned long middle_capacity = 1; +static unsigned int big_little; /* * Iterate all CPUs' descriptor in DT and compute the efficiency @@ -151,6 +152,8 @@ static void __init parse_dt_topology(void) middle_capacity = ((max_capacity / 3) >> (SCHED_CAPACITY_SHIFT-1)) + 1; + if (max_capacity && max_capacity != min_capacity) + big_little = 1; } /* @@ -277,15 +280,29 @@ void store_cpu_topology(unsigned int cpuid) static inline int cpu_corepower_flags(void) { - return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN; + int flags = SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN; + + return big_little ? SD_ASYM_CPUCAPACITY | flags : flags; +} + +static inline int arm_cpu_core_flags(void) +{ + int flags = SD_SHARE_PKG_RESOURCES; + + return big_little ? SD_ASYM_CPUCAPACITY | flags : flags; +} + +static inline int arm_cpu_cpu_flags(void) +{ + return big_little ? SD_ASYM_CPUCAPACITY : 0; } static struct sched_domain_topology_level arm_topology[] = { #ifdef CONFIG_SCHED_MC { cpu_corepower_mask, cpu_corepower_flags, SD_INIT_NAME(GMC) }, - { cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) }, + { cpu_coregroup_mask, arm_cpu_core_flags, SD_INIT_NAME(MC) }, #endif - { cpu_cpu_mask, SD_INIT_NAME(DIE) }, + { cpu_cpu_mask, arm_cpu_cpu_flags, SD_INIT_NAME(DIE) }, { NULL, }, };