perf cs-etm: Fix corrupt data after perf inject from
PATCH 1/2 perf cs-etm: Fix corrupt data after perf inject from
From: Al Grant <[email protected]>
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.
--- tools/perf/util/cs-etm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/cs-etm.c +8 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 2/2 perf intel-pt: Fix corrupt data after perf inject from
From: Al Grant <[email protected]>
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.
--- tools/perf/util/intel-pt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/intel-pt.c +8 -1
@@ -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 ;
Signature · 1 line
2.17.1
Re: [PATCH 2/2] perf intel-pt: Fix corrupt data after perf inject from
Quoted 10 lines · Leo Yan
From: Al Grant <[email protected]>
Commit
42bbabed09ce("perf tools: Addhw_idxin structbranch_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.
Quoted 3 lines
Fixes 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")Signed-off-by Al Grant <[email protected]>Signed-off-by Leo Yan <[email protected]>
Quoted 26 lines
--- tools/perf/util/intel-pt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)tools/perf/util/intel-pt.c +8
-1@@ -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 ;
Re: [PATCH 2/2] perf intel-pt: Fix corrupt data after perf inject from
In reply to Leo YanQuoted 10 lines · Leo Yan
From: Al Grant <[email protected]>
Commit
42bbabed09ce("perf tools: Addhw_idxin structbranch_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.
Quoted 3 lines
Fixes 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")Signed-off-by Al Grant <[email protected]>Signed-off-by Leo Yan <[email protected]>
Arnaldo, please consider.
Quoted 28 lines
--- tools/perf/util/intel-pt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)tools/perf/util/intel-pt.c +8
-1@@ -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 ;Signature · 1 line
2.17.1
Re: [PATCH 2/2] perf intel-pt: Fix corrupt data after perf inject from
Em Mon, Aug 31, 2020 at 02:38:32PM -0600, Mathieu Poirier escreveu:
Quoted 11 lines · Leo Yan
Quoted 10 lines
From: Al Grant <[email protected]>
Commit
42bbabed09ce("perf tools: Addhw_idxin structbranch_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.
Quoted 7 lines
Quoted 3 lines
Fixes 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack")Signed-off-by Al Grant <[email protected]>Signed-off-by Leo Yan <[email protected]>Arnaldo, please consider.
Reviewed-by Mathieu Poirier <[email protected]>
Thanks, applied, and 1/2 too.
- Arnaldo
Quoted 28 lines
Quoted 28 lines
--- tools/perf/util/intel-pt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)tools/perf/util/intel-pt.c +8
-1@@ -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 ;Signature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
Hi Leo and Al,
Quoted 26 lines · Leo Yan
From: Al Grant <[email protected]>
Commit
42bbabed09ce("perf tools: Addhw_idxin structbranch_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 <[email protected]>Reviewed-by Andrea Brunato <[email protected]>Signed-off-by Leo Yan <[email protected]>--- tools/perf/util/cs-etm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)tools/perf/util/cs-etm.c +0
-0@@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, attr.sample_type &= ~(u64 )PERF_SAMPLE_ADDR ; }
tools/perf/util/cs-etm.c static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, · line 1355
Quoted 10 lines
tools/perf/util/cs-etm.c +8
-1-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
Quoted 6 lines
tools/perf/util/cs-etm.c +0
-0if (etm->synth_opts.instructions) { attr.config =PERF_COUNT_HW_INSTRUCTIONS ;Signature · 1 line
2.17.1
Hi Mathieu,
Quoted 29 lines · Mathieu Poirier
Hi Leo and Al,
Quoted 26 lines · Leo Yan
From: Al Grant <[email protected]>
Commit
42bbabed09ce("perf tools: Addhw_idxin structbranch_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 <[email protected]>Reviewed-by Andrea Brunato <[email protected]>Signed-off-by Leo Yan <[email protected]>--- tools/perf/util/cs-etm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)tools/perf/util/cs-etm.c +0
-0@@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, attr.sample_type &= ~(u64 )PERF_SAMPLE_ADDR ; }
Quoted 12 lines
tools/perf/util/cs-etm.c static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, · line 1355
Quoted 10 lines
tools/perf/util/cs-etm.c +8
-1-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
Arnaldo Carvalho de Melo
maintainerEm Mon, Aug 31, 2020 at 08:04:32AM +0800, Leo Yan escreveu:
Quoted 45 lines
Hi Mathieu,
Quoted 29 lines · Mathieu Poirier
Hi Leo and Al,
Quoted 26 lines · Leo Yan
From: Al Grant <[email protected]>
Commit
42bbabed09ce("perf tools: Addhw_idxin structbranch_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 <[email protected]>Reviewed-by Andrea Brunato <[email protected]>Signed-off-by Leo Yan <[email protected]>--- tools/perf/util/cs-etm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)tools/perf/util/cs-etm.c +0
-0@@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, attr.sample_type &= ~(u64 )PERF_SAMPLE_ADDR ; }Quoted 12 lines
tools/perf/util/cs-etm.c static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, · line 1355
Quoted 10 lines
tools/perf/util/cs-etm.c +8
-1-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?
Quoted 2 lines
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
Hi Arnaldo,
Quoted 46 lines · Arnaldo Carvalho de Melo
Em Mon, Aug 31, 2020 at 08:04:32AM +0800, Leo Yan escreveu:
Quoted 45 lines
Hi Mathieu,
Quoted 41 lines · Mathieu Poirier
Hi Leo and Al,
Quoted 26 lines · Leo Yan
From: Al Grant <[email protected]>
Commit
42bbabed09ce("perf tools: Addhw_idxin structbranch_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 <[email protected]>Reviewed-by Andrea Brunato <[email protected]>Signed-off-by Leo Yan <[email protected]>--- tools/perf/util/cs-etm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)tools/perf/util/cs-etm.c +0
-0@@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, attr.sample_type &= ~(u64 )PERF_SAMPLE_ADDR ; }tools/perf/util/cs-etm.c static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, · line 1355
Quoted 10 lines
tools/perf/util/cs-etm.c +8
-1-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?
Quoted 5 lines
Quoted 2 lines
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
Arnaldo Carvalho de Melo
maintainerEm Wed, Sep 02, 2020 at 08:39:32AM +0800, Leo Yan escreveu:
Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 7 lines
Em Mon, Aug 31, 2020 at 08:04:32AM +0800, Leo Yan escreveu:
Quoted 6 lines · Mathieu Poirier
Quoted 2 lines · Leo Yan
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.
Quoted 6 lines
Quoted 2 lines
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
Quoted 13 lines · Arnaldo Carvalho de Melo
Em Wed, Sep 02, 2020 at 08:39:32AM +0800, Leo Yan escreveu:
Quoted 11 lines · Arnaldo Carvalho de Melo
Quoted 10 lines
Em Mon, Aug 31, 2020 at 08:04:32AM +0800, Leo Yan escreveu:
Quoted 6 lines · Mathieu Poirier
Quoted 2 lines · Leo Yan
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?
Quoted 8 lines
Quoted 3 lines
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