From patchwork Wed Mar 5 22:38:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 25770 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3B645203C3 for ; Wed, 5 Mar 2014 22:39:12 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rl12sf6494232iec.10 for ; Wed, 05 Mar 2014 14:39:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to: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=x/lP5s+05HnWyBspRKrjfdnR7wJKT7OwAJcuG5A2GoA=; b=Svw2vURifq7uvT7CK+mixNd1h27bcILteM86G6501dVoftwi2K5hJdZnnVsv7H/68Y rjFU0Fh0k3sEJt77DOgOSMmPjK/Uk54Pk8tLI83XSd1ZhsWLhlB/F24vOQqbfCp1AsE5 pBRclOOwn93ZgtMfXk9YtIYGwAsjgLOOXdCmJwl6WVU0KSOHFjGQA4+qAR4RoyWURhgI sI0MYF926n954nnXmWkankqguJq0NUSGsyS4oMkx7av4/1vGAZ9Y4Qp4LsA7H82veNE+ zT3MaaG5G7IDGNZW9D9jxMhlcxosnoOB+Ld+UR7muvd4fO7HIDPsu8Wcvl3tR4evwe6H VXWg== X-Gm-Message-State: ALoCoQl3WeQnbmn1sqj5dusaOkxYx/zJwKNAeqOHIOTijJ6GxohfLupTg/u3+W+1JQLeHOswMFit X-Received: by 10.50.79.197 with SMTP id l5mr15416943igx.0.1394059151723; Wed, 05 Mar 2014 14:39:11 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.239 with SMTP id m102ls424174qga.8.gmail; Wed, 05 Mar 2014 14:39:11 -0800 (PST) X-Received: by 10.220.99.72 with SMTP id t8mr2090636vcn.10.1394059151523; Wed, 05 Mar 2014 14:39:11 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id p9si1231948vdv.70.2014.03.05.14.39.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Mar 2014 14:39:11 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oy12so1736525veb.4 for ; Wed, 05 Mar 2014 14:39:11 -0800 (PST) X-Received: by 10.52.241.106 with SMTP id wh10mr5437103vdc.16.1394059151421; Wed, 05 Mar 2014 14:39:11 -0800 (PST) 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 i9csp52868vck; Wed, 5 Mar 2014 14:39:10 -0800 (PST) X-Received: by 10.66.146.105 with SMTP id tb9mr7360644pab.157.1394059150375; Wed, 05 Mar 2014 14:39:10 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yh4si3496239pbc.288.2014.03.05.14.39.09; Wed, 05 Mar 2014 14:39:09 -0800 (PST) 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 S1757566AbaCEWjB (ORCPT + 26 others); Wed, 5 Mar 2014 17:39:01 -0500 Received: from service87.mimecast.com ([91.220.42.44]:50037 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752946AbaCEWi7 convert rfc822-to-8bit (ORCPT ); Wed, 5 Mar 2014 17:38:59 -0500 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 05 Mar 2014 22:38:56 +0000 Received: from [10.37.5.151] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 5 Mar 2014 22:39:01 +0000 Message-ID: <5317A77C.8020501@arm.com> Date: Wed, 05 Mar 2014 22:38:52 +0000 From: Dietmar Eggemann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Vincent Guittot , "peterz@infradead.org" , "mingo@kernel.org" , "linux-kernel@vger.kernel.org" , "tony.luck@intel.com" , "fenghua.yu@intel.com" , "schwidefsky@de.ibm.com" , "james.hogan@imgtec.com" , "cmetcalf@tilera.com" , "benh@kernel.crashing.org" , "linux@arm.linux.org.uk" , "linux-arm-kernel@lists.infradead.org" CC: "preeti@linux.vnet.ibm.com" , "linaro-kernel@lists.linaro.org" Subject: Re: [RFC 6/6] sched: ARM: create a dedicated scheduler topology table References: <1394003906-11630-1-git-send-email-vincent.guittot@linaro.org> <1394003906-11630-7-git-send-email-vincent.guittot@linaro.org> In-Reply-To: <1394003906-11630-7-git-send-email-vincent.guittot@linaro.org> X-OriginalArrivalTime: 05 Mar 2014 22:39:01.0891 (UTC) FILETIME=[B4BA2530:01CF38C3] X-MC-Unique: 114030522385600501 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: dietmar.eggemann@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 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: , On 05/03/14 07:18, Vincent Guittot wrote: > Create a dedicated topology table for ARM which will create new level to > differentiate CPUs that can or not powergate independantly from others. > > The patch gives an example of how to add domain that will take advantage of > SD_SHARE_POWERDOMAIN. > > Signed-off-by: Vincent Guittot > --- > arch/arm/kernel/topology.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c > index 0bc94b1..ae8ffbc 100644 > --- a/arch/arm/kernel/topology.c > +++ b/arch/arm/kernel/topology.c > @@ -185,6 +185,15 @@ const struct cpumask *cpu_coregroup_mask(int cpu) > return &cpu_topology[cpu].core_sibling; > } > > +/* > + * The current assumption is that we can power gate each core independently. > + * This will be superseded by DT binding once available. > + */ > +const struct cpumask *cpu_corepower_mask(int cpu) > +{ > + return &cpu_topology[cpu].thread_sibling; > +} Although you already explained this to me in a private conversation, it's important to notice that running this set-up on a dual cluster TC2 (2 Cortex A15 - 3 Cortex A7) (no independent core power gating) we don't see the SD_SHARE_POWERDOMAIN topology flag set in the sd's on MC level because this patch-set doesn't contain the appropriate DT parsing. Like you said back then, the comment above mentions this. > + > static void update_siblings_masks(unsigned int cpuid) > { > struct cputopo_arm *cpu_topo, *cpuid_topo = &cpu_topology[cpuid]; > @@ -266,6 +275,20 @@ void store_cpu_topology(unsigned int cpuid) > cpu_topology[cpuid].socket_id, mpidr); > } > > +static struct sched_domain_topology_level arm_topology[] = { > +#ifdef CONFIG_SCHED_MC > + { cpu_corepower_mask, SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN, SD_INIT_NAME(GMC) }, > + { cpu_coregroup_mask, SD_SHARE_PKG_RESOURCES, SD_INIT_NAME(MC) }, > +#endif > + { cpu_cpu_mask, SD_INIT_NAME(DIE) }, > + { NULL, }, > +}; > + > +static void __init set_sched_topology(void) > +{ > + sched_domain_topology = arm_topology; > +} > + > /* > * init_cpu_topology is called at boot when only one cpu is running > * which prevent simultaneous write access to cpu_topology array > @@ -289,4 +312,7 @@ void __init init_cpu_topology(void) > smp_wmb(); > > parse_dt_topology(); > + > + /* Set scheduler topology descriptor */ > + set_sched_topology(); > } > How about the core scheduler provides an interface set_sched_topology() instead of each arch has its own __init function? Sketched out below for ARM. -- >8 -- Subject: [PATCH] sched: set_sched_topology() as an interface of core scheduler --- arch/arm/kernel/topology.c | 7 +------ include/linux/sched.h | 2 +- kernel/sched/core.c | 5 +++++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index ae8ffbc..89d5592 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -284,11 +284,6 @@ static struct sched_domain_topology_level arm_topology[] = { { NULL, }, }; -static void __init set_sched_topology(void) -{ - sched_domain_topology = arm_topology; -} - /* * init_cpu_topology is called at boot when only one cpu is running * which prevent simultaneous write access to cpu_topology array @@ -314,5 +309,5 @@ void __init init_cpu_topology(void) parse_dt_topology(); /* Set scheduler topology descriptor */ - set_sched_topology(); + set_sched_topology(arm_topology); } diff --git a/include/linux/sched.h b/include/linux/sched.h index 8831413..fefd4e7 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -998,7 +998,7 @@ struct sched_domain_topology_level { #endif }; -extern struct sched_domain_topology_level *sched_domain_topology; +extern void set_sched_topology(struct sched_domain_topology_level *tl); #ifdef CONFIG_SCHED_DEBUG # define SD_INIT_NAME(type) .name = #type diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b4fb0df..a748c92 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6105,6 +6105,11 @@ static struct sched_domain_topology_level default_topology[] = { struct sched_domain_topology_level *sched_domain_topology = default_topology; +void set_sched_topology(struct sched_domain_topology_level *tl) +{ + sched_domain_topology = tl; +} + #define for_each_sd_topology(tl) \ for (tl = sched_domain_topology; tl->mask; tl++)