linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from
@ 2020-08-19  8:47 Leo Yan
  2020-08-19  8:47 ` [PATCH 2/2] perf intel-pt: " Leo Yan
  2020-08-27 20:53 ` [PATCH 1/2] perf cs-etm: " Mathieu Poirier
  0 siblings, 2 replies; 11+ messages in thread
From: Leo Yan @ 2020-08-19  8:47 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Mathieu Poirier, Suzuki K Poulose,
	Mike Leach, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Adrian Hunter,
	Andi Kleen, Kan Liang, linux-arm-kernel, linux-kernel
  Cc: Al Grant, Leo Yan

From: Al Grant <al.grant@arm.com>

Commit 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
changed the format of branch stacks in perf samples. When samples use
this new format, a flag must be set in the corresponding event.
Synthesized branch stacks generated from CoreSight ETM trace were using
the new format, but not setting the event attribute, leading to
consumers seeing corrupt data. This patch fixes the issue by setting the
event attribute to indicate use of the new format.

Fixes: 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
Signed-off-by: Al Grant <al.grant@arm.com>
Reviewed-by: Andrea Brunato <andrea.brunato@arm.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/util/cs-etm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index c283223fb31f..a2a369e2fbb6 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm,
 		attr.sample_type &= ~(u64)PERF_SAMPLE_ADDR;
 	}
 
