linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: acme@kernel.org
Cc: mike.leach@linaro.org, leo.yan@linaro.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/6] perf cs-etm: Fix bitmap for option
Date: Wed, 24 Feb 2021 09:48:32 -0700	[thread overview]
Message-ID: <20210224164835.3497311-4-mathieu.poirier@linaro.org> (raw)
In-Reply-To: <20210224164835.3497311-1-mathieu.poirier@linaro.org>

From: Suzuki K Poulose <suzuki.poulose@arm.com>

When set option with macros ETM_OPT_CTXTID and ETM_OPT_TS, it wrongly
takes these two values (14 and 28 prespectively) as bit masks, but
actually both are the offset for bits.  But this doesn't lead to
further failure due to the AND logic operation will be always true for
ETM_OPT_CTXTID / ETM_OPT_TS.

This patch uses the BIT() macro for option bits, thus it can request the
correct bitmaps for "contextid" and "timestamp" when calling
cs_etm_set_option().

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
[Extract the change as a separate patch for easier review]
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20210213113220.292229-3-leo.yan@linaro.org
---
 tools/perf/arch/arm/util/cs-etm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index b0470f2a955a..5b2bb7fc5ee1 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -169,17 +169,17 @@ static int cs_etm_set_option(struct auxtrace_record *itr,
 		    !cpu_map__has(online_cpus, i))
 			continue;
 
-		if (option & ETM_OPT_CTXTID) {
+		if (option & BIT(ETM_OPT_CTXTID)) {
 			err = cs_etm_set_context_id(itr, evsel, i);
 			if (err)
 				goto out;
 		}
-		if (option & ETM_OPT_TS) {
+		if (option & BIT(ETM_OPT_TS)) {
 			err = cs_etm_set_timestamp(itr, evsel, i);
 			if (err)
 				goto out;
 		}
-		if (option & ~(ETM_OPT_CTXTID | ETM_OPT_TS))
+		if (option & ~(BIT(ETM_OPT_CTXTID) | BIT(ETM_OPT_TS)))
 			/* Nothing else is currently supported */
 			goto out;
 	}
@@ -406,7 +406,7 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
 		evsel__set_sample_bit(cs_etm_evsel, CPU);
 
 		err = cs_etm_set_option(itr, cs_etm_evsel,
-					ETM_OPT_CTXTID | ETM_OPT_TS);
+					BIT(ETM_OPT_CTXTID) | BIT(ETM_OPT_TS));
 		if (err)
 			goto out;
 	}
-- 
2.25.1


  parent reply	other threads:[~2021-02-24 16:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 16:48 [PATCH 0/6] coresight: Patches for v5.12 (perf tools) Mathieu Poirier
2021-02-24 16:48 ` [PATCH 1/6] perf: cs-etm: update ETM metadata format Mathieu Poirier
2021-02-24 16:48 ` [PATCH 2/6] tools headers UAPI: Update tools' copy of linux/coresight-pmu.h Mathieu Poirier
2021-02-24 16:48 ` Mathieu Poirier [this message]
2021-02-24 16:48 ` [PATCH 4/6] perf cs-etm: Support PID tracing in config Mathieu Poirier
2021-02-24 16:48 ` [PATCH 5/6] perf cs-etm: Add helper cs_etm__get_pid_fmt() Mathieu Poirier
2021-02-24 16:48 ` [PATCH 6/6] perf cs-etm: Detect pid in VMID for kernel running at EL2 Mathieu Poirier
2021-02-24 22:20 ` [PATCH 0/6] coresight: Patches for v5.12 (perf tools) Arnaldo Carvalho de Melo
2021-03-02 12:51 ` Arnaldo Carvalho de Melo
2021-03-02 12:52 ` Arnaldo Carvalho de Melo
2021-03-02 14:23   ` Mike Leach
2021-03-02 16:24     ` Arnaldo Carvalho de Melo
2021-03-02 16:42       ` Mathieu Poirier
2021-03-02 17:02         ` Mike Leach
2021-03-02 17:11           ` Arnaldo Carvalho de Melo
2021-03-03  7:50             ` 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=20210224164835.3497311-4-mathieu.poirier@linaro.org \
    --to=mathieu.poirier@linaro.org \
    --cc=acme@kernel.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).