From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 379B5C7EE23 for ; Sat, 27 May 2023 07:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qkT6Co0r/9ht22DVGqiBy3JRlFeWBz1Ca/xIHKBNwL8=; b=j9DflUgLIn2eZj 9/pooK5iQ+FyUpgOPKxGt1MZDXGc5fmshhtsMiQl/cDoZ+oXml+zihtluahxZKdC/O/Ueb173hUmT dYdubh7ngfb4H1OX1VZx5XuYkQxUQEk9DSPv2PodQaAkgDgR6gsnxFa0BF336cI1JIFVc9BC1KRYv X5EFXCsapLrdepeBLHgq6GmN2xBjocMrVHhh8tKFMQz6Qd/IAwun7I6H+CAExrvylsZoM7T1Kd1Cq VTSQ8ZKOnNd/zk0alL4v8oyZ7YZzDnjjKeaVSQtGvtBzWY/NYK4vhCFawQasQdsUAQTMzRzxU5HNB lLQpPxW2YKVdM7M96neA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q2oGL-0057FA-07; Sat, 27 May 2023 07:22:53 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q2oGD-0057Ae-2G for linux-arm-kernel@lists.infradead.org; Sat, 27 May 2023 07:22:46 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5654c7f991bso38098167b3.3 for ; Sat, 27 May 2023 00:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685172164; x=1687764164; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=5JqGxN6yla1ONavwrAlpvOZ5bTLHXY2jrhduxUQXwek=; b=s/qCJoYFmMD1q/Q/HnpP2+mVHztV8rIdHJlEfQG23+bSKKxmAJr8TWYT7RWK6LZQ7N fUs9fVGRajBzk9hxiKddk3DERSx8HfkpKvbvQStOZbWhQvVT8L1iRhOBYbBYh/cYNFvd XCabo4Cl9jznBKvV8bLtoJzutyboRQxTsbJpu5VRk8dOoT9DHwfoQ/IKk+5g2dHkEd/n z1ygWVL+tyLM+8/3V2gDo+/dLIVTZJ1pJHp7UixecmaIoX/LHlaZcXWmSOd1hXPVIcdC hekdyKAVNBbqDhrvYSu2rxmBveJ9hJ7dcShdjuoOmC5knTuhC4OBxt+wnf9Xt2GW/7tu t19w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685172164; x=1687764164; 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=5JqGxN6yla1ONavwrAlpvOZ5bTLHXY2jrhduxUQXwek=; b=CwpEEvm66CE3YUQxJpUBMRb6eOuVd9YM5bdRLzkzmR3CXjoMYIoIqCkSgDOm8wLzTG aNjabUWn2FEvLEhwLa0bIu8MPCTJANs0gidQihzNhT8uNjm6ohGdcir8AQesLEez4tth u9gofuK7+hhPwHVvmcv+yNsd7nmqPA8CvXAap3F1XwjJlEsPJSOtvp4Icc/Pn53Pn+3o tiPuHsSWFQx11X4NfwQHTkWL9zQal0wLRxlp6klCJNBhnlU7H9vUmfwNFchO1lJ6edt8 8Ztmau931JKh/e81747ZseSCRoLmsDz1MLznAE1vnYx4Vrq5AIL/aP6Loj3H0XuOHcxS c9xw== X-Gm-Message-State: AC+VfDzyL6DBrfGN8TOTI2cGJYcFexyJ0xts645fZ/1HbTx77ePUrvVl 4pB5Nt8BySq1KYLAc1W4CHfyMyxvi0eA X-Google-Smtp-Source: ACHHUZ4mJjHPIFq49krZo/Mrp2SDJhyklikURm+dq2RRzW5z+jhGsfakK3EgvJ8o5xTz3OB9g2HT4s6NZD7z X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:3b4e:312c:644:a642]) (user=irogers job=sendgmr) by 2002:a81:b71e:0:b0:565:d1af:2131 with SMTP id v30-20020a81b71e000000b00565d1af2131mr520683ywh.5.1685172164434; Sat, 27 May 2023 00:22:44 -0700 (PDT) Date: Sat, 27 May 2023 00:21:41 -0700 In-Reply-To: <20230527072210.2900565-1-irogers@google.com> Message-Id: <20230527072210.2900565-6-irogers@google.com> Mime-Version: 1.0 References: <20230527072210.2900565-1-irogers@google.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Subject: [PATCH v5 05/34] perf pmu: Add is_core to pmu 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230527_002245_735585_E2898602 X-CRM114-Status: GOOD ( 14.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Cache is_pmu_core in the pmu to avoid recomputation. Signed-off-by: Ian Rogers Reviewed-by: Kan Liang --- tools/perf/util/pmu.c | 7 ++++--- tools/perf/util/pmu.h | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 7392cec725bf..e8c0762c311a 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -952,6 +952,7 @@ static struct perf_pmu *pmu_lookup(int dirfd, const char *lookup_name) } pmu->type = type; + pmu->is_core = is_pmu_core(name); pmu->is_uncore = pmu_is_uncore(dirfd, name); if (pmu->is_uncore) pmu->id = pmu_id(name); @@ -1659,12 +1660,12 @@ bool is_pmu_hybrid(const char *name) bool perf_pmu__supports_legacy_cache(const struct perf_pmu *pmu) { - return is_pmu_core(pmu->name); + return pmu->is_core; } bool perf_pmu__supports_wildcard_numeric(const struct perf_pmu *pmu) { - return is_pmu_core(pmu->name); + return pmu->is_core; } bool perf_pmu__auto_merge_stats(const struct perf_pmu *pmu) @@ -1723,7 +1724,7 @@ void print_pmu_events(const struct print_callbacks *print_cb, void *print_state) pmu = NULL; j = 0; while ((pmu = perf_pmu__scan(pmu)) != NULL) { - bool is_cpu = is_pmu_core(pmu->name); + bool is_cpu = pmu->is_core; list_for_each_entry(event, &pmu->aliases, list) { aliases[j].event = event; diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index f50919f1b34c..96236a79c6fd 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -59,6 +59,13 @@ struct perf_pmu { * @selectable: Can the PMU name be selected as if it were an event? */ bool selectable; + /** + * @is_core: Is the PMU the core CPU PMU? Determined by the name being + * "cpu" or by the presence of + * /bus/event_source/devices//cpus. There may be >1 core + * PMU on systems like Intel hybrid. + */ + bool is_core; /** * @is_uncore: Is the PMU not within the CPU core? Determined by the * presence of /bus/event_source/devices//cpumask. -- 2.41.0.rc0.172.g3f132b7071-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel