mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@linaro.org>,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, "Liang,
	Kan" <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@arm.com>
Subject: [PATCH v1 8/9] perf intel-pt: Remove the 'pmu_type' field
Date: Tue,  6 Aug 2024 21:41:29 +0100	[thread overview]
Message-ID: <20240806204130.720977-9-leo.yan@arm.com> (raw)
In-Reply-To: <20240806204130.720977-1-leo.yan@arm.com>

Use the evsel__is_aux_event() function to detect the enabled AUX events.
The 'pmu_type' field is not used, remove it.

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/perf/util/intel-pt.c | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 1608d0e38679..69b664059c2d 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -84,7 +84,6 @@ struct intel_pt {
 	unsigned int br_stack_sz;
 	unsigned int br_stack_sz_plus;
 	int have_sched_switch;
-	u32 pmu_type;
 	u64 kernel_start;
 	u64 switch_ip;
 	u64 ptss_ip;
@@ -1020,10 +1019,11 @@ static bool intel_pt_pgd_ip(uint64_t ip, void *data)
 	return __intel_pt_pgd_ip(ip, data) > 0;
 }
 
-static bool intel_pt_get_config(struct intel_pt *pt,
-				struct perf_event_attr *attr, u64 *config)
+static bool intel_pt_get_config(struct evsel *evsel, u64 *config)
 {
-	if (attr->type == pt->pmu_type) {
+	struct perf_event_attr *attr = &evsel->core.attr;
+
+	if (evsel__is_aux_event(evsel)) {
 		if (config)
 			*config = attr->config;
 		return true;
@@ -1037,7 +1037,7 @@ static bool intel_pt_exclude_kernel(struct intel_pt *pt)
 	struct evsel *evsel;
 
 	evlist__for_each_entry(pt->session->evlist, evsel) {
-		if (intel_pt_get_config(pt, &evsel->core.attr, NULL) &&
+		if (intel_pt_get_config(evsel, NULL) &&
 		    !evsel->core.attr.exclude_kernel)
 			return false;
 	}
@@ -1053,7 +1053,7 @@ static bool intel_pt_return_compression(struct intel_pt *pt)
 		return true;
 
 	evlist__for_each_entry(pt->session->evlist, evsel) {
-		if (intel_pt_get_config(pt, &evsel->core.attr, &config) &&
+		if (intel_pt_get_config(evsel, &config) &&
 		    (config & pt->noretcomp_bit))
 			return false;
 	}
@@ -1066,7 +1066,7 @@ static bool intel_pt_branch_enable(struct intel_pt *pt)
 	u64 config;
 
 	evlist__for_each_entry(pt->session->evlist, evsel) {
-		if (intel_pt_get_config(pt, &evsel->core.attr, &config) &&
+		if (intel_pt_get_config(evsel, &config) &&
 		    (config & INTEL_PT_CFG_PASS_THRU) &&
 		    !(config & INTEL_PT_CFG_BRANCH_EN))
 			return false;
@@ -1080,7 +1080,7 @@ static bool intel_pt_disabled_tnt(struct intel_pt *pt)
 	u64 config;
 
 	evlist__for_each_entry(pt->session->evlist, evsel) {
-		if (intel_pt_get_config(pt, &evsel->core.attr, &config) &&
+		if (intel_pt_get_config(evsel, &config) &&
 		    config & INTEL_PT_CFG_TNT_DIS)
 			return true;
 	}
@@ -1100,7 +1100,7 @@ static unsigned int intel_pt_mtc_period(struct intel_pt *pt)
 		config >>= 1;
 
 	evlist__for_each_entry(pt->session->evlist, evsel) {
-		if (intel_pt_get_config(pt, &evsel->core.attr, &config))
+		if (intel_pt_get_config(evsel, &config))
 			return (config & pt->mtc_freq_bits) >> shift;
 	}
 	return 0;
@@ -1118,7 +1118,7 @@ static bool intel_pt_timeless_decoding(struct intel_pt *pt)
 	evlist__for_each_entry(pt->session->evlist, evsel) {
 		if (!(evsel->core.attr.sample_type & PERF_SAMPLE_TIME))
 			return true;
-		if (intel_pt_get_config(pt, &evsel->core.attr, &config)) {
+		if (intel_pt_get_config(evsel, &config)) {
 			if (config & pt->tsc_bit)
 				timeless_decoding = false;
 			else
@@ -1133,7 +1133,7 @@ static bool intel_pt_tracing_kernel(struct intel_pt *pt)
 	struct evsel *evsel;
 
 	evlist__for_each_entry(pt->session->evlist, evsel) {
-		if (intel_pt_get_config(pt, &evsel->core.attr, NULL) &&
+		if (intel_pt_get_config(evsel, NULL) &&
 		    !evsel->core.attr.exclude_kernel)
 			return true;
 	}
@@ -1150,7 +1150,7 @@ static bool intel_pt_have_tsc(struct intel_pt *pt)
 		return false;
 
 	evlist__for_each_entry(pt->session->evlist, evsel) {
-		if (intel_pt_get_config(pt, &evsel->core.attr, &config)) {
+		if (intel_pt_get_config(evsel, &config)) {
 			if (config & pt->tsc_bit)
 				have_tsc = true;
 			else
@@ -1166,7 +1166,7 @@ static bool intel_pt_have_mtc(struct intel_pt *pt)
 	u64 config;
 
 	evlist__for_each_entry(pt->session->evlist, evsel) {
-		if (intel_pt_get_config(pt, &evsel->core.attr, &config) &&
+		if (intel_pt_get_config(evsel, &config) &&
 		    (config & pt->mtc_bit))
 			return true;
 	}
@@ -1191,7 +1191,7 @@ static u64 intel_pt_ctl(struct intel_pt *pt)
 	u64 config;
 
 	evlist__for_each_entry(pt->session->evlist, evsel) {
-		if (intel_pt_get_config(pt, &evsel->core.attr, &config))
+		if (intel_pt_get_config(evsel, &config))
 			return config;
 	}
 	return 0;
@@ -3703,13 +3703,12 @@ static void intel_pt_set_event_name(struct evlist *evlist, u64 id,
 	}
 }
 
-static struct evsel *intel_pt_evsel(struct intel_pt *pt,
-					 struct evlist *evlist)
+static struct evsel *intel_pt_evsel(struct evlist *evlist)
 {
 	struct evsel *evsel;
 
 	evlist__for_each_entry(evlist, evsel) {
-		if (evsel->core.attr.type == pt->pmu_type && evsel->core.ids)
+		if (evsel__is_aux_event(evsel) && evsel->core.ids)
 			return evsel;
 	}
 
@@ -3720,7 +3719,7 @@ static int intel_pt_synth_events(struct intel_pt *pt,
 				 struct perf_session *session)
 {
 	struct evlist *evlist = session->evlist;
-	struct evsel *evsel = intel_pt_evsel(pt, evlist);
+	struct evsel *evsel = intel_pt_evsel(evlist);
 	struct perf_event_attr attr;
 	u64 id;
 	int err;
@@ -4219,7 +4218,6 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
 	pt->session = session;
 	pt->machine = &session->machines.host; /* No kvm support */
 	pt->auxtrace_type = auxtrace_info->type;
-	pt->pmu_type = auxtrace_info->priv[INTEL_PT_PMU_TYPE];
 	pt->tc.time_shift = auxtrace_info->priv[INTEL_PT_TIME_SHIFT];
 	pt->tc.time_mult = auxtrace_info->priv[INTEL_PT_TIME_MULT];
 	pt->tc.time_zero = auxtrace_info->priv[INTEL_PT_TIME_ZERO];
-- 
2.34.1


  parent reply	other threads:[~2024-08-06 20:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 20:41 [PATCH v1 0/9] perf auxtrace: Refactor with evsel__is_aux_event() Leo Yan
2024-08-06 20:41 ` [PATCH v1 1/9] perf auxtrace: Use evsel__is_aux_event() for checking AUX event Leo Yan
2024-08-09  7:55   ` Adrian Hunter
2024-08-06 20:41 ` [PATCH v1 2/9] perf auxtrace: Remove unused 'pmu' pointer from struct auxtrace_record Leo Yan
2024-08-09  8:02   ` Adrian Hunter
2024-08-28 21:16     ` Arnaldo Carvalho de Melo
2024-08-30  7:32       ` Leo Yan
2024-08-06 20:41 ` [PATCH v1 3/9] perf auxtrace: Refactor auxtrace__evsel_is_auxtrace() Leo Yan
2024-08-08 12:58   ` Adrian Hunter
2024-08-09 10:08     ` James Clark
2024-08-09 10:57       ` Leo Yan
2024-08-06 20:41 ` [PATCH v1 4/9] perf arm-spe: Remove the 'pmu_type' field Leo Yan
2024-08-06 20:41 ` [PATCH v1 5/9] perf cs-etm: " Leo Yan
2024-08-06 20:41 ` [PATCH v1 6/9] perf hisi-ptt: Remove the unused " Leo Yan
2024-08-06 20:41 ` [PATCH v1 7/9] perf intel-bts: Remove the " Leo Yan
2024-08-06 20:41 ` Leo Yan [this message]
2024-08-06 20:41 ` [PATCH v1 9/9] perf s390-cpumsf: Remove the unused " Leo Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240806204130.720977-9-leo.yan@arm.com \
    --to=leo.yan@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@linaro.org \
    --cc=namhyung@kernel.org \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®