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 EEA62C77B7C for ; Sat, 27 May 2023 07:23:29 +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=4LriqlFwwh0cMdoaN8SZd1zLe9woD+KyqFuLxzEE99c=; b=USQ1hFzKq0dBhb yWllojMtYijTXYxg0V5gfIOV9hLWWGJ82s/aRvaunqE/i2Qb3M5eTZ73AzrrlJb6tqv10TXHaicM2 /PuJgm6B/lN/OlprAkMLDODP3O7ETCLYknf5fRcy2LRSOncZ9+5ZnR5ZoZ0aE2HAM+wGGsvqncGLf qCtqhZDgRxUIvXSf9e4wJexm0Ha50+acJsHi9cTMG0JLMGHx0kD/wtDvsyAHopXdZ1LAabP2QpGTo bjOE2WDsdtXeajGfuPEQYlb6KSBBb4hAKo8lW0/6CzNlU3rbv91+KsrVctOM0CKDniw2YijfshB25 efPVync/lvm9Erm9v2Pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q2oGM-0057Gf-0B; Sat, 27 May 2023 07:22:54 +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 1q2oGF-0057Ae-27 for linux-arm-kernel@lists.infradead.org; Sat, 27 May 2023 07:22:49 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5654c7f991bso38098517b3.3 for ; Sat, 27 May 2023 00:22:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685172167; x=1687764167; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=sTjkcSrIthqBGUF6JyF++nlWwrpLfc1jVqkJtlkt6PQ=; b=vkjgchpoH1XPedYIO6/vqF6XE45h/j6eAlFw9kO2YrsTfetys0yIqgYnaYGjje04b5 UwmnJj+BTaYBeWo/k9KnBbMQp/uHUkF2mxlieD1NpTK6lkq/TNvCF9K6uMh14yp6FqF5 7sKN1m8k/ZuqlnMfWC1kW0zjDazuJKoaawuPxxR4RGIM1o75Q458EI2HwPtuXFGq5r40 +meevMGdIBn1ybeDSbALYZ2S2WGHwqheC1Ld9msieGFdT20QVYzIuZGkYwg5XPDypoxk 7V3b4m1qXojw6WKgdgV5oILZ+DV7b2gRO6Mr2tmbY5y+mZYh6Hn9oZ/0mTsNdjKD9DRS Sjbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685172167; x=1687764167; 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=sTjkcSrIthqBGUF6JyF++nlWwrpLfc1jVqkJtlkt6PQ=; b=J43QFMGZ7c4eniu94mqs1dLx0HRS06prPdNJ4aWJwowVKZUXqpeof9j4Am/AVgmBcD 8OsmEekgaIobJRNLyMD+iQNubyp/U71A43E4VZWbf8UGMQDMzilv+YCWkk5Rr12csCSu G6eVOFCPF3cNa3hDkmBPQGt9vZepOie9FrC4Vdf9CPOfJteAk5ps0OMTTIJDdBOHw0PO eUZ7BgKi/Yo1VJXmyWInqhZnk/5/UeOZYwO4mg1O97tQk7p0Faw6zsMVBZNRi82Ue4nZ B0MIzRg7pK1fmCqGiRNh5SkUdM5tmxB0hCEWygkIHy/O8KHjcVQ1e8/ofTDKIv9rEYsT JLFA== X-Gm-Message-State: AC+VfDwYIb3W4YljfcH1RslP0ejvLHZB+AoYkw1YbH1r0hEXzyqyG4i9 rRWKRdiDOD26MhwWDHaPHkZrGhoExAw4 X-Google-Smtp-Source: ACHHUZ64hXEe1Ke8DjqNWXMRsC15N8MX9tNVXda0lKECLIb7tEG39y0EQBt9RQD2u66EgzLH4R+0A9dG6tp/ X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:3b4e:312c:644:a642]) (user=irogers job=sendgmr) by 2002:a05:690c:727:b0:565:a43e:23c7 with SMTP id bt7-20020a05690c072700b00565a43e23c7mr2467918ywb.0.1685172166863; Sat, 27 May 2023 00:22:46 -0700 (PDT) Date: Sat, 27 May 2023 00:21:42 -0700 In-Reply-To: <20230527072210.2900565-1-irogers@google.com> Message-Id: <20230527072210.2900565-7-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 06/34] perf evsel: Add is_pmu_core inorder to interpret own_cpus 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_002247_690565_A270C62A X-CRM114-Status: GOOD ( 17.58 ) 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 The behaviour of handling cpu maps varies for core and other PMUs. For core PMUs the cpu map lists all valid CPUs, whereas for other PMUs the map is the default CPU. Add a flag in the evsel to indicate if a PMU is core to help with later interpreting of the cpu maps and populate it when the evsel is created during parsing. When propagating cpu maps, core PMUs should intersect the cpu map of the PMU with the user requested one. Signed-off-by: Ian Rogers Reviewed-by: Kan Liang --- tools/lib/perf/include/internal/evsel.h | 9 +++++++++ tools/perf/util/evsel.c | 1 + tools/perf/util/parse-events.c | 1 + 3 files changed, 11 insertions(+) diff --git a/tools/lib/perf/include/internal/evsel.h b/tools/lib/perf/include/internal/evsel.h index a99a75d9e78f..4d6f2a032f45 100644 --- a/tools/lib/perf/include/internal/evsel.h +++ b/tools/lib/perf/include/internal/evsel.h @@ -41,7 +41,14 @@ struct perf_sample_id { struct perf_evsel { struct list_head node; struct perf_event_attr attr; + /** The commonly used cpu map of CPUs the event should be opened upon, etc. */ struct perf_cpu_map *cpus; + /** + * The cpu map read from the PMU. For core PMUs this is the list of all + * CPUs the event can be opened upon. For other PMUs this is the default + * cpu map for opening the event on, for example, the first CPU on a + * socket for an uncore event. + */ struct perf_cpu_map *own_cpus; struct perf_thread_map *threads; struct xyarray *fd; @@ -65,6 +72,8 @@ struct perf_evsel { * i.e. it cannot be the 'any CPU' value of -1. */ bool requires_cpu; + /** Is the PMU for the event a core one? Effects the handling of own_cpus. */ + bool is_pmu_core; int idx; }; diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 2f5910b31fa9..8c8f371ea2b5 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -415,6 +415,7 @@ struct evsel *evsel__clone(struct evsel *orig) evsel->core.nr_members = orig->core.nr_members; evsel->core.system_wide = orig->core.system_wide; evsel->core.requires_cpu = orig->core.requires_cpu; + evsel->core.is_pmu_core = orig->core.is_pmu_core; if (orig->name) { evsel->name = strdup(orig->name); diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index b93264f8a37c..1a0be395c887 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -260,6 +260,7 @@ __add_event(struct list_head *list, int *idx, evsel->core.cpus = cpus; evsel->core.own_cpus = perf_cpu_map__get(cpus); evsel->core.requires_cpu = pmu ? pmu->is_uncore : false; + evsel->core.is_pmu_core = pmu ? pmu->is_core : false; evsel->auto_merge_stats = auto_merge_stats; evsel->pmu = pmu; evsel->pmu_name = pmu && pmu->name ? strdup(pmu->name) : NULL; -- 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