Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2274641imm; Thu, 20 Sep 2018 10:24:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbSmKn/cQkCKVhV2+Xo0pLiz8SRYxKM1TxMq7GGkLkBRRA6Vs1gfVaEpBOXwx7ECt8Kui+5 X-Received: by 2002:a17:902:714f:: with SMTP id u15-v6mr41288587plm.154.1537464256031; Thu, 20 Sep 2018 10:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537464255; cv=none; d=google.com; s=arc-20160816; b=Vc7BVTZpl48jl864iKkWdYLkoI1IPv+581oqJny4L21cq83HJjOeKxhSdboeu7HEh3 dtQgCVbu4K60AA93lWgJ15ojujPzgUxVsLILTtBfLqfnje0ZwPp4GXwCNKpB7naMrUpZ RbAi+nl7TmHWm6ttiRimbszKlNNHd2Dge9fghyxQL8g2njPQb01w7sqMuv07KRqYqQ2o sTQuELtYnshNMg0OxZLBo1uArtvX/LKSPdtB5zPGTeR2Olic+hDB9GE9ZzHtEOQXJNyO 0gGlogDyPgo3q6EKBAL2x0hU8D40Qh2IPF8TpFLGh+14cWGdn9b+DAIBC9DVYJaUiCPe /1vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=mXHL5zPbTkiaL56oyp+4sPICXnuBuzTz8wuV0h6UND0=; b=G79Y340c8h1WA0ed+A5jZ070xqa6hFeNb+OwwycpEU7S6NIB7M5pT3Z1BdtaHMbru+ mMIFTUOWSTh/ebMnedSRCZPkrP+0Xs5XHsNdfXDlHXMNq9JwpwJ88J06PKEEhyPK99uc uUy2zf5vrcnRfxuEHtsxLErOP4mmF4aYfOU9Ba623OOu6FY5otthO/yn+bz2QeH7MNyh ofW2oNxpMzutZM9jFd0F+xbu5hN4Gz6R7dAkacIEeYD4gj+A2/u5bXZy77klIvvOOYFl E8xdsOrTCCmAO+eeCpfxaBJps/gDS2S5lXGJPNEApHkD/XPQLujh8kXCQyLRvex9IyrZ jNCw== ARC-Authentication-Results: i=1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si23859991pgg.346.2018.09.20.10.24.00; Thu, 20 Sep 2018 10:24:15 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732757AbeITXHY (ORCPT + 99 others); Thu, 20 Sep 2018 19:07:24 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38648 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbeITXHY (ORCPT ); Thu, 20 Sep 2018 19:07:24 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w8KHHoEl086739 for ; Thu, 20 Sep 2018 13:26:23 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2mmf5s24cj-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 20 Sep 2018 13:26:22 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 20 Sep 2018 11:22:52 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 20 Sep 2018 11:22:50 -0600 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w8KHMnRh26935542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 20 Sep 2018 10:22:49 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 587FB13605D; Thu, 20 Sep 2018 11:22:49 -0600 (MDT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F2FA4136051; Thu, 20 Sep 2018 11:22:48 -0600 (MDT) Received: from sofia.ibm.com (unknown [9.124.212.176]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 20 Sep 2018 11:22:48 -0600 (MDT) Received: by sofia.ibm.com (Postfix, from userid 1000) id 47A7F2E2DA7; Thu, 20 Sep 2018 22:52:45 +0530 (IST) From: "Gautham R. Shenoy" To: "Aneesh Kumar K.V" , Srikar Dronamraju , Michael Ellerman , Benjamin Herrenschmidt , Michael Neuling , Vaidyanathan Srinivasan , Akshay Adiga , Shilpasri G Bhat , "Oliver O'Halloran" , Nicholas Piggin , Murilo Opsfelder Araujo , Anton Blanchard Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, "Gautham R. Shenoy" Subject: [PATCH v8 2/3] powerpc: Use cpu_smallcore_sibling_mask at SMT level on bigcores Date: Thu, 20 Sep 2018 22:52:38 +0530 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1537464159-25919-1-git-send-email-ego@linux.vnet.ibm.com> References: <1537464159-25919-1-git-send-email-ego@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18092017-0012-0000-0000-000016B8446C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009741; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01091142; UDB=6.00563758; IPR=6.00871165; MB=3.00023416; MTD=3.00000008; XFM=3.00000015; UTC=2018-09-20 17:22:52 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18092017-0013-0000-0000-00005479101F Message-Id: <1537464159-25919-3-git-send-email-ego@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-20_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809200167 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Gautham R. Shenoy" Each of the SMT4 cores forming a big-core are more or less independent units. Thus when multiple tasks are scheduled to run on the big-core, we get the best performance when the tasks are spread across the pair of SMT4 cores. This patch achieves this by setting the SMT level mask to correspond to the smallcore sibling mask on big-core systems. This patch also the CACHE level sched-domain corresponding to the big-core is created on big-core systems. With this patch, the SMT sched-domain with SMT=8,4,2 on big-core systems are as follows: 1) ppc64_cpu --smt=8 CPU0 attaching sched-domain(s): domain-0: span=0,2,4,6 level=SMT groups: 0:{ span=0 cap=294 }, 2:{ span=2 cap=294 }, 4:{ span=4 cap=294 }, 6:{ span=6 cap=294 } CPU1 attaching sched-domain(s): domain-0: span=1,3,5,7 level=SMT groups: 1:{ span=1 cap=294 }, 3:{ span=3 cap=294 }, 5:{ span=5 cap=294 }, 7:{ span=7 cap=294 } 2) ppc64_cpu --smt=4 CPU0 attaching sched-domain(s): domain-0: span=0,2 level=SMT groups: 0:{ span=0 cap=589 }, 2:{ span=2 cap=589 } CPU1 attaching sched-domain(s): domain-0: span=1,3 level=SMT groups: 1:{ span=1 cap=589 }, 3:{ span=3 cap=589 } 3) ppc64_cpu --smt=2 SMT domain is a trivial domain consisting of just 1 CPU. Hence this domain gets collapsed leaving only CACHE, DIE and NUMA domains. Signed-off-by: Gautham R. Shenoy --- arch/powerpc/kernel/smp.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 15095110..5cdcf44 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -1265,6 +1265,7 @@ static void add_cpu_to_masks(int cpu) void start_secondary(void *unused) { unsigned int cpu = smp_processor_id(); + struct cpumask *(*sibling_mask)(int) = cpu_sibling_mask; mmgrab(&init_mm); current->active_mm = &init_mm; @@ -1290,11 +1291,13 @@ void start_secondary(void *unused) /* Update topology CPU masks */ add_cpu_to_masks(cpu); + if (has_big_cores) + sibling_mask = cpu_smallcore_mask; /* * Check for any shared caches. Note that this must be done on a * per-core basis because one core in the pair might be disabled. */ - if (!cpumask_equal(cpu_l2_cache_mask(cpu), cpu_sibling_mask(cpu))) + if (!cpumask_equal(cpu_l2_cache_mask(cpu), sibling_mask(cpu))) shared_caches = true; set_numa_node(numa_cpu_lookup_table[cpu]); @@ -1361,6 +1364,13 @@ static const struct cpumask *shared_cache_mask(int cpu) return cpu_l2_cache_mask(cpu); } +#ifdef CONFIG_SCHED_SMT +static const struct cpumask *smallcore_smt_mask(int cpu) +{ + return cpu_smallcore_mask(cpu); +} +#endif + static struct sched_domain_topology_level power9_topology[] = { #ifdef CONFIG_SCHED_SMT { cpu_smt_mask, powerpc_smt_flags, SD_INIT_NAME(SMT) }, @@ -1388,6 +1398,13 @@ void __init smp_cpus_done(unsigned int max_cpus) shared_proc_topology_init(); dump_numa_cpu_topology(); +#ifdef CONFIG_SCHED_SMT + if (has_big_cores) { + pr_info("Using small cores at SMT level\n"); + power9_topology[0].mask = smallcore_smt_mask; + powerpc_topology[0].mask = smallcore_smt_mask; + } +#endif /* * If any CPU detects that it's sharing a cache with another CPU then * use the deeper topology that is aware of this sharing. -- 1.9.4