-	if (etm->synth_opts.last_branch)
+	if (etm->synth_opts.last_branch) {
 		attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
+		/*
+		 * We don't use the hardware index, but the sample generation
+		 * code uses the new format branch_stack with this field,
+		 * so the event attributes must indicate that it's present.
+		 */
+		attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
+	}
 
 	if (etm->synth_opts.instructions) {
 		attr.config = PERF_COUNT_HW_INSTRUCTIONS;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] perf intel-pt: Fix corrupt data after perf inject from
  2020-08-19  8:47 [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from Leo Yan
@ 2020-08-19  8:47 ` Leo Yan
  2020-08-24 12:41   ` Adrian Hunter
  2020-08-31 20:38   ` Mathieu Poirier
  2020-08-27 20:53 ` [PATCH 1/2] perf cs-etm: " Mathieu Poirier
  1 sibling, 2 replies; 11+ messages in thread
From: Leo Yan @ 2020-08-19  8:47 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Mathieu Poirier, Suzuki K Poulose,
	Mike Leach, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Adrian Hunter,
	Andi Kleen, Kan Liang, linux-arm-kernel, linux-kernel
  Cc: Al Grant, Leo Yan

From: Al Grant <al.grant@arm.com>

Commit 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
changed the format of branch stacks in perf samples. When samples use
this new format, a flag must be set in the corresponding event.
Synthesized branch stacks generated from Intel PT were using the new
format, but not setting the event attribute, leading to consumers
seeing corrupt data. This patch fixes the issue by setting the event
attribute to indicate use of the new format.

Fixes: 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
Signed-off-by: Al Grant <al.grant@arm.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/util/intel-pt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 2a8d245351e7..0af4e81c46e2 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -3017,8 +3017,15 @@ static int intel_pt_synth_events(struct intel_pt *pt,
 
 	if (pt->synth_opts.callchain)
 		attr.sample_type |= PERF_SAMPLE_CALLCHAIN;
-	if (pt->synth_opts.last_branch)
+	if (pt->synth_opts.last_branch) {
 		attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
+		/*
+		 * We don't use the hardware index, but the sample generation
+		 * code uses the new format branch_stack with this field,
+		 * so the event attributes must indicate that it's present.
+		 */
+		attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
+	}
 
 	if (pt->synth_opts.instructions) {
 		attr.config = PERF_COUNT_HW_INSTRUCTIONS;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] perf intel-pt: Fix corrupt data after perf inject from
  2020-08-19  8:47 ` [PATCH 2/2] perf intel-pt: " Leo Yan
@ 2020-08-24 12:41   ` Adrian Hunter
  2020-08-31 20:38   ` Mathieu Poirier
  1 sibling, 0 replies; 11+ messages in thread
From: Adrian Hunter @ 2020-08-24 12:41 UTC (permalink / raw)
  To: Leo Yan, Arnaldo Carvalho de Melo, Mathieu Poirier,
	Suzuki K Poulose, Mike Leach, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Andi Kleen, Kan Liang, linux-arm-kernel, linux-kernel
  Cc: Al Grant

On 19/08/20 11:47 am, Leo Yan wrote:
> From: Al Grant <al.grant@arm.com>
> 
> Commit 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> changed the format of branch stacks in perf samples. When samples use
> this new format, a flag must be set in the corresponding event.
> Synthesized branch stacks generated from Intel PT were using the new
> format, but not setting the event attribute, leading to consumers
> seeing corrupt data. This patch fixes the issue by setting the event
> attribute to indicate use of the new format.
> 
> Fixes: 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> Signed-off-by: Al Grant <al.grant@arm.com>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  tools/perf/util/intel-pt.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> index 2a8d245351e7..0af4e81c46e2 100644
> --- a/tools/perf/util/intel-pt.c
> +++ b/tools/perf/util/intel-pt.c
> @@ -3017,8 +3017,15 @@ static int intel_pt_synth_events(struct intel_pt *pt,
>  
>  	if (pt->synth_opts.callchain)
>  		attr.sample_type |= PERF_SAMPLE_CALLCHAIN;
> -	if (pt->synth_opts.last_branch)
> +	if (pt->synth_opts.last_branch) {
>  		attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
> +		/*
> +		 * We don't use the hardware index, but the sample generation
> +		 * code uses the new format branch_stack with this field,
> +		 * so the event attributes must indicate that it's present.
> +		 */
> +		attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
> +	}
>  
>  	if (pt->synth_opts.instructions) {
>  		attr.config = PERF_COUNT_HW_INSTRUCTIONS;
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from
  2020-08-19  8:47 [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from Leo Yan
  2020-08-19  8:47 ` [PATCH 2/2] perf intel-pt: " Leo Yan
@ 2020-08-27 20:53 ` Mathieu Poirier
  2020-08-31  0:04   ` Leo Yan
  1 sibling, 1 reply; 11+ messages in thread
From: Mathieu Poirier @ 2020-08-27 20:53 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Suzuki K Poulose, Mike Leach,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Andi Kleen, Kan Liang,
	linux-arm-kernel, linux-kernel, Al Grant

Hi Leo and Al,

On Wed, Aug 19, 2020 at 04:47:50PM +0800, Leo Yan wrote:
> From: Al Grant <al.grant@arm.com>
> 
> Commit 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> changed the format of branch stacks in perf samples. When samples use
> this new format, a flag must be set in the corresponding event.
> Synthesized branch stacks generated from CoreSight ETM trace were using
> the new format, but not setting the event attribute, leading to
> consumers seeing corrupt data. This patch fixes the issue by setting the
> event attribute to indicate use of the new format.
> 
> Fixes: 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> Signed-off-by: Al Grant <al.grant@arm.com>
> Reviewed-by: Andrea Brunato <andrea.brunato@arm.com>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  tools/perf/util/cs-etm.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index c283223fb31f..a2a369e2fbb6 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm,
>  		attr.sample_type &= ~(u64)PERF_SAMPLE_ADDR;
>  	}
>  
> -	if (etm->synth_opts.last_branch)
> +	if (etm->synth_opts.last_branch) {
>  		attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
> +		/*
> +		 * We don't use the hardware index, but the sample generation
> +		 * code uses the new format branch_stack with this field,
> +		 * so the event attributes must indicate that it's present.
> +		 */
> +		attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
> +	}

I've see this patch before...  I thought it had been merged - what happened?

Thanks,
Mathieu

>  
>  	if (etm->synth_opts.instructions) {
>  		attr.config = PERF_COUNT_HW_INSTRUCTIONS;
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from
  2020-08-27 20:53 ` [PATCH 1/2] perf cs-etm: " Mathieu Poirier
@ 2020-08-31  0:04   ` Leo Yan
  2020-09-01 14:54     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 11+ messages in thread
From: Leo Yan @ 2020-08-31  0:04 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: Arnaldo Carvalho de Melo, Suzuki K Poulose, Mike Leach,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Andi Kleen, Kan Liang,
	linux-arm-kernel, linux-kernel, Al Grant

Hi Mathieu,

On Thu, Aug 27, 2020 at 02:53:54PM -0600, Mathieu Poirier wrote:
> Hi Leo and Al,
> 
> On Wed, Aug 19, 2020 at 04:47:50PM +0800, Leo Yan wrote:
> > From: Al Grant <al.grant@arm.com>
> > 
> > Commit 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> > changed the format of branch stacks in perf samples. When samples use
> > this new format, a flag must be set in the corresponding event.
> > Synthesized branch stacks generated from CoreSight ETM trace were using
> > the new format, but not setting the event attribute, leading to
> > consumers seeing corrupt data. This patch fixes the issue by setting the
> > event attribute to indicate use of the new format.
> > 
> > Fixes: 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> > Signed-off-by: Al Grant <al.grant@arm.com>
> > Reviewed-by: Andrea Brunato <andrea.brunato@arm.com>
> > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > ---
> >  tools/perf/util/cs-etm.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> > index c283223fb31f..a2a369e2fbb6 100644
> > --- a/tools/perf/util/cs-etm.c
> > +++ b/tools/perf/util/cs-etm.c
> > @@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm,
> >  		attr.sample_type &= ~(u64)PERF_SAMPLE_ADDR;
> >  	}
> >  
> > -	if (etm->synth_opts.last_branch)
> > +	if (etm->synth_opts.last_branch) {
> >  		attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
> > +		/*
> > +		 * We don't use the hardware index, but the sample generation
> > +		 * code uses the new format branch_stack with this field,
> > +		 * so the event attributes must indicate that it's present.
> > +		 */
> > +		attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
> > +	}
> 
> I've see this patch before...  I thought it had been merged - what happened?

This patch before has been sent by Al to CoreSight mailing list but has
not sent to LKML, this is why I resent it to LKML in case it's missed.

Thanks,
Leo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] perf intel-pt: Fix corrupt data after perf inject from
  2020-08-19  8:47 ` [PATCH 2/2] perf intel-pt: " Leo Yan
  2020-08-24 12:41   ` Adrian Hunter
