linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Leo Yan <leo.yan@linaro.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Mike Leach <mike.leach@linaro.org>,
	Robert Walker <robert.walker@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Coresight ML <coresight@lists.linaro.org>
Subject: Re: [PATCH v6 4/8] perf cs-etm: Add exception number in exception packet
Date: Wed, 23 Jan 2019 14:05:26 -0700	[thread overview]
Message-ID: <20190123210526.GD620@xps15> (raw)
In-Reply-To: <20190119014347.27441-5-leo.yan@linaro.org>

On Sat, Jan 19, 2019 at 09:43:43AM +0800, Leo Yan wrote:
> When an exception packet comes, it contains the information for
> exception number; the exception number indicates the exception types,
> so from it we can know if the exception is taken for interrupt,
> system call or other traps, etc.
> 
> This patch simply adds a field in cs_etm_packet struct, it records
> exception number for exception packet that will then be used to
> properly identify exception types to the perf synthesize mechanic.
> 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  .../perf/util/cs-etm-decoder/cs-etm-decoder.c | 20 +++++++++++++++----
>  .../perf/util/cs-etm-decoder/cs-etm-decoder.h |  1 +
>  2 files changed, 17 insertions(+), 4 deletions(-)
> 
> 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 e98ee49a1527..294efa76c9e3 100644
> --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> @@ -294,6 +294,7 @@ static void cs_etm_decoder__clear_buffer(struct cs_etm_decoder *decoder)
>  		decoder->packet_buffer[i].last_instr_subtype = 0;
>  		decoder->packet_buffer[i].last_instr_cond = 0;
>  		decoder->packet_buffer[i].flags = 0;
> +		decoder->packet_buffer[i].exception_number = UINT32_MAX;
>  		decoder->packet_buffer[i].cpu = INT_MIN;
>  	}
>  }
> @@ -331,6 +332,7 @@ cs_etm_decoder__buffer_packet(struct cs_etm_decoder *decoder,
>  	decoder->packet_buffer[et].last_instr_subtype = 0;
>  	decoder->packet_buffer[et].last_instr_cond = 0;
>  	decoder->packet_buffer[et].flags = 0;
> +	decoder->packet_buffer[et].exception_number = UINT32_MAX;
>  
>  	if (decoder->packet_count == MAX_BUFFER - 1)
>  		return OCSD_RESP_WAIT;
> @@ -406,10 +408,20 @@ cs_etm_decoder__buffer_discontinuity(struct cs_etm_decoder *decoder,
>  
>  static ocsd_datapath_resp_t
>  cs_etm_decoder__buffer_exception(struct cs_etm_decoder *decoder,
> +				 const ocsd_generic_trace_elem *elem,
>  				 const uint8_t trace_chan_id)
> -{
> -	return cs_etm_decoder__buffer_packet(decoder, trace_chan_id,
> -					     CS_ETM_EXCEPTION);
> +{	int ret = 0;
> +	struct cs_etm_packet *packet;
> +
> +	ret = cs_etm_decoder__buffer_packet(decoder, trace_chan_id,
> +					    CS_ETM_EXCEPTION);
> +	if (ret != OCSD_RESP_CONT && ret != OCSD_RESP_WAIT)
> +		return ret;
> +
> +	packet = &decoder->packet_buffer[decoder->tail];
> +	packet->exception_number = elem->exception_number;
> +
> +	return ret;
>  }
>  
>  static ocsd_datapath_resp_t
> @@ -443,7 +455,7 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
>  						    trace_chan_id);
>  		break;
>  	case OCSD_GEN_TRC_ELEM_EXCEPTION:
> -		resp = cs_etm_decoder__buffer_exception(decoder,
> +		resp = cs_etm_decoder__buffer_exception(decoder, elem,
>  							trace_chan_id);
>  		break;
>  	case OCSD_GEN_TRC_ELEM_EXCEPTION_RET:
> diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h
> index 23600e57a215..012b4728a46f 100644
> --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h
> +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h
> @@ -46,6 +46,7 @@ struct cs_etm_packet {
>  	u32 last_instr_type;
>  	u32 last_instr_subtype;
>  	u32 flags;
> +	u32 exception_number;
>  	u8 last_instr_cond;
>  	u8 last_instr_taken_branch;
>  	u8 last_instr_size;

Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

> -- 
> 2.17.1
> 

  reply	other threads:[~2019-01-23 21:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-19  1:43 [PATCH v6 0/8] perf cs-etm: Add support for sample flags Leo Yan
2019-01-19  1:43 ` [PATCH v6 1/8] perf cs-etm: Add last instruction information in packet Leo Yan
2019-01-23 21:03   ` Mathieu Poirier
2019-01-19  1:43 ` [PATCH v6 2/8] perf cs-etm: Set sample flags for instruction range packet Leo Yan
2019-01-23 21:03   ` Mathieu Poirier
2019-01-19  1:43 ` [PATCH v6 3/8] perf cs-etm: Set sample flags for trace discontinuity Leo Yan
2019-01-23 21:04   ` Mathieu Poirier
2019-01-19  1:43 ` [PATCH v6 4/8] perf cs-etm: Add exception number in exception packet Leo Yan
2019-01-23 21:05   ` Mathieu Poirier [this message]
2019-01-19  1:43 ` [PATCH v6 5/8] perf cs-etm: Change tuple from traceID-CPU# to traceID-metadata Leo Yan
2019-01-23 21:13   ` Mathieu Poirier
2019-01-23 23:45     ` Leo Yan
2019-01-19  1:43 ` [PATCH v6 6/8] perf cs-etm: Add traceID in packet Leo Yan
2019-01-23 21:23   ` Mathieu Poirier
2019-01-19  1:43 ` [PATCH v6 7/8] perf cs-etm: Set sample flags for exception packet Leo Yan
2019-01-23 21:39   ` Mathieu Poirier
2019-01-19  1:43 ` [PATCH v6 8/8] perf cs-etm: Set sample flags for exception return packet Leo Yan
2019-01-23 21:51   ` Mathieu Poirier
2019-01-23 23:36     ` Leo Yan
2019-01-24  0:22 ` [PATCH v6 0/8] perf cs-etm: Add support for sample flags Mathieu Poirier
2019-01-24  4:00   ` 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=20190123210526.GD620@xps15 \
    --to=mathieu.poirier@linaro.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@linaro.org \
    --cc=namhyung@kernel.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;
as well as URLs for NNTP newsgroup(s).