Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1083369pxm; Wed, 23 Feb 2022 17:41:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoUi4DSjMYThZ++ztE5AgoDPHwJETyEp/Jbb2Kk6NFYbOvlS6CiLw3DVcJljZmevZuewKd X-Received: by 2002:a63:cf4f:0:b0:370:64bc:9996 with SMTP id b15-20020a63cf4f000000b0037064bc9996mr482120pgj.430.1645666897251; Wed, 23 Feb 2022 17:41:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645666897; cv=none; d=google.com; s=arc-20160816; b=kOiPRFrl/VpXapWAVbZ5oa5+CNpFUkWJmFSOgNXno/hQcN0fesMERAtQ9u+9uBzfig j8j7Ioez+6JDiNxV6jVR+KPiYlH4z+PHcUh/9bAt2HeFW4g02eDaInZzc5B3GJRFWSed iyi5oSomOlpWwF1KFoy69AbVYcyTTHEMhPt6JauvufxooypiBAj9eHA9JUatBtxW+KPE VWemmpLQ1sobh6BDvbmJsryzkIBYv67kCVoZwZUVc4C6a73y76Z3y+P/WcEqykQPXdQ8 1HwSB9S6SmVVS54pzgBTVWXgLFiOjUJ7ZAukKjhfMzTtaJlAIwTp7+m3Zj5dE5qYpmy4 eCMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=txwRzy7T4FJEAmlc/vFopAVCAIZ4Qfp20yRwWgSyO3s=; b=dDhAWRiNxEWNqCrxQPvJ9JFa5NZSr5fXw8ytXyPykckklBaMrArILeea4Ro5n/zMiA Ftn82QKU2KJepZoVPBxO2ylYnvEr5qb4/AFN4HC+WjleFLRh6HDSIpHLsEn2OmWUjo9P NRoFbwuyj3/G6PGpO17wI1O100OuHdJwNnmy/R7L+YfXeHmqEgXTfOKKfPIjrdyatpvP THKSGzdAfL05gGUzfbm7RCqJxmpRX770yauQCITDckTjXyUsPgms+wivFWqAm/EIVKyd lnTfMmBHnWAOl2Pnd1FP4OLisll2E2IGe19tK9m3yBy/dpqMu+zFxZzq90nwXtWOhOJp Wf9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j0cHyeok; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t9-20020a17090abc4900b001bc5dab2a90si3508537pjv.186.2022.02.23.17.41.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 17:41:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j0cHyeok; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C8B001704C3; Wed, 23 Feb 2022 17:17:17 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243183AbiBWRYe (ORCPT + 99 others); Wed, 23 Feb 2022 12:24:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240321AbiBWRYd (ORCPT ); Wed, 23 Feb 2022 12:24:33 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C802750060 for ; Wed, 23 Feb 2022 09:24:04 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id g39so32350710lfv.10 for ; Wed, 23 Feb 2022 09:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=txwRzy7T4FJEAmlc/vFopAVCAIZ4Qfp20yRwWgSyO3s=; b=j0cHyeokrvGSdSOMVvUffbMZ1PNzlDlia9sNhuaqCCffwEs4uuUPeA4tln6yQKf5UU TwEPXkBYzXuv5OZkVcZOBC//bdZ9WKy0Lg+GeNAwawqAoIZYbC0Q0HSdetImJLx5OiQz OPAHCG1vtpEQ2V7W4jViq4cVJVMcl64ANPvSBq1CyrI9QFNlA837toKKfgOb+9ol4jPj OVArJ3ubVIcqtadb9uoLRXBqOrnQzFoSVvrxt9sJHOuOFvA6OgDkomZ1J+Ixagd4pJsp BPLOhaifK42WxAK6MSYTrzS0QI0L7Qw5Jhu1oI/aENqOqcrAo2YkOq7OqEuH39X+HqMe b/9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=txwRzy7T4FJEAmlc/vFopAVCAIZ4Qfp20yRwWgSyO3s=; b=c2KBLE/BtDra1VcpmEJ4O5V30TiaOSdEDgW/MWjiNvyJwtsoUAMPcyBbA1sGVpMWDB wP1L7ywo0q5eWJ+gkw4AXLxRYbtR0BWLdvVM6s/0CTu/dMlqE1OdwQSvgKjmgRjK9v7m rG0gOdxaAlNNsnWTMt/vc3PEsGGSUakERITLNC8vuCl+OXUY8oG5NOvn+LGMfW65aVwY 0dZYVdfjpe6KCojdsPKoVZJW2BlTZPO1gN5dFx+y41601cD351R9w4FfSfhYhZA07m5C AcJBR3xamMZEEUBFNOWA9UphTQoxS5lpCDyG9ErnMbodZQQouk0ae7mo6yqwnjzdlzwf U6cQ== X-Gm-Message-State: AOAM530z00Dd0bTL3wNp21pB/HsS8rU6tmYguMmOPdtnjiqUK15dF69n TExExY0hzh/LeEzOIPWOQsYjiZkM5Sm+CPJI4tr+rw== X-Received: by 2002:a05:6512:36c5:b0:437:93ad:8725 with SMTP id e5-20020a05651236c500b0043793ad8725mr457794lfs.645.1645637042994; Wed, 23 Feb 2022 09:24:02 -0800 (PST) MIME-Version: 1.0 References: <20220215164639.GC8458@willie-the-truck> In-Reply-To: From: Vincent Guittot Date: Wed, 23 Feb 2022 18:23:51 +0100 Message-ID: Subject: Re: [PATCH] arm64: smp: Skip MC domain for SoCs without shared cache To: Darren Hart Cc: Will Deacon , "Song Bao Hua (Barry Song)" , LKML , Linux Arm , Catalin Marinas , Peter Zijlstra , Valentin Schneider , "D . Scott Phillips" , Ilkka Koskinen , "stable@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 Feb 2022 at 17:39, Darren Hart wrote: > > On Wed, Feb 23, 2022 at 09:19:17AM +0100, Vincent Guittot wrote: > > ... > > > > > AFAICT, this CLUSTER level is only supported by ACPI. In > > > > parse_acpi_topology() you should be able to know if cluster level is > > > > above or below the level returned by acpi_find_last_cache_level() and > > > > set the correct topology table accordingly > > > > > > > > > > Thanks Vincent, > > > > > > This made sense as a place to start to me. The more I dug into the ACPI PPTT > > > code, I kept running into conflicts with the API which would require extending > > > it in ways that seems contrary to its intent. e.g. the exposed API uses Kernel > > > logical CPUs rather than the topology ids (needed for working with processor > > > containers). The cpu_topology masks haven't been populated yet, and > > > acpi_find_last_cache_level is decoupled from the CPU topology level. So what > > > we're really testing for is if the cluster cpumask is a subset of the coregroup > > > cpumask or not, and it made the most sense to me to keep that in smp.c after the > > > cpumasks have been updated and stored. > > > > I'm not sure why you want to compare cpumask when you can directly > > compare topology level which is exactly what we are looking for in > > order to correctly order the scheduler topology. I was expecting > > something like the below to be enough. acpi_find_cluster_level() needs > > to be created and should be similar to > > find_acpi_cpu_topology_cluster() but return level instead of id. The > > main advantage is that everything is contained in topology.c which > > makes sense as we are playing with topology > > Hi Vincent, > > This was my thinking as well before I dug into the acpi pptt interfaces. > > The cpu topology levels and the cache levels are independent and assuming I've > not misunderstood the implementation, acpi_find_cache_level() returns the > highest *cache* level described in the PPTT for a given CPU. > > For the Ampere Altra, for example: > > CPU Topo 1 System > Level 2 Package > | 3 Cluster > | 4 Processor --- L1 I Cache \____ L2 U Cache -x > \/ --- L1 D Cache / > > 4 Processor --- L1 I Cache \____ L2 U Cache -x > --- L1 D Cache / > > Cache Level ----> 1 2 > > acpi_find_cache_level() returns "2" for any logical cpu, but this doesn't tell > us anything about the CPU topology level across which this cache is shared. yeah, I have wrongly assumed that we can directly compare cache level with cluster level because find_acpi_cpu_cache_topology() returns a cpu node id but find_acpi_cpu_cache_topology walks the cpu topo to find the cpu node which maps the cache level. This means that we would have to walk the cpu topology until we find either cluster node id or cache node id to know which one belongs to the other > > This is what drove me out of topology.c and up into smp.c after the various > topologies are populated and comparing masks. I'll spend a bit more time before > sending a cpumask implementation to see if there is a better point to do this > where the cpu topology level with shared cache is more readily available. > > > > > diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c > > index 9ab78ad826e2..4dac0491b7e3 100644 > > --- a/arch/arm64/kernel/topology.c > > +++ b/arch/arm64/kernel/topology.c > > @@ -84,6 +84,7 @@ static bool __init acpi_cpu_is_threaded(int cpu) > > int __init parse_acpi_topology(void) > > { > > int cpu, topology_id; > > + bool default_cluster_topology = true; > > > > if (acpi_disabled) > > return 0; > > @@ -119,8 +120,16 @@ int __init parse_acpi_topology(void) > > if (cache_id > 0) > > cpu_topology[cpu].llc_id = cache_id; > > } > > + > > + if (default_cluster_topology && > > + (i < acpi_find_cluster_level(cpu))) { > > Per above, from what I understand, this is comparing cpu topology levels with > cache levels, which are independent from each other. > > > + default_cluster_topology = false; > > + } > > } > > > > + if (!default_cluster_topology) > > + set_sched_topology(arm64_no_mc_topology); > > + > > return 0; > > } > > Thanks, > > -- > Darren Hart > Ampere Computing / OS and Kernel