@ 2020-08-31 20:38   ` Mathieu Poirier
  2020-09-01 14:53     ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 11+ messages in thread
From: Mathieu Poirier @ 2020-08-31 20:38 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Suzuki K Poulose, Mike Leach,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Andi Kleen, Kan Liang,
	linux-arm-kernel, linux-kernel, AAl Grant

On Wed, Aug 19, 2020 at 04:47:51PM +0800, Leo Yan wrote:
> From: Al Grant <al.grant@arm.com>
> 
> Commit 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> changed the format of branch stacks in perf samples. When samples use
> this new format, a flag must be set in the corresponding event.
> Synthesized branch stacks generated from Intel PT were using the new
> format, but not setting the event attribute, leading to consumers
> seeing corrupt data. This patch fixes the issue by setting the event
> attribute to indicate use of the new format.
> 
> Fixes: 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> Signed-off-by: Al Grant <al.grant@arm.com>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>

Arnaldo, please consider.

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

> ---
>  tools/perf/util/intel-pt.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> index 2a8d245351e7..0af4e81c46e2 100644
> --- a/tools/perf/util/intel-pt.c
> +++ b/tools/perf/util/intel-pt.c
> @@ -3017,8 +3017,15 @@ static int intel_pt_synth_events(struct intel_pt *pt,
>  
>  	if (pt->synth_opts.callchain)
>  		attr.sample_type |= PERF_SAMPLE_CALLCHAIN;
> -	if (pt->synth_opts.last_branch)
> +	if (pt->synth_opts.last_branch) {
>  		attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
> +		/*
> +		 * We don't use the hardware index, but the sample generation
> +		 * code uses the new format branch_stack with this field,
> +		 * so the event attributes must indicate that it's present.
> +		 */
> +		attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
> +	}
>  
>  	if (pt->synth_opts.instructions) {
>  		attr.config = PERF_COUNT_HW_INSTRUCTIONS;
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] perf intel-pt: Fix corrupt data after perf inject from
  2020-08-31 20:38   ` Mathieu Poirier
