All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Leo Yan <leo.yan@linaro.org>
Cc: James Clark <james.clark@arm.com>,
	linux-perf-users@vger.kernel.org, mathieu.poirier@linaro.org,
	coresight@lists.linaro.org, Mike Leach <mike.leach@linaro.org>,
	John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.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
Subject: Re: [PATCH 2/2] perf: cs-etm: Fix corrupt inject files when only last branch option is enabled
Date: Tue, 15 Feb 2022 12:07:18 -0300	[thread overview]
Message-ID: <YgvBpvYzAMCGSECj@kernel.org> (raw)
In-Reply-To: <20220211160516.GD475776@leoy-ThinkPad-X240s>

Em Sat, Feb 12, 2022 at 12:05:16AM +0800, Leo Yan escreveu:
> On Thu, Feb 10, 2022 at 08:06:20PM +0000, James Clark wrote:
> > Perf inject with Coresight data generates files that cannot be opened
> > when only the last branch option is specified:
> > 
> >   perf inject -i perf.data --itrace=l -o inject.data
> >   perf script -i inject.data
> >   0x33faa8 [0x8]: failed to process type: 9 [Bad address]
> > 
> > This is because cs_etm__synth_instruction_sample() is called even when
> > the sample type for instructions hasn't been setup. Last branch records
> > are attached to instruction samples so it doesn't make sense to generate
> > them when --itrace=i isn't specified anyway.
> > 
> > This change disables all calls of cs_etm__synth_instruction_sample()
> > unless --itrace=i is specified, resulting in a file with no samples if
> > only --itrace=l is provided, rather than a bad file.
> > 
> > Signed-off-by: James Clark <james.clark@arm.com>
> 
> Reviewed-by: Leo Yan <leo.yan@linaro.org>

Thanks, applied.

- Arnaldo

 
> > ---
> >  tools/perf/util/cs-etm.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> > index 796a065a500e..8b95fb3c4d7b 100644
> > --- a/tools/perf/util/cs-etm.c
> > +++ b/tools/perf/util/cs-etm.c
> > @@ -1553,6 +1553,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq,
> >  		goto swap_packet;
> >  
> >  	if (etmq->etm->synth_opts.last_branch &&
> > +	    etmq->etm->synth_opts.instructions &&
> >  	    tidq->prev_packet->sample_type == CS_ETM_RANGE) {
> >  		u64 addr;
> >  
> > @@ -1610,6 +1611,7 @@ static int cs_etm__end_block(struct cs_etm_queue *etmq,
> >  	 * the trace.
> >  	 */
> >  	if (etmq->etm->synth_opts.last_branch &&
> > +	    etmq->etm->synth_opts.instructions &&
> >  	    tidq->prev_packet->sample_type == CS_ETM_RANGE) {
> >  		u64 addr;
> >  
> > -- 
> > 2.28.0
> > 

-- 

- Arnaldo

WARNING: multiple messages have this Message-ID (diff)
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Leo Yan <leo.yan@linaro.org>
Cc: James Clark <james.clark@arm.com>,
	linux-perf-users@vger.kernel.org, mathieu.poirier@linaro.org,
	coresight@lists.linaro.org, Mike Leach <mike.leach@linaro.org>,
	John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.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
Subject: Re: [PATCH 2/2] perf: cs-etm: Fix corrupt inject files when only last branch option is enabled
Date: Tue, 15 Feb 2022 12:07:18 -0300	[thread overview]
Message-ID: <YgvBpvYzAMCGSECj@kernel.org> (raw)
In-Reply-To: <20220211160516.GD475776@leoy-ThinkPad-X240s>

Em Sat, Feb 12, 2022 at 12:05:16AM +0800, Leo Yan escreveu:
> On Thu, Feb 10, 2022 at 08:06:20PM +0000, James Clark wrote:
> > Perf inject with Coresight data generates files that cannot be opened
> > when only the last branch option is specified:
> > 
> >   perf inject -i perf.data --itrace=l -o inject.data
> >   perf script -i inject.data
> >   0x33faa8 [0x8]: failed to process type: 9 [Bad address]
> > 
> > This is because cs_etm__synth_instruction_sample() is called even when
> > the sample type for instructions hasn't been setup. Last branch records
> > are attached to instruction samples so it doesn't make sense to generate
> > them when --itrace=i isn't specified anyway.
> > 
> > This change disables all calls of cs_etm__synth_instruction_sample()
> > unless --itrace=i is specified, resulting in a file with no samples if
> > only --itrace=l is provided, rather than a bad file.
> > 
> > Signed-off-by: James Clark <james.clark@arm.com>
> 
> Reviewed-by: Leo Yan <leo.yan@linaro.org>

Thanks, applied.

- Arnaldo

 
> > ---
> >  tools/perf/util/cs-etm.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> > index 796a065a500e..8b95fb3c4d7b 100644
> > --- a/tools/perf/util/cs-etm.c
> > +++ b/tools/perf/util/cs-etm.c
> > @@ -1553,6 +1553,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq,
> >  		goto swap_packet;
> >  
> >  	if (etmq->etm->synth_opts.last_branch &&
> > +	    etmq->etm->synth_opts.instructions &&
> >  	    tidq->prev_packet->sample_type == CS_ETM_RANGE) {
> >  		u64 addr;
> >  
> > @@ -1610,6 +1611,7 @@ static int cs_etm__end_block(struct cs_etm_queue *etmq,
> >  	 * the trace.
> >  	 */
> >  	if (etmq->etm->synth_opts.last_branch &&
> > +	    etmq->etm->synth_opts.instructions &&
> >  	    tidq->prev_packet->sample_type == CS_ETM_RANGE) {
> >  		u64 addr;
> >  
> > -- 
> > 2.28.0
> > 

-- 

- Arnaldo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-02-15 15:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 20:06 [PATCH 1/2] perf: cs-etm: No-op refactor of synth opt usage James Clark
2022-02-10 20:06 ` James Clark
2022-02-10 20:06 ` [PATCH 2/2] perf: cs-etm: Fix corrupt inject files when only last branch option is enabled James Clark
2022-02-10 20:06   ` James Clark
2022-02-11 16:05   ` Leo Yan
2022-02-11 16:05     ` Leo Yan
2022-02-15 15:07     ` Arnaldo Carvalho de Melo [this message]
2022-02-15 15:07       ` Arnaldo Carvalho de Melo
2022-02-22 15:49       ` James Clark
2022-02-22 15:49         ` James Clark
2022-02-11 15:20 ` [PATCH 1/2] perf: cs-etm: No-op refactor of synth opt usage Leo Yan
2022-02-11 15:20   ` Leo Yan
2022-02-15 15:07   ` Arnaldo Carvalho de Melo
2022-02-15 15:07     ` Arnaldo Carvalho de Melo

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=YgvBpvYzAMCGSECj@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@arm.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=namhyung@kernel.org \
    --cc=will@kernel.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.