Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp118798rdb; Wed, 18 Oct 2023 21:38:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQQPJs61u8NCAJ700L1zHCX8shvjK8xxqmHmqiJj/RTTi/89iTAP7Iluw9yOgJZbRYgwMk X-Received: by 2002:a17:902:e803:b0:1c9:dff1:6ddd with SMTP id u3-20020a170902e80300b001c9dff16dddmr1546228plg.35.1697690334742; Wed, 18 Oct 2023 21:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697690334; cv=none; d=google.com; s=arc-20160816; b=UMKNK6RoXLbOVvi8asTJfkzyAxegTKC4hluZ77qSrYLYeNIOnlfyNILdoN4hznNFi0 7YR1G/BR1svGJhqMCra95xG4L8oABPJRREi3jsnl0ZdrJSgW6CYyKsAuyQ55EPK6rTZz e/VoxIEe2zmWiKk+oB248KrumYlTOvOepQkZtH4pJBLR7CMrp+L1cnDm0EZovdz0FJMm 043cLHQFy/dONG65ix1185ilLdQBnpWzfFdG8mtooM3aFQtgAcMPEnVBJ5KvskHeDQlJ uiDj+cT4Zh0ikHDXbH0vGwQk/KmgGABXDlYn6ctkqs1EJPupyfAuDyh/O60g30d3lfNJ 9PBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=Rv0RE/UnlB8ImLuckgrocUTCXXYAwShhb75jdX29cjc=; fh=Brbv6w76MO6Oiq/IB1b45yj0rba0BAGMKAmxhoF8LEg=; b=XQo0xwp25mmsMK92n+aCRCfCrYIYB9ekfVXBWvSAFdjt94CCALFqxhCKq+m95l0RF7 5fsvISi9sg8a5PUSOu+RO/4mog1XTb2jZVj2B3B5wFyCI8tDv7qiABtn29ZhOVV7qqYt glTl2zS9gFKoQIk0d+7wH+3tw3l+hst9aO4wEmSCwX+motOYBNkDAoC6YbJuG06ODL8E DcMzPX3F9TCIywdK+SRD3NLCmV6UELV/Ysrs21y5tNEzdvJNH4o4jeZgfa7rGWwX40+G EdvTOx4VUHj13rK7k06XnS6oucfRs4llsr5Ms48IcaragKez9tJ/L1qMgrTJZ4RvVrsC E2Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=JC0wjKhx; 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 Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id o4-20020a170902d4c400b001c724cd1128si1421516plg.276.2023.10.18.21.38.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 21:38:54 -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=@ellerman.id.au header.s=201909 header.b=JC0wjKhx; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 45064813499A; Wed, 18 Oct 2023 21:38:52 -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 S232529AbjJSEiq (ORCPT + 99 others); Thu, 19 Oct 2023 00:38:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbjJSEio (ORCPT ); Thu, 19 Oct 2023 00:38:44 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4FA811F for ; Wed, 18 Oct 2023 21:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1697690320; bh=Rv0RE/UnlB8ImLuckgrocUTCXXYAwShhb75jdX29cjc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=JC0wjKhxL2KrO9rfTQylV0wrN1YQQTse08jfgDBNxbyiJkS4q1SvRMJIWc9XG81gy LcHjOsq5IYrWqiuG48TdYsX0dhkH1VpWMq1uHO5zxGpWlmKIE+tMdgcKSZpW1s1Y27 9Gaas4gEdVokMsT90w7cSvRiQB4Wa1Yl12Myy6rlAycLx5YPkbTjG7xtcwMZx2inmA BlnmzP8TYW7X+Kg6wbXhogcS33ZvEpxWSp29K7T6Swpv2E+Eiq8buPG+rNlg/ta9Xg mOTTQKQIjXqG3MtyRMTa3b1hPWklNMPmud9M2pWbfd6LpRf9lvgCsZwZkAcWdjziyZ AgTu/xGIiB7ug== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4S9w2m3N7Wz4xZS; Thu, 19 Oct 2023 15:38:40 +1100 (AEDT) From: Michael Ellerman To: Srikar Dronamraju Cc: linuxppc-dev , Srikar Dronamraju , Christophe Leroy , Nicholas Piggin , Peter Zijlstra , Rohan McLure , Valentin Schneider , Josh Poimboeuf , Mark Rutland , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/6] powerpc/smp: Enable Asym packing for cores on shared processor In-Reply-To: <20231018163751.2423181-3-srikar@linux.vnet.ibm.com> References: <20231018163751.2423181-1-srikar@linux.vnet.ibm.com> <20231018163751.2423181-3-srikar@linux.vnet.ibm.com> Date: Thu, 19 Oct 2023 15:38:40 +1100 Message-ID: <87v8b35ir3.fsf@mail.lhotse> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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]); Wed, 18 Oct 2023 21:38:52 -0700 (PDT) Srikar Dronamraju writes: > 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. You need to be clearer here that you're talking about "big cores", not SMT4 cores as seen on bare metal systems. > 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. .. when the system is running in shared processor mode and has big cores. cheers > 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 > -- > 2.31.1