@ 2020-09-01 14:53     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-09-01 14:53 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: Leo Yan, Suzuki K Poulose, Mike Leach, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Adrian Hunter, Andi Kleen, Kan Liang,
	linux-arm-kernel, linux-kernel, AAl Grant

Em Mon, Aug 31, 2020 at 02:38:32PM -0600, Mathieu Poirier escreveu:
> On Wed, Aug 19, 2020 at 04:47:51PM +0800, Leo Yan wrote:
> > From: Al Grant <al.grant@arm.com>
> > 
> > Commit 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> > changed the format of branch stacks in perf samples. When samples use
> > this new format, a flag must be set in the corresponding event.
> > Synthesized branch stacks generated from Intel PT were using the new
> > format, but not setting the event attribute, leading to consumers
> > seeing corrupt data. This patch fixes the issue by setting the event
> > attribute to indicate use of the new format.
> > 
> > Fixes: 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> > Signed-off-by: Al Grant <al.grant@arm.com>
> > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> 
> Arnaldo, please consider.
> 
> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Thanks, applied, and 1/2 too.

- Arnaldo
 
> > ---
> >  tools/perf/util/intel-pt.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> > index 2a8d245351e7..0af4e81c46e2 100644
> > --- a/tools/perf/util/intel-pt.c
> > +++ b/tools/perf/util/intel-pt.c
> > @@ -3017,8 +3017,15 @@ static int intel_pt_synth_events(struct intel_pt *pt,
> >  
> >  	if (pt->synth_opts.callchain)
> >  		attr.sample_type |= PERF_SAMPLE_CALLCHAIN;
> > -	if (pt->synth_opts.last_branch)
> > +	if (pt->synth_opts.last_branch) {
> >  		attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
> > +		/*
> > +		 * We don't use the hardware index, but the sample generation
> > +		 * code uses the new format branch_stack with this field,
> > +		 * so the event attributes must indicate that it's present.
> > +		 */
> > +		attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
> > +	}
> >  
> >  	if (pt->synth_opts.instructions) {
> >  		attr.config = PERF_COUNT_HW_INSTRUCTIONS;
> > -- 
> > 2.17.1
> > 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from
  2020-08-31  0:04   ` Leo Yan
@ 2020-09-01 14:54     ` Arnaldo Carvalho de Melo
  2020-09-02  0:39       ` Leo Yan
  0 siblings, 1 reply; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-09-01 14:54 UTC (permalink / raw)
  To: Leo Yan
  Cc: Mathieu Poirier, Suzuki K Poulose, Mike Leach, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Adrian Hunter, Andi Kleen, Kan Liang,
	linux-arm-kernel, linux-kernel, Al Grant

Em Mon, Aug 31, 2020 at 08:04:32AM +0800, Leo Yan escreveu:
> Hi Mathieu,
> 
> On Thu, Aug 27, 2020 at 02:53:54PM -0600, Mathieu Poirier wrote:
> > Hi Leo and Al,
> > 
> > On Wed, Aug 19, 2020 at 04:47:50PM +0800, Leo Yan wrote:
> > > From: Al Grant <al.grant@arm.com>
> > > 
> > > Commit 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> > > changed the format of branch stacks in perf samples. When samples use
> > > this new format, a flag must be set in the corresponding event.
> > > Synthesized branch stacks generated from CoreSight ETM trace were using
> > > the new format, but not setting the event attribute, leading to
> > > consumers seeing corrupt data. This patch fixes the issue by setting the
> > > event attribute to indicate use of the new format.
> > > 
> > > Fixes: 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> > > Signed-off-by: Al Grant <al.grant@arm.com>
> > > Reviewed-by: Andrea Brunato <andrea.brunato@arm.com>
> > > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > > ---
> > >  tools/perf/util/cs-etm.c | 9 ++++++++-
> > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> > > index c283223fb31f..a2a369e2fbb6 100644
> > > --- a/tools/perf/util/cs-etm.c
> > > +++ b/tools/perf/util/cs-etm.c
> > > @@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm,
> > >  		attr.sample_type &= ~(u64)PERF_SAMPLE_ADDR;
> > >  	}
> > >  
> > > -	if (etm->synth_opts.last_branch)
> > > +	if (etm->synth_opts.last_branch) {
> > >  		attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
> > > +		/*
> > > +		 * We don't use the hardware index, but the sample generation
> > > +		 * code uses the new format branch_stack with this field,
> > > +		 * so the event attributes must indicate that it's present.
> > > +		 */
> > > +		attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
> > > +	}
> > 
> > I've see this patch before...  I thought it had been merged - what happened?
> 
> This patch before has been sent by Al to CoreSight mailing list but has
> not sent to LKML, this is why I resent it to LKML in case it's missed.

So, was it Acked on the CoreSight mailing list? Are we missing any
Acked-by or Reviewed-by for this 1/2 patch as we got for 2/2?

- Arnaldo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from
  2020-09-01 14:54     ` Arnaldo Carvalho de Melo
@ 2020-09-02  0:39       ` Leo Yan
  2020-09-02  1:47         ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 11+ messages in thread
From: Leo Yan @ 2020-09-02  0:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Mathieu Poirier, Suzuki K Poulose, Mike Leach, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Adrian Hunter, Andi Kleen, Kan Liang,
	linux-arm-kernel, linux-kernel, Al Grant

Hi Arnaldo,

On Tue, Sep 01, 2020 at 11:54:32AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Aug 31, 2020 at 08:04:32AM +0800, Leo Yan escreveu:
> > Hi Mathieu,
> > 
> > On Thu, Aug 27, 2020 at 02:53:54PM -0600, Mathieu Poirier wrote:
> > > Hi Leo and Al,
> > > 
> > > On Wed, Aug 19, 2020 at 04:47:50PM +0800, Leo Yan wrote:
> > > > From: Al Grant <al.grant@arm.com>
> > > > 
> > > > Commit 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> > > > changed the format of branch stacks in perf samples. When samples use
> > > > this new format, a flag must be set in the corresponding event.
> > > > Synthesized branch stacks generated from CoreSight ETM trace were using
> > > > the new format, but not setting the event attribute, leading to
> > > > consumers seeing corrupt data. This patch fixes the issue by setting the
> > > > event attribute to indicate use of the new format.
> > > > 
> > > > Fixes: 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")
> > > > Signed-off-by: Al Grant <al.grant@arm.com>
> > > > Reviewed-by: Andrea Brunato <andrea.brunato@arm.com>
> > > > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > > > ---
> > > >  tools/perf/util/cs-etm.c | 9 ++++++++-
> > > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> > > > index c283223fb31f..a2a369e2fbb6 100644
> > > > --- a/tools/perf/util/cs-etm.c
> > > > +++ b/tools/perf/util/cs-etm.c
> > > > @@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm,
> > > >  		attr.sample_type &= ~(u64)PERF_SAMPLE_ADDR;
> > > >  	}
> > > >  
> > > > -	if (etm->synth_opts.last_branch)
> > > > +	if (etm->synth_opts.last_branch) {
> > > >  		attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
> > > > +		/*
> > > > +		 * We don't use the hardware index, but the sample generation
> > > > +		 * code uses the new format branch_stack with this field,
> > > > +		 * so the event attributes must indicate that it's present.
> > > > +		 */
> > > > +		attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
> > > > +	}
> > > 
> > > I've see this patch before...  I thought it had been merged - what happened?
> > 
> > This patch before has been sent by Al to CoreSight mailing list but has
> > not sent to LKML, this is why I resent it to LKML in case it's missed.
> 
> So, was it Acked on the CoreSight mailing list? Are we missing any
> Acked-by or Reviewed-by for this 1/2 patch as we got for 2/2?

The CoreSight mailing list has some discussion for this patch set,
when respin this patch set, I confirmed we don't miss any 'Acked' or
'Reviewed' tags.

Thanks,
Leo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from
  2020-09-02  0:39       ` Leo Yan
@ 2020-09-02  1:47         ` Arnaldo Carvalho de Melo
  2020-09-02  2:12           ` Leo Yan
  0 siblings, 1 reply; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-09-02  1:47 UTC (permalink / raw)
  To: Leo Yan
  Cc: Mathieu Poirier, Suzuki K Poulose, Mike Leach, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Adrian Hunter, Andi Kleen, Kan Liang,
	linux-arm-kernel, linux-kernel, Al Grant

Em Wed, Sep 02, 2020 at 08:39:32AM +0800, Leo Yan escreveu:
> On Tue, Sep 01, 2020 at 11:54:32AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Aug 31, 2020 at 08:04:32AM +0800, Leo Yan escreveu:
> > > On Thu, Aug 27, 2020 at 02:53:54PM -0600, Mathieu Poirier wrote:
> > > > On Wed, Aug 19, 2020 at 04:47:50PM +0800, Leo Yan wrote:
> > > > I've see this patch before...  I thought it had been merged - what happened?

> > > This patch before has been sent by Al to CoreSight mailing list but has
> > > not sent to LKML, this is why I resent it to LKML in case it's missed.

> > So, was it Acked on the CoreSight mailing list? Are we missing any
> > Acked-by or Reviewed-by for this 1/2 patch as we got for 2/2?
 
> The CoreSight mailing list has some discussion for this patch set,
> when respin this patch set, I confirmed we don't miss any 'Acked' or
> 'Reviewed' tags.

So, this patch was included in today's
perf-tools-fixes-for-v5.9-2020-09-01 signed tag sent to Linus in a pull
req, please update your perf/urgent branch, and go on from there, I'll
merge that into my perf/core branch as soon as Linus merges it.

- Arnaldo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from
  2020-09-02  1:47         ` Arnaldo Carvalho de Melo
@ 2020-09-02  2:12           ` Leo Yan
  0 siblings, 0 replies; 11+ messages in thread
From: Leo Yan @ 2020-09-02  2:12 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Mathieu Poirier, Suzuki K Poulose, Mike Leach, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Adrian Hunter, Andi Kleen, Kan Liang,
	linux-arm-kernel, linux-kernel, Al Grant

On Tue, Sep 01, 2020 at 10:47:54PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Sep 02, 2020 at 08:39:32AM +0800, Leo Yan escreveu:
> > On Tue, Sep 01, 2020 at 11:54:32AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, Aug 31, 2020 at 08:04:32AM +0800, Leo Yan escreveu:
> > > > On Thu, Aug 27, 2020 at 02:53:54PM -0600, Mathieu Poirier wrote:
> > > > > On Wed, Aug 19, 2020 at 04:47:50PM +0800, Leo Yan wrote:
> > > > > I've see this patch before...  I thought it had been merged - what happened?
> 
> > > > This patch before has been sent by Al to CoreSight mailing list but has
> > > > not sent to LKML, this is why I resent it to LKML in case it's missed.
> 
> > > So, was it Acked on the CoreSight mailing list? Are we missing any
> > > Acked-by or Reviewed-by for this 1/2 patch as we got for 2/2?
>  
> > The CoreSight mailing list has some discussion for this patch set,
> > when respin this patch set, I confirmed we don't miss any 'Acked' or
> > 'Reviewed' tags.
> 
> So, this patch was included in today's
> perf-tools-fixes-for-v5.9-2020-09-01 signed tag sent to Linus in a pull
> req, please update your perf/urgent branch, and go on from there, I'll
> merge that into my perf/core branch as soon as Linus merges it.

Thanks for the info!

Leo

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-09-02  2:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19  8:47 [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from Leo Yan
2020-08-19  8:47 ` [PATCH 2/2] perf intel-pt: " Leo Yan
2020-08-24 12:41   ` Adrian Hunter
2020-08-31 20:38   ` Mathieu Poirier
2020-09-01 14:53     ` Arnaldo Carvalho de Melo
2020-08-27 20:53 ` [PATCH 1/2] perf cs-etm: " Mathieu Poirier
2020-08-31  0:04   ` Leo Yan
2020-09-01 14:54     ` Arnaldo Carvalho de Melo
2020-09-02  0:39       ` Leo Yan
2020-09-02  1:47         ` Arnaldo Carvalho de Melo
2020-09-02  2:12           ` Leo Yan

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).