Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp148944rwd; Wed, 24 May 2023 15:46:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Bf6KXHHQcYVFW+kOYm9beQN7i8nT5lzKr2hIQZnWJwDirCNZhKWskNHDd5kk84R3wD8Zd X-Received: by 2002:a17:90a:eac8:b0:253:3975:7a37 with SMTP id ev8-20020a17090aeac800b0025339757a37mr867482pjb.9.1684968364387; Wed, 24 May 2023 15:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684968364; cv=none; d=google.com; s=arc-20160816; b=m61MOCf7kjspRb+gbrO0KMu4KPRBxLzpo2Z3Na0zVTqTOOOPyiB72fl5D5Qu6wiUJ1 jntE0No6v4x783Qlv6PsdAqdRCkuaoe3odrwg8IfC2WFLEWAW+V570by/3giZZyyHhIW HINP80dL6qub9sTUC2WOuN/JBaTcYwP91aFxN+kOxZ/bYXZ67ffAE8dVhn/89HEIZpjw Gq2YEo6D7GhJ1QiJQ9E+bX0YqbIv1/0DGkr41plmCC3218TX8rjtbg9HfyuYTfocGoj1 Aj5INmMDd1eHnNwua5GeDklKJAVqz5LeHYa1TYqdYZRs5MO3cOohhqbvmetGaJIRLjk0 NxAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=/eS5iHSDHpFh4XdVaHBCbrVny8PCbF73cyIUIzaUWEw=; b=hnn5DjDrHK4vGSD+U/wMcmlLTwQD16+ED/3gTvr+OnI6ElhvFJDWJAA6ZlAPvBGewx z3Jecki+XWMUwlAkitlq7UUO5NYCEE+naImFi0N7iBtd2/9ahU4tvQkUJx5W0NAjkoAa gDLt1WFOPFzTfNBnPXt4MltwLTKgqcT3CJDx1gX1R61/y9LircWdQ5dAont/JA02W7YZ YOz3Oxqt8BN3hwVOyATdGjkBv1QhhFfUZdNuO6ZuP4mnT27PlpQ04rGCn3pMy6C60bNo 0Z4EP7PqstpaxVqSsJV37Uz3+pNr/TaTr/S9xuNRN65PRR1jycndBMXFtRh9HjfHAOWa xRZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="NOCz+nx/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b30-20020a63931e000000b005348f910e65si1604279pge.824.2023.05.24.15.45.51; Wed, 24 May 2023 15:46:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="NOCz+nx/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234091AbjEXWUc (ORCPT + 99 others); Wed, 24 May 2023 18:20:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236038AbjEXWTs (ORCPT ); Wed, 24 May 2023 18:19:48 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA2BC10D7 for ; Wed, 24 May 2023 15:19:26 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-560ee0df572so29568147b3.0 for ; Wed, 24 May 2023 15:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684966759; x=1687558759; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=/eS5iHSDHpFh4XdVaHBCbrVny8PCbF73cyIUIzaUWEw=; b=NOCz+nx/NdHrPcizU4MdSkA0WBYp0H9Nf+F0NieGY60JSYl6AF2S+CnMb/dlfziqBk SNH4dssbJwRHXcvUoZ75cIaneT6FAyO+RD40b3bYt/ivPRlyaUhPjcWffNE4plZNHk7B 85Pk3dn4eV7+z9VbZe3ftQwYaRLvlEoPyUrJecJI4zZjFdpsXLXrNFLGCCTR8yD47+lw 1lDf48a8NZvNawqoBz8WAQLdrQLFWRHgitHfKcAoqr17q16mRxGZ8JMqhlJB2UzXb7N8 oDKXnLY5ppa/bPZUkg0E5pzMtux5QWv/od7FtU+msEMoASarZrFObKcNTb6XkZJNtm8l F4Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684966759; x=1687558759; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/eS5iHSDHpFh4XdVaHBCbrVny8PCbF73cyIUIzaUWEw=; b=KmvDWtSw5HqFlL2kdmSfxn6cbsQz10cBv1WKU9f3iHlB3Pc+0/DLw4jH9PAQjulFIf UhBobO6QXaHEOVeI89iQRraqPlP72JA7WqkKmlF5Z2Xi0tq3g0AGAV0hddHjapWd+Lgl zuJeAe2a/Ir66WuSCxL8qIUFr7r5ACDq/rBHgds8Ff2HExGZpCzCg7h9tVZgSpqFL6Jr Z0/+WbL6ZVgFLQgg9VHFR6JO6pRkPIFkMeuLdFGczzr7S6LZDg+c5sYrgnW22MSqY9tl 9aY6iSCz/ZZuIh795JdkxfZvcAvx5K3YULe1Qgb9Cyf+ZmntPZMO6B8Si40JhdutPAGN Bi2w== X-Gm-Message-State: AC+VfDy+BVkr7TITfDc1wMULR9YrnWaUaQhOOO9CvN/L++KHZZgMPg+8 39iHZdkKnd7+IEDkKz7F9cm3Ud1uVtii X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:7aa7:3d2d:76ae:8e96]) (user=irogers job=sendgmr) by 2002:a81:de06:0:b0:55d:955b:360 with SMTP id k6-20020a81de06000000b0055d955b0360mr11554971ywj.5.1684966759076; Wed, 24 May 2023 15:19:19 -0700 (PDT) Date: Wed, 24 May 2023 15:18:15 -0700 In-Reply-To: <20230524221831.1741381-1-irogers@google.com> Message-Id: <20230524221831.1741381-20-irogers@google.com> Mime-Version: 1.0 References: <20230524221831.1741381-1-irogers@google.com> X-Mailer: git-send-email 2.40.1.698.g37aff9b760-goog Subject: [PATCH v3 19/35] perf topology: Avoid hybrid list for hybrid topology From: Ian Rogers To: Suzuki K Poulose , Mike Leach , Leo Yan , John Garry , Will Deacon , James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Kajol Jain , Jing Zhang , Kan Liang , Zhengjun Xing , Ravi Bangoria , Madhavan Srinivasan , Athira Rajeev , Ming Wang , Huacai Chen , Sandipan Das , Dmitrii Dolgov <9erthalion6@gmail.com>, Sean Christopherson , Ali Saidi , Rob Herring , Thomas Richter , Kang Minchul , linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham 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 Avoid perf_pmu__for_each_hybrid_pmu in hybrid_topology__new by scanning all PMUs and processing the is_core ones. Add early exit for non-hybrid. Signed-off-by: Ian Rogers --- tools/perf/util/cputopo.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/cputopo.c b/tools/perf/util/cputopo.c index ca1d833a0c26..a5c259bd5cc0 100644 --- a/tools/perf/util/cputopo.c +++ b/tools/perf/util/cputopo.c @@ -12,7 +12,7 @@ #include "cpumap.h" #include "debug.h" #include "env.h" -#include "pmu-hybrid.h" +#include "pmu.h" #define PACKAGE_CPUS_FMT \ "%s/devices/system/cpu/cpu%d/topology/package_cpus_list" @@ -469,11 +469,17 @@ static int load_hybrid_node(struct hybrid_topology_node *node, struct hybrid_topology *hybrid_topology__new(void) { - struct perf_pmu *pmu; + struct perf_pmu *pmu = NULL; struct hybrid_topology *tp = NULL; - u32 nr, i = 0; + u32 nr = 0, i = 0; - nr = perf_pmu__hybrid_pmu_num(); + if (!perf_pmu__has_hybrid()) + return NULL; + + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + if (pmu->is_core) + nr++; + } if (nr == 0) return NULL; @@ -482,7 +488,10 @@ struct hybrid_topology *hybrid_topology__new(void) return NULL; tp->nr = nr; - perf_pmu__for_each_hybrid_pmu(pmu) { + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + if (!pmu->is_core) + continue; + if (load_hybrid_node(&tp->nodes[i], pmu)) { hybrid_topology__delete(tp); return NULL; -- 2.40.1.698.g37aff9b760-goog