All of lore.kernel.org
 help / color / mirror / Atom feed
From: mathieu.poirier@linaro.org (Mathieu Poirier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 1/5] perf cs-etm: Correct packets swapping in cs_etm__flush()
Date: Fri, 16 Nov 2018 15:58:38 -0700	[thread overview]
Message-ID: <20181116225838.GA25258@xps15> (raw)
In-Reply-To: <1541912383-19915-2-git-send-email-leo.yan@linaro.org>

On Sun, Nov 11, 2018 at 12:59:39PM +0800, Leo Yan wrote:
> The structure cs_etm_queue uses 'prev_packet' to point to previous
> packet, this can be used to combine with new coming packet to generate
> samples.
> 
> In function cs_etm__flush() it swaps packets only when the flag
> 'etm->synth_opts.last_branch' is true, this means that it will not
> swap packets if without option '--itrace=il' to generate last branch
> entries; thus for this case the 'prev_packet' doesn't point to the
> correct previous packet and the stale packet still will be used to
> generate sequential sample.  Thus if dump trace with 'perf script'
> command we can see the incorrect flow with the stale packet's address
> info.
> 
> This patch corrects packets swapping in cs_etm__flush(); except using
> the flag 'etm->synth_opts.last_branch' it also checks the another flag
> 'etm->sample_branches', if any flag is true then it swaps packets so
> can save correct content to 'prev_packet'.  Finally this can fix the
> wrong program flow dumping issue.
> 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  tools/perf/util/cs-etm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index 48ad217..fe18d7b 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -997,7 +997,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq)
>  	}
>  
>  swap_packet:
> -	if (etmq->etm->synth_opts.last_branch) {
> +	if (etm->sample_branches || etmq->etm->synth_opts.last_branch) {

This seems like the right thing to do, if only to be consistent with that is
done in cs_etm__sample().

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

>  		/*
>  		 * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for
>  		 * the next incoming packet.
> -- 
> 2.7.4
> 

WARNING: multiple messages have this Message-ID (diff)
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Leo Yan <leo.yan@linaro.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	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, Mike Leach <mike.leach@linaro.org>,
	Robert Walker <robert.walker@arm.com>,
	Al Grant <Al.Grant@arm.com>,
	Coresight ML <coresight@lists.linaro.org>
Subject: Re: [PATCH v1 1/5] perf cs-etm: Correct packets swapping in cs_etm__flush()
Date: Fri, 16 Nov 2018 15:58:38 -0700	[thread overview]
Message-ID: <20181116225838.GA25258@xps15> (raw)
In-Reply-To: <1541912383-19915-2-git-send-email-leo.yan@linaro.org>

On Sun, Nov 11, 2018 at 12:59:39PM +0800, Leo Yan wrote:
> The structure cs_etm_queue uses 'prev_packet' to point to previous
> packet, this can be used to combine with new coming packet to generate
> samples.
> 
> In function cs_etm__flush() it swaps packets only when the flag
> 'etm->synth_opts.last_branch' is true, this means that it will not
> swap packets if without option '--itrace=il' to generate last branch
> entries; thus for this case the 'prev_packet' doesn't point to the
> correct previous packet and the stale packet still will be used to
> generate sequential sample.  Thus if dump trace with 'perf script'
> command we can see the incorrect flow with the stale packet's address
> info.
> 
> This patch corrects packets swapping in cs_etm__flush(); except using
> the flag 'etm->synth_opts.last_branch' it also checks the another flag
> 'etm->sample_branches', if any flag is true then it swaps packets so
> can save correct content to 'prev_packet'.  Finally this can fix the
> wrong program flow dumping issue.
> 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  tools/perf/util/cs-etm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index 48ad217..fe18d7b 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -997,7 +997,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq)
>  	}
>  
>  swap_packet:
> -	if (etmq->etm->synth_opts.last_branch) {
> +	if (etm->sample_branches || etmq->etm->synth_opts.last_branch) {

This seems like the right thing to do, if only to be consistent with that is
done in cs_etm__sample().

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

>  		/*
>  		 * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for
>  		 * the next incoming packet.
> -- 
> 2.7.4
> 

  reply	other threads:[~2018-11-16 22:58 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-11  4:59 [PATCH v1 0/5] perf cs-etm: Correct packets handling Leo Yan
2018-11-11  4:59 ` Leo Yan
2018-11-11  4:59 ` [PATCH v1 1/5] perf cs-etm: Correct packets swapping in cs_etm__flush() Leo Yan
2018-11-11  4:59   ` Leo Yan
2018-11-16 22:58   ` Mathieu Poirier [this message]
2018-11-16 22:58     ` Mathieu Poirier
2018-11-11  4:59 ` [PATCH v1 2/5] perf cs-etm: Avoid stale branch samples when flush packet Leo Yan
2018-11-11  4:59   ` Leo Yan
2018-11-16 23:05   ` Mathieu Poirier
2018-11-16 23:05     ` Mathieu Poirier
2018-11-18  6:38     ` leo.yan at linaro.org
2018-11-18  6:38       ` leo.yan
2018-12-05  2:58     ` leo.yan
2018-12-05  2:58       ` leo.yan
2018-11-11  4:59 ` [PATCH v1 3/5] perf cs-etm: Support for NO_SYNC packet Leo Yan
2018-11-11  4:59   ` Leo Yan
2018-11-19 18:27   ` Mathieu Poirier
2018-11-19 18:27     ` Mathieu Poirier
2018-12-05  3:31     ` leo.yan
2018-12-05  3:31       ` leo.yan
2018-12-05 17:48       ` Mathieu Poirier
2018-12-05 17:48         ` Mathieu Poirier
2018-12-06  5:45         ` leo.yan
2018-12-06  5:45           ` leo.yan
2018-11-11  4:59 ` [PATCH v1 4/5] perf cs-etm: Generate branch sample for exception packet Leo Yan
2018-11-11  4:59   ` Leo Yan
2018-11-11  4:59 ` [PATCH v1 5/5] perf cs-etm: Track exception number Leo Yan
2018-11-11  4:59   ` Leo Yan
2018-11-19 20:47   ` Mathieu Poirier
2018-11-19 20:47     ` Mathieu Poirier
2018-12-05  3:49     ` leo.yan
2018-12-05  3:49       ` leo.yan
2018-12-05 18:03       ` Mathieu Poirier
2018-12-05 18:03         ` Mathieu Poirier
2018-12-06  5:47         ` leo.yan
2018-12-06  5:47           ` 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=20181116225838.GA25258@xps15 \
    --to=mathieu.poirier@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.