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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3B9FC7EE2E for ; Wed, 24 May 2023 22:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237399AbjEXWTS (ORCPT ); Wed, 24 May 2023 18:19:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236996AbjEXWS6 (ORCPT ); Wed, 24 May 2023 18:18:58 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECC1A1BB for ; Wed, 24 May 2023 15:18:51 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-ba8bab3b392so822897276.1 for ; Wed, 24 May 2023 15:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684966731; x=1687558731; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=c2Fu8Hh2fRZjS6aZytO0Djl8Sie1Qlvn6RQorz5XdqQ=; b=Ev8OlsiXMdtu6FlOgdizkae87AqhWPM7LWi4Pz2YIJ9tsGVdgoW7Efn6yopiotMOXY /RzHMjyEcpMqh8gdAZoPRjXZ6DK/qlv1VuVe7isIGvvOybJCxWYpVXWkuT0FBTT52PEb x/nSvvHn9yhkumGCzrbVeGiuUQkTEcPjobeCv3i94Do/b5elK/+xAjXTZZNXH21uCVcU ginf8tZxLhE6DEWNa218qJT2oxUW+8GRyaMXpm0049KDScJYYQ577V76F5+IfOB80Bxh FTYnYBNxSKwNI+gj8ZnDRrLXuYoxoPnWrBLCVt13zTbkZIJWqRNV5S7FN8BKH5WFOlRR xnKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684966731; x=1687558731; 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=c2Fu8Hh2fRZjS6aZytO0Djl8Sie1Qlvn6RQorz5XdqQ=; b=AN0QuEMONcVR5b2xNf6BJkOQUIb+H7UpSn06PIkuVCk1CFCBUKV/qB1QQUJcx32ssc MqpitaOICj8ganojoGDCms/tA4PAQ6DdIYIiK5VUks7QQVmw1ctQZZWV2T1VYeZXJz6h da9VHxQ0u7ZjmoogYQQIgI90O8GSVO7I720mCC++MBmYYe72yPhulaUSOphSJXQjXQin gf27ThAvROjseNRGCU15F5yA3hFIHZIGgjwS0qGST85NCf2tvn6FT5eKBWlqpCqeM8uC DqiU6Epnit4ex3Sr4wiunt0s6jvuyFa6wztcjOiT5Yj2jIEjbPYQp0/5toQAuLwY/C7X 7VJg== X-Gm-Message-State: AC+VfDyprmpryDtNGg3KWAvM39H7BKyCGK74klWy4UqtqcFBjdEaPviO gNCriwedjdek+mvezkGKwLqBU4bGKf9x X-Google-Smtp-Source: ACHHUZ7+88/7aU7x/bNjqJ77lAS3J/2553bHTBYqqnN3uD2LBkSyMbYgzljU/D8Sr5q/j4OyZ/8PyKJam29X X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:7aa7:3d2d:76ae:8e96]) (user=irogers job=sendgmr) by 2002:a25:6612:0:b0:b94:6989:7fa6 with SMTP id a18-20020a256612000000b00b9469897fa6mr569267ybc.4.1684966731195; Wed, 24 May 2023 15:18:51 -0700 (PDT) Date: Wed, 24 May 2023 15:18:03 -0700 In-Reply-To: <20230524221831.1741381-1-irogers@google.com> Message-Id: <20230524221831.1741381-8-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 07/35] 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.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 --- 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.40.1.698.g37aff9b760-goog 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 1D0A8C77B73 for ; Wed, 24 May 2023 22:41:24 +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=9l1hOxqwF/+g1Ju4L83r+hLQDhH3JQZhYEUK4Cq4vYM=; b=yBuMCeruCLvFdU jhWif5t4vhH8VH7KiU+NEzwARuaWF1CT9eFR5ODn2Gg2zjHAntYS6L8i3mGCnF9YzKIwlEBG45579 xjALwcb0oeq4yc4Qr0brCl86WcMguiQptUn9P/Jdw7s82RWYEbsw5PJ1rPsucC1pprtHaBc5Z5F3m MqkV64WsrQocIeO+3KlOU0LlYWwWZiZbafomu/3akCfGsr90xh1vaNuDlJ3xzZkuSIvgpgW4+usqW VS7oiaRY8kVPme506f4dtDAElL75TtOlP3ghlQLjqGz+WtSYkjg55g5t93qXw/59xeRNnjBPEq4D+ t6OMSDKBVcTpPH0J7OmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1xA9-00EpGI-0x; Wed, 24 May 2023 22:40:57 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1xA1-00EpCx-0K for linux-arm-kernel@bombadil.infradead.org; Wed, 24 May 2023 22:40:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=c2Fu8Hh2fRZjS6aZytO0Djl8Sie1Qlvn6RQorz5XdqQ=; b=GqpfW8rIpUKANe/o3J4aFxiLtM se3/Q5WKdqX7pQ2B9RlkSZiXUfCTGRzn4Cw53kidSRHEz+re3HMatfKMnfF5lMnE2vM0hestaLMsE Zc2rnELIPBsT0lLs4WBBj/7MY9zYz9nkWOJSL7ss0YZ9rJ8toWZV45gmZa45rDfoJKSgKYiJUAr7n i9YkaFCeFZ0CLBTHd6JYfxL/2XTB59JgQohLIbe8xLs33+8UGSYvNxA4gi5J/5StHZACIkZSw4lZA OR58Xs3cvuZmXBjs4nUlVZW1FlLz8NH7SjK5p39zsGd+IBWEDqwGnRstJQ/V4HB0GcOGHtsv/WcSy fzCYUbQw==; Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1wor-0056c8-2g for linux-arm-kernel@lists.infradead.org; Wed, 24 May 2023 22:19:00 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-ba8337a5861so874490276.0 for ; Wed, 24 May 2023 15:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684966731; x=1687558731; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=c2Fu8Hh2fRZjS6aZytO0Djl8Sie1Qlvn6RQorz5XdqQ=; b=Ev8OlsiXMdtu6FlOgdizkae87AqhWPM7LWi4Pz2YIJ9tsGVdgoW7Efn6yopiotMOXY /RzHMjyEcpMqh8gdAZoPRjXZ6DK/qlv1VuVe7isIGvvOybJCxWYpVXWkuT0FBTT52PEb x/nSvvHn9yhkumGCzrbVeGiuUQkTEcPjobeCv3i94Do/b5elK/+xAjXTZZNXH21uCVcU ginf8tZxLhE6DEWNa218qJT2oxUW+8GRyaMXpm0049KDScJYYQ577V76F5+IfOB80Bxh FTYnYBNxSKwNI+gj8ZnDRrLXuYoxoPnWrBLCVt13zTbkZIJWqRNV5S7FN8BKH5WFOlRR xnKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684966731; x=1687558731; 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=c2Fu8Hh2fRZjS6aZytO0Djl8Sie1Qlvn6RQorz5XdqQ=; b=f7fqObpqPqyGtwa0KkhNygDQOdPRj2KpjvRNn5FRb/qRO9IrgpFmJUsszSSK5kipV9 Gpkw0wPEM9OPCNcqjtzPQWWOz9N44c9kr7gM0+0LKrREkLdfkFuC5vzuEw0cXu5RvCvz 31YtFh08jYl0jrVzOZsOrH1XavME4d+/SKQ3X3R61eMWFehpClJ17SUYzTDntKqyHpe7 ZprZ7f6+vVbCXl7u2M72xXOAzIjsEwhksr2PtLwc+Conyos6zd56q1zSB3L6VnzW5aEs kSqK9llKWeLkEYfItMeYSP51ze2AujJrb7X4UjJxPo0CLemNMciPv5SvQSOCJN0vMzi4 8bMQ== X-Gm-Message-State: AC+VfDwLnCHj7ejaohrbrfJoJA17R7jLfddc7J6FR+BTWOvpojh2CnBC z82eYZmEY3IrdDzioXZKUKB2KV9BbP2h X-Google-Smtp-Source: ACHHUZ7+88/7aU7x/bNjqJ77lAS3J/2553bHTBYqqnN3uD2LBkSyMbYgzljU/D8Sr5q/j4OyZ/8PyKJam29X X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:7aa7:3d2d:76ae:8e96]) (user=irogers job=sendgmr) by 2002:a25:6612:0:b0:b94:6989:7fa6 with SMTP id a18-20020a256612000000b00b9469897fa6mr569267ybc.4.1684966731195; Wed, 24 May 2023 15:18:51 -0700 (PDT) Date: Wed, 24 May 2023 15:18:03 -0700 In-Reply-To: <20230524221831.1741381-1-irogers@google.com> Message-Id: <20230524221831.1741381-8-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 07/35] 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-20230524_231858_613780_9AAC5F25 X-CRM114-Status: GOOD ( 18.43 ) 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 --- 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.40.1.698.g37aff9b760-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel