From: Leo Yan <leo.yan@linaro.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Mike Leach <mike.leach@linaro.org>,
Robert Walker <robert.walker@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Coresight ML <coresight@lists.linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Subject: [PATCH v5 1/9] perf cs-etm: Defer to assign exception sample flag
Date: Thu, 20 Feb 2020 13:26:53 +0800 [thread overview]
Message-ID: <20200220052701.7754-2-leo.yan@linaro.org> (raw)
In-Reply-To: <20200220052701.7754-1-leo.yan@linaro.org>
Currently, neither the exception entry packet nor the exception return
packet isn't used to generate samples; so the exception packet is only
used as an affiliate packet, and the exception sample flag is assigned
to its previous range packet, this is finished in the function
cs_etm__set_sample_flags().
This patch moves the exception sample flag assignment from
cs_etm__set_sample_flags() to cs_etm__exception(), essentially it defers
to assign exception sample flag to the previous range packet, thus this
gives us a chance to keep the previous range packet's original sample
flag.
So this patch is only a preparation for later patches and doesn't
include any change for the functionality; based on it, we can add extra
processing between the exception packet and its previous range packet.
To reduce the indenting, this patch bails out directly at the entry of
cs_etm__exception() if detects the previous packet is not a range
packet.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
tools/perf/util/cs-etm.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index bba969d48076..48932a7a933f 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -1479,6 +1479,13 @@ static int cs_etm__sample(struct cs_etm_queue *etmq,
static int cs_etm__exception(struct cs_etm_traceid_queue *tidq)
{
+ /*
+ * Usually the exception packet follows a range packet, if it's not the
+ * case, directly bail out.
+ */
+ if (tidq->prev_packet->sample_type != CS_ETM_RANGE)
+ return 0;
+
/*
* When the exception packet is inserted, whether the last instruction
* in previous range packet is taken branch or not, we need to force
@@ -1490,8 +1497,16 @@ static int cs_etm__exception(struct cs_etm_traceid_queue *tidq)
* swap PACKET with PREV_PACKET. This keeps PREV_PACKET to be useful
* for generating instruction and branch samples.
*/
- if (tidq->prev_packet->sample_type == CS_ETM_RANGE)
- tidq->prev_packet->last_instr_taken_branch = true;
+ tidq->prev_packet->last_instr_taken_branch = true;
+
+ /*
+ * Since the exception packet is not used standalone for generating
+ * samples and it's affiliation to the previous instruction range
+ * packet; so set previous range packet flags to tell perf it is an
+ * exception taken branch.
+ */
+ if (tidq->packet->sample_type == CS_ETM_EXCEPTION)
+ tidq->prev_packet->flags = tidq->packet->flags;
return 0;
}
@@ -1916,15 +1931,6 @@ static int cs_etm__set_sample_flags(struct cs_etm_queue *etmq,
PERF_IP_FLAG_CALL |
PERF_IP_FLAG_INTERRUPT;
- /*
- * When the exception packet is inserted, since exception
- * packet is not used standalone for generating samples
- * and it's affiliation to the previous instruction range
- * packet; so set previous range packet flags to tell perf
- * it is an exception taken branch.
- */
- if (prev_packet->sample_type == CS_ETM_RANGE)
- prev_packet->flags = packet->flags;
break;
case CS_ETM_EXCEPTION_RET:
/*
--
2.17.1
next prev parent reply other threads:[~2020-02-20 5:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 5:26 [PATCH v5 0/9] perf cs-etm: Support thread stack and callchain Leo Yan
2020-02-20 5:26 ` Leo Yan [this message]
2020-02-20 5:26 ` [PATCH v5 2/9] perf cs-etm: Reflect branch prior to exception Leo Yan
2020-02-20 5:26 ` [PATCH v5 3/9] perf cs-etm: Refactor instruction size handling Leo Yan
2020-02-20 5:26 ` [PATCH v5 4/9] perf cs-etm: Support thread stack Leo Yan
2020-02-20 5:26 ` [PATCH v5 5/9] perf cs-etm: Support branch filter Leo Yan
2020-02-20 5:26 ` [PATCH v5 6/9] perf cs-etm: Support callchain for instruction sample Leo Yan
2020-02-20 5:26 ` [PATCH v5 7/9] perf cs-etm: Fixup exception entry for thread stack Leo Yan
2020-02-20 5:27 ` [PATCH v5 8/9] perf thread: Add helper to get top return address Leo Yan
2020-02-20 5:27 ` [PATCH v5 9/9] perf cs-etm: Fixup exception exit for thread stack Leo Yan
2020-11-05 22:50 ` [PATCH v5 0/9] perf cs-etm: Support thread stack and callchain Stephen Boyd
2020-11-06 2:09 ` 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=20200220052701.7754-2-leo.yan@linaro.org \
--to=leo.yan@linaro.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=jolsa@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=robert.walker@arm.com \
--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®