Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp451768rdb; Thu, 19 Oct 2023 08:57:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcpKhqut/ySk6NLLZ/szmdyi+3Co87CO+ZJN35DGRZcbXJOSi3W7jkNIUGh6EZzXCSCZqK X-Received: by 2002:a05:6358:e816:b0:168:a8c7:632d with SMTP id gi22-20020a056358e81600b00168a8c7632dmr1483611rwb.10.1697731054811; Thu, 19 Oct 2023 08:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697731054; cv=none; d=google.com; s=arc-20160816; b=QlyIejLdtNHeXiKiRNng348RthIryJLHwToZgci9Kzkp2qdhW+kwhee92HdUu95HN7 PV80XQY9honTFapyjxOwJb2ME7oDV0exg2wlRor1c+WN2Vb6uMzNwLyLX1sE0FPCMx4G hqmu369BnYMVoDGuL9lmk6ZEYwDfth+fVs9CofjGVR6ykhUOtjx7H27v71518nUll7Cx S9sib1uv1vNLs5riLtPWdEDj7kxmXwLg/jFFe2Z5zmup1NWzly4lzEKW1BxTI877GLep gOB2TwgGwhNL3IMkvD1OCv6n4od4sl0Q/YBvc//xPRovGRQX+PLALumsEPdbjMKfWMYD kXBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=D9JV0J9YLtbpvM1Bryhy/UTf6mfOpcUpp8XQTtpt8c0=; fh=jj378kodhDpzJmPUxxiTGj2jbWK8ht+jLm+GWsr8ykA=; b=T+Sx/sacP844W2cWWJh1vFfiUmg2Ie4oKwKgVmIuSbwSctAjJSjGFFHro5ww2xt5rP p3wp9lwkgrLEcrng6Tck0rXloClcxTY+YEe9WT2qC2Ir+w2TSA6J6FzaGgMntOdPabPN PqVXbRpd//rVTVbdrCdXw1MjnH9eJIhutzdWpofiVMNF7ff+t/uDRWcNlpS6LT3Tsy8S OZURGXGajDR/lVfcgN2lHJT2gHLX4oQ1G8ZK22tD7NjnxeXhln0rOWQzucr1FDsHaB9j P94YBD2zSThHFUYO0YfomeRzzolM4o5xcOWXDFndo+hspZe1gxjsd9Nqphcwzq+GLeA4 TwMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="b0X8dNd/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b6-20020a633406000000b005ab190f94ffsi4548052pga.605.2023.10.19.08.57.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 08:57:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="b0X8dNd/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0A47681ADB4A; Thu, 19 Oct 2023 08:57:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346400AbjJSP5W (ORCPT + 99 others); Thu, 19 Oct 2023 11:57:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235459AbjJSP5T (ORCPT ); Thu, 19 Oct 2023 11:57:19 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6A75132 for ; Thu, 19 Oct 2023 08:57:17 -0700 (PDT) Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39JFsmn2008383; Thu, 19 Oct 2023 15:57:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=D9JV0J9YLtbpvM1Bryhy/UTf6mfOpcUpp8XQTtpt8c0=; b=b0X8dNd/fYMJZDu3trv/our7b9Whv+Os3O3JP0z1rm6/BWCKQoK2/kYeXRX7c8GCNqqc DGiuvL6FPaj0Y5uqCo3uByliR9ErgHinBrjw1YbdGCU8gHBd/g0ZqryRphJyUZR5G8U6 RZJO15fA6liYVRMr+jAdhP/lqISVT+e+WTJyUetvOGHvWlkTwxF41RDJ4uTJ772/btya MFVcoVEJRqrgxQQhpY1v1lyglvVciOzoielCgk21nw1P/90+xfGI4oLRcQ3+eJ1Uxk+F ggHmizDCdHb46X97Y2xtsYMvYjSQ2he2A4fW8u7x21R1hR15JbFfkKs7+bfLSlZ2n8/W 7A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tu7gv04y9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Oct 2023 15:57:04 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39JFsqD2008819; Thu, 19 Oct 2023 15:57:03 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tu7gv04xc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Oct 2023 15:57:03 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 39JExVXc031142; Thu, 19 Oct 2023 15:57:02 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3tr7hk1f5h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Oct 2023 15:57:02 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 39JFv2Tv24576758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Oct 2023 15:57:02 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1A11C58055; Thu, 19 Oct 2023 15:57:02 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8795E58043; Thu, 19 Oct 2023 15:56:58 +0000 (GMT) Received: from [9.171.84.137] (unknown [9.171.84.137]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 19 Oct 2023 15:56:58 +0000 (GMT) Message-ID: <45a14ebb-91e7-489d-ad5d-6d39a48bc1f5@linux.vnet.ibm.com> Date: Thu, 19 Oct 2023 21:26:56 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/6] powerpc/smp: Enable Asym packing for cores on shared processor Content-Language: en-US To: Srikar Dronamraju Cc: Mark Rutland , Valentin Schneider , Peter Zijlstra , linux-kernel@vger.kernel.org, Rohan McLure , Nicholas Piggin , linuxppc-dev , Josh Poimboeuf , Michael Ellerman References: <20231018163751.2423181-1-srikar@linux.vnet.ibm.com> <20231018163751.2423181-3-srikar@linux.vnet.ibm.com> From: Shrikanth Hegde In-Reply-To: <20231018163751.2423181-3-srikar@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -gQcv_yCJE3G2YihojiZrXuZFqwuGsVL X-Proofpoint-ORIG-GUID: m52CIvECt0XNHIYaU802OfGZhxy9C-iH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-19_15,2023-10-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 impostorscore=0 clxscore=1011 priorityscore=1501 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310190134 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 19 Oct 2023 08:57:32 -0700 (PDT) On 10/18/23 10:07 PM, Srikar Dronamraju wrote: > If there are shared processor LPARs, underlying Hypervisor can have more > virtual cores to handle than actual physical cores. > > Starting with Power 9, a core has 2 nearly independent thread groups. > On a shared processors LPARs, it helps to pack threads to lesser number > of cores so that the overall system performance and utilization > improves. PowerVM schedules at a core level. Hence packing to fewer > cores helps. > > For example: Lets says there are two 8-core Shared LPARs that are > actually sharing a 8 Core shared physical pool, each running 8 threads > each. Then Consolidating 8 threads to 4 cores on each LPAR would help > them to perform better. This is because each of the LPAR will get > 100% time to run applications and there will no switching required by > the Hypervisor. > > To achieve this, enable SD_ASYM_PACKING flag at CACHE, MC and DIE level. This would have a conflict with tip/master. DIE has been renamed to PKG and Both changelog and code below should change DIE to PKG. > > Signed-off-by: Srikar Dronamraju > --- > Changelog: > v1->v2: Using static key instead of a variable. > > arch/powerpc/kernel/smp.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c > index 37c41297c9ce..498c2d51fc20 100644 > --- a/arch/powerpc/kernel/smp.c > +++ b/arch/powerpc/kernel/smp.c > @@ -1009,9 +1009,20 @@ static int powerpc_smt_flags(void) > */ > static int powerpc_shared_cache_flags(void) > { > + if (static_branch_unlikely(&powerpc_asym_packing)) > + return SD_SHARE_PKG_RESOURCES | SD_ASYM_PACKING; > + > return SD_SHARE_PKG_RESOURCES; > } > > +static int powerpc_shared_proc_flags(void) > +{ > + if (static_branch_unlikely(&powerpc_asym_packing)) > + return SD_ASYM_PACKING; > + > + return 0; > +} > + > /* > * We can't just pass cpu_l2_cache_mask() directly because > * returns a non-const pointer and the compiler barfs on that. > @@ -1048,8 +1059,8 @@ static struct sched_domain_topology_level powerpc_topology[] = { > { cpu_smt_mask, powerpc_smt_flags, SD_INIT_NAME(SMT) }, > #endif > { shared_cache_mask, powerpc_shared_cache_flags, SD_INIT_NAME(CACHE) }, > - { cpu_mc_mask, SD_INIT_NAME(MC) }, > - { cpu_cpu_mask, SD_INIT_NAME(DIE) }, > + { cpu_mc_mask, powerpc_shared_proc_flags, SD_INIT_NAME(MC) }, > + { cpu_cpu_mask, powerpc_shared_proc_flags, SD_INIT_NAME(DIE) }, > { NULL, }, > }; > > @@ -1687,6 +1698,8 @@ static void __init fixup_topology(void) > if (cpu_has_feature(CPU_FTR_ASYM_SMT)) { > pr_info_once("Enabling Asymmetric SMT scheduling\n"); > static_branch_enable(&powerpc_asym_packing); > + } else if (is_shared_processor() && has_big_cores) { > + static_branch_enable(&powerpc_asym_packing); > } > > #ifdef CONFIG_SCHED_SMT