From: leo.yan@linaro.org (Leo Yan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/10] perf tools: Add support for decoding CoreSight trace data
Date: Sat, 30 Dec 2017 08:33:59 +0800 [thread overview]
Message-ID: <20171230003359.GD600@leoy-linaro> (raw)
In-Reply-To: <1513356299-26274-6-git-send-email-mathieu.poirier@linaro.org>
Hi Mathieu, Mike,
On Fri, Dec 15, 2017 at 09:44:54AM -0700, Mathieu Poirier wrote:
> Adding functionality to create a CoreSight trace decoder capable
> of decoding trace data pushed by a client application.
>
> Co-authored-by: Tor Jeremiassen <tor@ti.com>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
> tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 119 ++++++++++++++++++++++++
> 1 file changed, 119 insertions(+)
>
> diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> index 6a4c86b1431f..57b020b0b36f 100644
> --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> @@ -200,6 +200,121 @@ static void cs_etm_decoder__clear_buffer(struct cs_etm_decoder *decoder)
> }
> }
>
> +static ocsd_datapath_resp_t
> +cs_etm_decoder__buffer_packet(struct cs_etm_decoder *decoder,
> + const ocsd_generic_trace_elem *elem,
> + const u8 trace_chan_id,
> + enum cs_etm_sample_type sample_type)
> +{
> + u32 et = 0;
> + struct int_node *inode = NULL;
> +
> + if (decoder->packet_count >= MAX_BUFFER - 1)
> + return OCSD_RESP_FATAL_SYS_ERR;
> +
> + /* Search the RB tree for the cpu associated with this traceID */
> + inode = intlist__find(traceid_list, trace_chan_id);
> + if (!inode)
> + return OCSD_RESP_FATAL_SYS_ERR;
> +
> + et = decoder->tail;
> + decoder->packet_buffer[et].sample_type = sample_type;
> + decoder->packet_buffer[et].start_addr = elem->st_addr;
> + decoder->packet_buffer[et].end_addr = elem->en_addr;
> + decoder->packet_buffer[et].exc = false;
> + decoder->packet_buffer[et].exc_ret = false;
> + decoder->packet_buffer[et].cpu = *((int *)inode->priv);
> +
> + /* Wrap around if need be */
> + et = (et + 1) & (MAX_BUFFER - 1);
> +
> + decoder->tail = et;
> + decoder->packet_count++;
> +
> + if (decoder->packet_count == MAX_BUFFER - 1)
> + return OCSD_RESP_WAIT;
> +
> + return OCSD_RESP_CONT;
> +}
> +
> +static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
> + const void *context,
> + const ocsd_trc_index_t indx __maybe_unused,
> + const u8 trace_chan_id __maybe_unused,
> + const ocsd_generic_trace_elem *elem)
> +{
> + ocsd_datapath_resp_t resp = OCSD_RESP_CONT;
> + struct cs_etm_decoder *decoder = (struct cs_etm_decoder *) context;
After apply this patch set and build 'perf' tool with linking
OpenCSDv0.8.0 libs, I can everytime OpenCSD parses 'elem->elem_type'
is OCSD_GEN_TRC_ELEM_ADDR_NACC but not OCSD_GEN_TRC_ELEM_INSTR_RANGE.
As result, the 'perf' tool can dump the raw data with '-D' option but
it cannot analyze the symbol and symbol offset with below command:
./perf script -v -a -F cpu,event,ip,sym,symoff -i ./perf.data -k vmlinux
--kallsyms ./System.map
Have uploaded perf.data/vmlinux/System.map in the folder:
http://people.linaro.org/~leo.yan/binaries/perf_4.15_r4/
Thanks,
Leo Yan
> + switch (elem->elem_type) {
> + case OCSD_GEN_TRC_ELEM_UNKNOWN:
> + break;
> + case OCSD_GEN_TRC_ELEM_NO_SYNC:
> + decoder->trace_on = false;
> + break;
> + case OCSD_GEN_TRC_ELEM_TRACE_ON:
> + decoder->trace_on = true;
> + break;
> + case OCSD_GEN_TRC_ELEM_INSTR_RANGE:
> + resp = cs_etm_decoder__buffer_packet(decoder, elem,
> + trace_chan_id,
> + CS_ETM_RANGE);
> + break;
> + case OCSD_GEN_TRC_ELEM_EXCEPTION:
> + decoder->packet_buffer[decoder->tail].exc = true;
> + break;
> + case OCSD_GEN_TRC_ELEM_EXCEPTION_RET:
> + decoder->packet_buffer[decoder->tail].exc_ret = true;
> + break;
> + case OCSD_GEN_TRC_ELEM_PE_CONTEXT:
> + case OCSD_GEN_TRC_ELEM_EO_TRACE:
> + case OCSD_GEN_TRC_ELEM_ADDR_NACC:
> + case OCSD_GEN_TRC_ELEM_TIMESTAMP:
> + case OCSD_GEN_TRC_ELEM_CYCLE_COUNT:
> + case OCSD_GEN_TRC_ELEM_ADDR_UNKNOWN:
> + case OCSD_GEN_TRC_ELEM_EVENT:
> + case OCSD_GEN_TRC_ELEM_SWTRACE:
> + case OCSD_GEN_TRC_ELEM_CUSTOM:
> + default:
> + break;
> + }
> +
> + return resp;
> +}
> +
> +static int cs_etm_decoder__create_etm_packet_decoder(
> + struct cs_etm_trace_params *t_params,
> + struct cs_etm_decoder *decoder)
> +{
> + const char *decoder_name;
> + ocsd_etmv4_cfg trace_config_etmv4;
> + void *trace_config;
> + u8 csid;
> +
> + switch (t_params->protocol) {
> + case CS_ETM_PROTO_ETMV4i:
> + cs_etm_decoder__gen_etmv4_config(t_params, &trace_config_etmv4);
> + decoder_name = OCSD_BUILTIN_DCD_ETMV4I;
> + trace_config = &trace_config_etmv4;
> + break;
> + default:
> + return -1;
> + }
> +
> + if (ocsd_dt_create_decoder(decoder->dcd_tree,
> + decoder_name,
> + OCSD_CREATE_FLG_FULL_DECODER,
> + trace_config, &csid))
> + return -1;
> +
> + if (ocsd_dt_set_gen_elem_outfn(decoder->dcd_tree,
> + cs_etm_decoder__gen_trace_elem_printer,
> + decoder))
> + return -1;
> +
> + return 0;
> +}
> +
> static int
> cs_etm_decoder__create_etm_decoder(struct cs_etm_decoder_params *d_params,
> struct cs_etm_trace_params *t_params,
> @@ -208,6 +323,10 @@ cs_etm_decoder__create_etm_decoder(struct cs_etm_decoder_params *d_params,
> if (d_params->operation == CS_ETM_OPERATION_PRINT)
> return cs_etm_decoder__create_etm_packet_printer(t_params,
> decoder);
> + else if (d_params->operation == CS_ETM_OPERATION_DECODE)
> + return cs_etm_decoder__create_etm_packet_decoder(t_params,
> + decoder);
> +
> return -1;
> }
>
> --
> 2.7.4
>
WARNING: multiple messages have this Message-ID (diff)
From: Leo Yan <leo.yan@linaro.org>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: acme@kernel.org, peterz@infradead.org, mingo@redhat.com,
alexander.shishkin@linux.intel.com, namhyung@kernel.org,
adrian.hunter@intel.com, mike.leach@arm.com,
suzuki.poulosi@arm.com, tor@ti.com, jolsa@redhat.com,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 05/10] perf tools: Add support for decoding CoreSight trace data
Date: Sat, 30 Dec 2017 08:33:59 +0800 [thread overview]
Message-ID: <20171230003359.GD600@leoy-linaro> (raw)
In-Reply-To: <1513356299-26274-6-git-send-email-mathieu.poirier@linaro.org>
Hi Mathieu, Mike,
On Fri, Dec 15, 2017 at 09:44:54AM -0700, Mathieu Poirier wrote:
> Adding functionality to create a CoreSight trace decoder capable
> of decoding trace data pushed by a client application.
>
> Co-authored-by: Tor Jeremiassen <tor@ti.com>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
> tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 119 ++++++++++++++++++++++++
> 1 file changed, 119 insertions(+)
>
> diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> index 6a4c86b1431f..57b020b0b36f 100644
> --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> @@ -200,6 +200,121 @@ static void cs_etm_decoder__clear_buffer(struct cs_etm_decoder *decoder)
> }
> }
>
> +static ocsd_datapath_resp_t
> +cs_etm_decoder__buffer_packet(struct cs_etm_decoder *decoder,
> + const ocsd_generic_trace_elem *elem,
> + const u8 trace_chan_id,
> + enum cs_etm_sample_type sample_type)
> +{
> + u32 et = 0;
> + struct int_node *inode = NULL;
> +
> + if (decoder->packet_count >= MAX_BUFFER - 1)
> + return OCSD_RESP_FATAL_SYS_ERR;
> +
> + /* Search the RB tree for the cpu associated with this traceID */
> + inode = intlist__find(traceid_list, trace_chan_id);
> + if (!inode)
> + return OCSD_RESP_FATAL_SYS_ERR;
> +
> + et = decoder->tail;
> + decoder->packet_buffer[et].sample_type = sample_type;
> + decoder->packet_buffer[et].start_addr = elem->st_addr;
> + decoder->packet_buffer[et].end_addr = elem->en_addr;
> + decoder->packet_buffer[et].exc = false;
> + decoder->packet_buffer[et].exc_ret = false;
> + decoder->packet_buffer[et].cpu = *((int *)inode->priv);
> +
> + /* Wrap around if need be */
> + et = (et + 1) & (MAX_BUFFER - 1);
> +
> + decoder->tail = et;
> + decoder->packet_count++;
> +
> + if (decoder->packet_count == MAX_BUFFER - 1)
> + return OCSD_RESP_WAIT;
> +
> + return OCSD_RESP_CONT;
> +}
> +
> +static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
> + const void *context,
> + const ocsd_trc_index_t indx __maybe_unused,
> + const u8 trace_chan_id __maybe_unused,
> + const ocsd_generic_trace_elem *elem)
> +{
> + ocsd_datapath_resp_t resp = OCSD_RESP_CONT;
> + struct cs_etm_decoder *decoder = (struct cs_etm_decoder *) context;
After apply this patch set and build 'perf' tool with linking
OpenCSDv0.8.0 libs, I can everytime OpenCSD parses 'elem->elem_type'
is OCSD_GEN_TRC_ELEM_ADDR_NACC but not OCSD_GEN_TRC_ELEM_INSTR_RANGE.
As result, the 'perf' tool can dump the raw data with '-D' option but
it cannot analyze the symbol and symbol offset with below command:
./perf script -v -a -F cpu,event,ip,sym,symoff -i ./perf.data -k vmlinux
--kallsyms ./System.map
Have uploaded perf.data/vmlinux/System.map in the folder:
http://people.linaro.org/~leo.yan/binaries/perf_4.15_r4/
Thanks,
Leo Yan
> + switch (elem->elem_type) {
> + case OCSD_GEN_TRC_ELEM_UNKNOWN:
> + break;
> + case OCSD_GEN_TRC_ELEM_NO_SYNC:
> + decoder->trace_on = false;
> + break;
> + case OCSD_GEN_TRC_ELEM_TRACE_ON:
> + decoder->trace_on = true;
> + break;
> + case OCSD_GEN_TRC_ELEM_INSTR_RANGE:
> + resp = cs_etm_decoder__buffer_packet(decoder, elem,
> + trace_chan_id,
> + CS_ETM_RANGE);
> + break;
> + case OCSD_GEN_TRC_ELEM_EXCEPTION:
> + decoder->packet_buffer[decoder->tail].exc = true;
> + break;
> + case OCSD_GEN_TRC_ELEM_EXCEPTION_RET:
> + decoder->packet_buffer[decoder->tail].exc_ret = true;
> + break;
> + case OCSD_GEN_TRC_ELEM_PE_CONTEXT:
> + case OCSD_GEN_TRC_ELEM_EO_TRACE:
> + case OCSD_GEN_TRC_ELEM_ADDR_NACC:
> + case OCSD_GEN_TRC_ELEM_TIMESTAMP:
> + case OCSD_GEN_TRC_ELEM_CYCLE_COUNT:
> + case OCSD_GEN_TRC_ELEM_ADDR_UNKNOWN:
> + case OCSD_GEN_TRC_ELEM_EVENT:
> + case OCSD_GEN_TRC_ELEM_SWTRACE:
> + case OCSD_GEN_TRC_ELEM_CUSTOM:
> + default:
> + break;
> + }
> +
> + return resp;
> +}
> +
> +static int cs_etm_decoder__create_etm_packet_decoder(
> + struct cs_etm_trace_params *t_params,
> + struct cs_etm_decoder *decoder)
> +{
> + const char *decoder_name;
> + ocsd_etmv4_cfg trace_config_etmv4;
> + void *trace_config;
> + u8 csid;
> +
> + switch (t_params->protocol) {
> + case CS_ETM_PROTO_ETMV4i:
> + cs_etm_decoder__gen_etmv4_config(t_params, &trace_config_etmv4);
> + decoder_name = OCSD_BUILTIN_DCD_ETMV4I;
> + trace_config = &trace_config_etmv4;
> + break;
> + default:
> + return -1;
> + }
> +
> + if (ocsd_dt_create_decoder(decoder->dcd_tree,
> + decoder_name,
> + OCSD_CREATE_FLG_FULL_DECODER,
> + trace_config, &csid))
> + return -1;
> +
> + if (ocsd_dt_set_gen_elem_outfn(decoder->dcd_tree,
> + cs_etm_decoder__gen_trace_elem_printer,
> + decoder))
> + return -1;
> +
> + return 0;
> +}
> +
> static int
> cs_etm_decoder__create_etm_decoder(struct cs_etm_decoder_params *d_params,
> struct cs_etm_trace_params *t_params,
> @@ -208,6 +323,10 @@ cs_etm_decoder__create_etm_decoder(struct cs_etm_decoder_params *d_params,
> if (d_params->operation == CS_ETM_OPERATION_PRINT)
> return cs_etm_decoder__create_etm_packet_printer(t_params,
> decoder);
> + else if (d_params->operation == CS_ETM_OPERATION_DECODE)
> + return cs_etm_decoder__create_etm_packet_decoder(t_params,
> + decoder);
> +
> return -1;
> }
>
> --
> 2.7.4
>
next prev parent reply other threads:[~2017-12-30 0:33 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-15 16:44 [PATCH 00/10] perf tools: Add support for CoreSight trace decoding Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-15 16:44 ` [PATCH 01/10] perf tools: Integrating the CoreSight decoding library Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-15 16:44 ` [PATCH 02/10] perf tools: Add initial entry point for decoder CoreSight traces Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-15 16:44 ` [PATCH 03/10] perf tools: Add processing of coresight metadata Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-15 16:44 ` [PATCH 04/10] perf tools: Add decoder mechanic to support dumping trace data Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-15 16:44 ` [PATCH 05/10] perf tools: Add support for decoding CoreSight " Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-30 0:33 ` Leo Yan [this message]
2017-12-30 0:33 ` Leo Yan
2018-01-09 12:09 ` Mike Leach
2018-01-09 12:09 ` Mike Leach
2018-01-10 5:59 ` Leo Yan
2018-01-10 5:59 ` Leo Yan
2018-01-10 20:16 ` Mathieu Poirier
2018-01-10 20:16 ` Mathieu Poirier
2017-12-15 16:44 ` [PATCH 06/10] perf tools: Add functionality to communicate with the openCSD decoder Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-15 16:44 ` [PATCH 07/10] pert tools: Add queue management functionality Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-15 16:44 ` [PATCH 08/10] perf tools: Add full support for CoreSight trace decoding Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-15 16:44 ` [PATCH 09/10] perf tools: Add mechanic to synthesise CoreSight trace packets Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-15 16:44 ` [PATCH 10/10] MAINTAINERS: Adding entry for CoreSight trace decoding Mathieu Poirier
2017-12-15 16:44 ` Mathieu Poirier
2017-12-30 0:51 ` [PATCH 00/10] perf tools: Add support " Leo Yan
2017-12-30 0:51 ` Leo Yan
2018-01-08 17:45 ` Mathieu Poirier
2018-01-08 17:45 ` Mathieu Poirier
2018-01-11 0:08 ` Kim Phillips
2018-01-11 0:08 ` Kim Phillips
2018-01-11 12:23 ` Mark Brown
2018-01-11 12:23 ` Mark Brown
2018-01-11 15:45 ` Mathieu Poirier
2018-01-11 15:45 ` Mathieu Poirier
2018-01-11 17:28 ` Kim Phillips
2018-01-11 17:28 ` Kim Phillips
2018-01-11 21:11 ` Mathieu Poirier
2018-01-11 21:11 ` Mathieu Poirier
2018-01-11 21:49 ` Kim Phillips
2018-01-11 21:49 ` Kim Phillips
2018-01-11 22:18 ` Mathieu Poirier
2018-01-11 22:18 ` Mathieu Poirier
2018-01-16 12:35 ` Mike Leach
2018-01-16 17:01 ` Kim Phillips
2018-01-16 17:58 ` Mathieu Poirier
2018-01-16 19:29 ` Kim Phillips
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=20171230003359.GD600@leoy-linaro \
--to=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.