perf: arm-spe: Fix perf report --mem-mode
Subsystems (2)
PATCH 1/1 perf: arm-spe: Fix perf report --mem-mode
Since commit bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available") "perf mem report" and "perf report --mem-mode" don't allow opening the file unless one of the events has PERF_SAMPLE_DATA_SRC set.
SPE doesn't have this set even though synthetic memory data is generated after it is decoded. Fix this issue by setting DATA_SRC on SPE events. This has no effect on the data collected because the SPE driver doesn't do anything with that flag and doesn't generate samples.
--- tools/perf/arch/arm64/util/arm-spe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/arch/arm64/util/arm-spe.c +6 -1
@@ -239,6 +239,12 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,arm_spe_set_timestamp (itr, arm_spe_evsel); } +/* +* Set this only so that perf report knows that SPE generates memory info. It has no effect +* on the opening of the event or the SPE data produced. +*/ +evsel__set_sample_bit (arm_spe_evsel,DATA_SRC ); +/* Add dummy event to keep tracking */ err =parse_events (evlist,"dummy:u" ,NULL );if (err)
@@ -523,6 +529,5 @@ struct perf_event_attr arm_spe_pmu->selectable = true; arm_spe_pmu->is_uncore = false; -return attr; }
Signature · 1 line
2.28.0
Hello,
Quoted 6 lines · James Clark
Since commit
bb30acae4c4d("perf report: Bail out --mem-mode if mem info is not available") "perf mem report" and "perf report --mem-mode" don't allow opening the file unless one of the events hasPERF_SAMPLE_DATA_SRCset.
Quoted 7 lines
SPE doesn't have this set even though synthetic memory data is generated after it is decoded. Fix this issue by setting
DATA_SRCon SPE events. This has no effect on the data collected because the SPE driver doesn't do anything with that flag and doesn't generate samples.Fixes bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available")Signed-off-by James Clark <[email protected]>
Thanks,
Namhyung
Quoted 31 lines
--- tools/perf/arch/arm64/util/arm-spe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)tools/perf/arch/arm64/util/arm-spe.c +6
-2@@ -239,6 +239,12 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,arm_spe_set_timestamp (itr, arm_spe_evsel); } +/* +* Set this only so that perf report knows that SPE generates memory info. It has no effect +* on the opening of the event or the SPE data produced. +*/ +evsel__set_sample_bit (arm_spe_evsel,DATA_SRC ); +/* Add dummy event to keep tracking */ err =parse_events (evlist,"dummy:u" ,NULL );if (err)@@ -523,6 +529,5 @@ struct perf_event_attr arm_spe_pmu->selectable = true; arm_spe_pmu->is_uncore = false; -return attr; } --2.28.0
Leo Yan
Tested-byQuoted 14 lines · Namhyung Kim
Hello,
Quoted 11 lines · James Clark
Since commit
bb30acae4c4d("perf report: Bail out --mem-mode if mem info is not available") "perf mem report" and "perf report --mem-mode" don't allow opening the file unless one of the events hasPERF_SAMPLE_DATA_SRCset.SPE doesn't have this set even though synthetic memory data is generated after it is decoded. Fix this issue by setting
DATA_SRCon SPE events. This has no effect on the data collected because the SPE driver doesn't do anything with that flag and doesn't generate samples.
Quoted 4 lines
Quoted 2 lines
Fixes bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available")Signed-off-by James Clark <[email protected]>Acked-by Namhyung Kim <[email protected]>
It's a bit awkward that after the commit bb30acae4c4d we cannot be backward compatible and any old perf data file will be failed to support by 'perf mem report' tool.
Thanks,
Leo
Arnaldo Carvalho de Melo
maintainerEm Sat, Apr 09, 2022 at 05:59:41PM +0800, Leo Yan escreveu:
Quoted 18 lines · Namhyung Kim
Quoted 17 lines
Hello,
Quoted 13 lines · James Clark
Since commit
bb30acae4c4d("perf report: Bail out --mem-mode if mem info is not available") "perf mem report" and "perf report --mem-mode" don't allow opening the file unless one of the events hasPERF_SAMPLE_DATA_SRCset.SPE doesn't have this set even though synthetic memory data is generated after it is decoded. Fix this issue by setting
DATA_SRCon SPE events. This has no effect on the data collected because the SPE driver doesn't do anything with that flag and doesn't generate samples.Fixes bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available")Signed-off-by James Clark <[email protected]>
Quoted 7 lines
Quoted 1 line
Acked-by Namhyung Kim <[email protected]>Tested-by Leo Yan <[email protected]>It's a bit awkward that after the commit
bb30acae4c4dwe cannot be backward compatible and any old perf data file will be failed to support by 'perf mem report' tool.
oh well, I think we should put in place a mechanism to run perf record before some change, then make sure that a new perf is able to process it after a rebuild.
If its something unsurmountable, then a proper explanation should be done with a workaround to process those older files, even if pointing out to the perf version that is able to process the old file.
Anyway, applying this pa tch.
- ARnaldo
Quoted 27 lines · Arnaldo Carvalho de Melo
Em Sat, Apr 09, 2022 at 05:59:41PM +0800, Leo Yan escreveu:
Quoted 18 lines · Namhyung Kim
Quoted 17 lines
Hello,
Quoted 13 lines · James Clark
Since commit
bb30acae4c4d("perf report: Bail out --mem-mode if mem info is not available") "perf mem report" and "perf report --mem-mode" don't allow opening the file unless one of the events hasPERF_SAMPLE_DATA_SRCset.SPE doesn't have this set even though synthetic memory data is generated after it is decoded. Fix this issue by setting
DATA_SRCon SPE events. This has no effect on the data collected because the SPE driver doesn't do anything with that flag and doesn't generate samples.Fixes bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available")Signed-off-by James Clark <[email protected]>Quoted 7 lines
Quoted 1 line
Acked-by Namhyung Kim <[email protected]>Tested-by Leo Yan <[email protected]>It's a bit awkward that after the commit
bb30acae4c4dwe cannot be backward compatible and any old perf data file will be failed to support by 'perf mem report' tool.
Quoted 7 lines
oh well, I think we should put in place a mechanism to run perf record before some change, then make sure that a new perf is able to process it after a rebuild.
If its something unsurmountable, then a proper explanation should be done with a workaround to process those older files, even if pointing out to the perf version that is able to process the old file.
I will follow up to add a sub test case for Arm SPE with 'perf mem'.
I tried to find possible workround for old perf data files but failed, the 'perf mem' tool reports error in a very early time so I cannot add workaround in Arm SPE specific code (e.g. arm_spe_process_auxtrace_info()). I will check furthermore, as a backup will send a patch to remind suitable perf version.
A backlog task for me is to setup an automatic testing envoirnment for daily testing perf on Arm64. I will setup an automatic testing for this.
Quoted 1 line
Anyway, applying this pa tch.
Thanks!
Leo