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 8F3B7C77B7A for ; Wed, 17 May 2023 16:00:51 +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=odvbOQpSUZEw4Y36R9No0s6Z8+0tfmAQJUZaW75B76s=; b=P0RiYCFV+Re95H pBKzYeSH6SseM1K8OW8E11iVEJS3vtVuPFLAolaYEgRDCIokQHmSNYsk94I7OpsU+F+QF9I18YmQ2 tcaTXdfuS2+StmdiuTriRHmcn1IYnTtLAap+v9ZETq3Gcc/Xu13pR7kUTFJoajKZk6AUh3Wud5G6L U+SSWHftO0mm6QzV+n3pBCnQ70NL7UXRAOLON97P16N1/VW3ezp2B4kOcbBhs0wbOcOQkGOdLsSaI WSr3zXYvKNo7ip3JYP7fB6SVPRkMoiy3G/DU/jtMUCRRa4zy6XNnlItcbxG//v/lGeeeyv8jpfzR0 M+SLB/ZNgzrdFMVzP43Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzJa1-00AOSz-0a; Wed, 17 May 2023 16:00:45 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzIc8-00ADUL-2G for linux-arm-kernel@lists.infradead.org; Wed, 17 May 2023 14:58:54 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-ba8217b3d30so999277276.2 for ; Wed, 17 May 2023 07:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684335531; x=1686927531; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=KA2y3jyQTsl7bjOICY6NhHPKj7ufhNOPyvMqFoPtgZA=; b=nljeFfxFSjqFfJqFStpIFN0yXSLDlIJAsXrvpuUvYrzfgwPDYXCv05IGjt8JAYLOMu GIWqE6phlYNkqkWg1UlvdP9uFzTnCLcKUhhQZhxm0Hpim9t+Z0kHz+ttA/5X72bOa/HG gIXZGSBzf9lnCHE0W2XP4S6w8Sqj0vZ+OnuTQAtK0jDwkc52avQEgxhjfSnwPT8NTkKm ZqGMOALc5jdW8KC/iXGwy2CMR5Xz/bEot5QGTbz3PBAgzvxOa/0U+N4xOxh07EgCnS1a hV4fKa3uvhrgW4ZWmwNZZGwysWZKpw8xHvj6xyvlf+wFUmfwd6vofN5SIYMFcd4Usfu+ 8YBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684335531; x=1686927531; 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=KA2y3jyQTsl7bjOICY6NhHPKj7ufhNOPyvMqFoPtgZA=; b=PIZhOZVyHiJKqg/0jukVsME3TuLniIR953Qhf7ezFrrVmNu2YkOzdrSbJ7Pw7Qdu0G tN698n2NmYNuHeZ2VfmxRUvILRborgSGvRgMWPWHle1Ol6Xc3gPv/xGFis5ywTaze34X /c7swHjQuVQWw5mChSJ/dZOe0adIf7+Poy7n6lWMLOvyYG+izvBxqJ9vdAe4YretZI4u bhzs75WivOzqeHS5WKQgGloPybqYm5lvqVe2HRUSVsc8FsFNgmfLqOUOwVRfT1fZL3cB qRycChBu47tEQbwxMR7PoOEe+UtI6e2ha2gssHVWuBRr2CGM4obL+ZrQ7VReqZiX1gBQ 0cMA== X-Gm-Message-State: AC+VfDxv7iqSdHd7hecYFx/PMIeFfCYR0z3eD4ZTgk4wUCHALfDNWqxk bpoG60TmKsMsdLoKNfUqFkxw20Zclkdh X-Google-Smtp-Source: ACHHUZ7XjP/AcWyCffYYC9nXeJBjM5TS+YMrfsqU5e91nSKBzb1vGFoVNbDb5wbW3KyZZ72fzUAIER8KKBrj X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:628b:7e78:d09b:39b]) (user=irogers job=sendgmr) by 2002:a25:3211:0:b0:ba8:2415:f27c with SMTP id y17-20020a253211000000b00ba82415f27cmr3416215yby.3.1684335531452; Wed, 17 May 2023 07:58:51 -0700 (PDT) Date: Wed, 17 May 2023 07:57:47 -0700 In-Reply-To: <20230517145803.559429-1-irogers@google.com> Message-Id: <20230517145803.559429-8-irogers@google.com> Mime-Version: 1.0 References: <20230517145803.559429-1-irogers@google.com> X-Mailer: git-send-email 2.40.1.606.ga4b1b128d6-goog Subject: [PATCH v1 07/23] 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 , Raul Silvera , 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-20230517_075852_744469_2EF597AF X-CRM114-Status: GOOD ( 14.88 ) 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 --- 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 0fa451c60c77..930ec3786964 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -954,6 +954,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); @@ -1661,12 +1662,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) @@ -1725,7 +1726,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 99e0273027bf..af10d137e2b5 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.40.1.606.ga4b1b128d6-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel