All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event
@ 2022-04-13  9:23 Leo Yan
  2022-04-14  1:27 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: Leo Yan @ 2022-04-13  9:23 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ravi Bangoria, James Clark, German Gomez, linux-perf-users,
	linux-kernel
  Cc: Leo Yan

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 report result if the PERF_SAMPLE_DATA_SRC bit is missed in sample
type.

The commit ffab48705205 ("perf: arm-spe: Fix perf report --mem-mode")
partially fixes the issue.  It adds PERF_SAMPLE_DATA_SRC bit for Arm SPE
event, this allows the perf data file generated by kernel v5.18-rc1 or
later version can be reported properly.

On the other hand, perf tool still fails to be backward compatibility
for a data file recorded by an older version's perf which contains Arm
SPE trace data.  This patch is a workaround in reporting phase, when
detects ARM SPE PMU event and without PERF_SAMPLE_DATA_SRC bit, it will
force to set the bit in the sample type and give a warning info.

Fixes: bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available")
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Tested-by: German Gomez <german.gomez@arm.com>
---
v2: Change event name from "arm_spe_" to "arm_spe";
    Add German's test tag.

 tools/perf/builtin-report.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1ad75c7ba074..acb07a4a9b67 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -353,6 +353,7 @@ static int report__setup_sample_type(struct report *rep)
 	struct perf_session *session = rep->session;
 	u64 sample_type = evlist__combined_sample_type(session->evlist);
 	bool is_pipe = perf_data__is_pipe(session->data);
+	struct evsel *evsel;
 
 	if (session->itrace_synth_opts->callchain ||
 	    session->itrace_synth_opts->add_callchain ||
@@ -407,6 +408,21 @@ static int report__setup_sample_type(struct report *rep)
 	}
 
 	if (sort__mode == SORT_MODE__MEMORY) {
+		/*
+		 * FIXUP: prior to kernel 5.18, Arm SPE missed to set
+		 * PERF_SAMPLE_DATA_SRC bit in sample type.  For backward
+		 * compatibility, set the bit if it's an old perf data file.
+		 */
+		evlist__for_each_entry(session->evlist, evsel) {
+			if (strstr(evsel->name, "arm_spe") &&
+				!(sample_type & PERF_SAMPLE_DATA_SRC)) {
+				ui__warning("PERF_SAMPLE_DATA_SRC bit is not set "
+					    "for Arm SPE event.\n");
+				evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC;
+				sample_type |= PERF_SAMPLE_DATA_SRC;
+			}
+		}
+
 		if (!is_pipe && !(sample_type & PERF_SAMPLE_DATA_SRC)) {
 			ui__error("Selected --mem-mode but no mem data. "
 				  "Did you call perf record without -d?\n");
-- 
2.25.1


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

* Re: [PATCH v2] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event
  2022-04-13  9:23 [PATCH v2] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event Leo Yan
@ 2022-04-14  1:27 ` Arnaldo Carvalho de Melo
  2022-04-14 10:29   ` James Clark
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-14  1:27 UTC (permalink / raw)
  To: Leo Yan
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ravi Bangoria, James Clark,
	German Gomez, linux-perf-users, linux-kernel

Em Wed, Apr 13, 2022 at 05:23:17PM +0800, Leo Yan escreveu:
> 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 report result if the PERF_SAMPLE_DATA_SRC bit is missed in sample
> type.
> 
> The commit ffab48705205 ("perf: arm-spe: Fix perf report --mem-mode")
> partially fixes the issue.  It adds PERF_SAMPLE_DATA_SRC bit for Arm SPE
> event, this allows the perf data file generated by kernel v5.18-rc1 or
> later version can be reported properly.
> 
> On the other hand, perf tool still fails to be backward compatibility
> for a data file recorded by an older version's perf which contains Arm
> SPE trace data.  This patch is a workaround in reporting phase, when
> detects ARM SPE PMU event and without PERF_SAMPLE_DATA_SRC bit, it will
> force to set the bit in the sample type and give a warning info.
> 
> Fixes: bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available")
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> Tested-by: German Gomez <german.gomez@arm.com>
> ---
> v2: Change event name from "arm_spe_" to "arm_spe";
>     Add German's test tag.

Tentatively applied, would be great to have James' and Ravi's
Acked-by/Reviewed-by, which I'll add before pushing this out if provided
in time.

- Arnaldo
 
>  tools/perf/builtin-report.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 1ad75c7ba074..acb07a4a9b67 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -353,6 +353,7 @@ static int report__setup_sample_type(struct report *rep)
>  	struct perf_session *session = rep->session;
>  	u64 sample_type = evlist__combined_sample_type(session->evlist);
>  	bool is_pipe = perf_data__is_pipe(session->data);
> +	struct evsel *evsel;
>  
>  	if (session->itrace_synth_opts->callchain ||
>  	    session->itrace_synth_opts->add_callchain ||
> @@ -407,6 +408,21 @@ static int report__setup_sample_type(struct report *rep)
>  	}
>  
>  	if (sort__mode == SORT_MODE__MEMORY) {
> +		/*
> +		 * FIXUP: prior to kernel 5.18, Arm SPE missed to set
> +		 * PERF_SAMPLE_DATA_SRC bit in sample type.  For backward
> +		 * compatibility, set the bit if it's an old perf data file.
> +		 */
> +		evlist__for_each_entry(session->evlist, evsel) {
> +			if (strstr(evsel->name, "arm_spe") &&
> +				!(sample_type & PERF_SAMPLE_DATA_SRC)) {
> +				ui__warning("PERF_SAMPLE_DATA_SRC bit is not set "
> +					    "for Arm SPE event.\n");
> +				evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC;
> +				sample_type |= PERF_SAMPLE_DATA_SRC;
> +			}
> +		}
> +
>  		if (!is_pipe && !(sample_type & PERF_SAMPLE_DATA_SRC)) {
>  			ui__error("Selected --mem-mode but no mem data. "
>  				  "Did you call perf record without -d?\n");
> -- 
> 2.25.1

-- 

- Arnaldo

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

* Re: [PATCH v2] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event
  2022-04-14  1:27 ` Arnaldo Carvalho de Melo
@ 2022-04-14 10:29   ` James Clark
  2022-04-14 11:01     ` Leo Yan
  2022-04-14 11:52     ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 6+ messages in thread
From: James Clark @ 2022-04-14 10:29 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Leo Yan
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ravi Bangoria, German Gomez,
	linux-perf-users, linux-kernel



On 14/04/2022 02:27, Arnaldo Carvalho de Melo wrote:
> Em Wed, Apr 13, 2022 at 05:23:17PM +0800, Leo Yan escreveu:
>> 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 report result if the PERF_SAMPLE_DATA_SRC bit is missed in sample
>> type.
>>
>> The commit ffab48705205 ("perf: arm-spe: Fix perf report --mem-mode")
>> partially fixes the issue.  It adds PERF_SAMPLE_DATA_SRC bit for Arm SPE
>> event, this allows the perf data file generated by kernel v5.18-rc1 or
>> later version can be reported properly.
>>
>> On the other hand, perf tool still fails to be backward compatibility
>> for a data file recorded by an older version's perf which contains Arm
>> SPE trace data.  This patch is a workaround in reporting phase, when
>> detects ARM SPE PMU event and without PERF_SAMPLE_DATA_SRC bit, it will
>> force to set the bit in the sample type and give a warning info.
>>
>> Fixes: bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available")
>> Signed-off-by: Leo Yan <leo.yan@linaro.org>
>> Tested-by: German Gomez <german.gomez@arm.com>
>> ---
>> v2: Change event name from "arm_spe_" to "arm_spe";
>>     Add German's test tag.
> 
> Tentatively applied, would be great to have James' and Ravi's
> Acked-by/Reviewed-by, which I'll add before pushing this out if provided
> in time.
> 
> - Arnaldo
>  
>>  tools/perf/builtin-report.c | 16 ++++++++++++++++
>>  1 file changed, 16 insertions(+)
>>
>> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
>> index 1ad75c7ba074..acb07a4a9b67 100644
>> --- a/tools/perf/builtin-report.c
>> +++ b/tools/perf/builtin-report.c
>> @@ -353,6 +353,7 @@ static int report__setup_sample_type(struct report *rep)
>>  	struct perf_session *session = rep->session;
>>  	u64 sample_type = evlist__combined_sample_type(session->evlist);
>>  	bool is_pipe = perf_data__is_pipe(session->data);
>> +	struct evsel *evsel;
>>  
>>  	if (session->itrace_synth_opts->callchain ||
>>  	    session->itrace_synth_opts->add_callchain ||
>> @@ -407,6 +408,21 @@ static int report__setup_sample_type(struct report *rep)
>>  	}
>>  
>>  	if (sort__mode == SORT_MODE__MEMORY) {
>> +		/*
>> +		 * FIXUP: prior to kernel 5.18, Arm SPE missed to set
>> +		 * PERF_SAMPLE_DATA_SRC bit in sample type.  For backward
>> +		 * compatibility, set the bit if it's an old perf data file.
>> +		 */
>> +		evlist__for_each_entry(session->evlist, evsel) {
>> +			if (strstr(evsel->name, "arm_spe") &&
>> +				!(sample_type & PERF_SAMPLE_DATA_SRC)) {
>> +				ui__warning("PERF_SAMPLE_DATA_SRC bit is not set "
>> +					    "for Arm SPE event.\n");

Looks ok to me. Personally I would remove the warning, otherwise people are going to start
thinking that they need to do something about it or something bad has happened.

But because we've fixed it up there shouldn't really need to be a warning or any action.

I don't feel too strongly about this though, so I will leave it up to Leo to make the
final decision:

Reviewed-by: James Clark <james.clark@arm.com>

>> +				evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC;
>> +				sample_type |= PERF_SAMPLE_DATA_SRC;
>> +			}
>> +		}
>> +
>>  		if (!is_pipe && !(sample_type & PERF_SAMPLE_DATA_SRC)) {
>>  			ui__error("Selected --mem-mode but no mem data. "
>>  				  "Did you call perf record without -d?\n");
>> -- 
>> 2.25.1
> 

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

* Re: [PATCH v2] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event
  2022-04-14 10:29   ` James Clark
@ 2022-04-14 11:01     ` Leo Yan
  2022-04-14 11:52       ` Arnaldo Carvalho de Melo
  2022-04-14 11:52     ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 6+ messages in thread
From: Leo Yan @ 2022-04-14 11:01 UTC (permalink / raw)
  To: James Clark
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ravi Bangoria, German Gomez, linux-perf-users, linux-kernel

On Thu, Apr 14, 2022 at 11:29:48AM +0100, James Clark wrote:
> On 14/04/2022 02:27, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Apr 13, 2022 at 05:23:17PM +0800, Leo Yan escreveu:
> >> 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 report result if the PERF_SAMPLE_DATA_SRC bit is missed in sample
> >> type.
> >>
> >> The commit ffab48705205 ("perf: arm-spe: Fix perf report --mem-mode")
> >> partially fixes the issue.  It adds PERF_SAMPLE_DATA_SRC bit for Arm SPE
> >> event, this allows the perf data file generated by kernel v5.18-rc1 or
> >> later version can be reported properly.
> >>
> >> On the other hand, perf tool still fails to be backward compatibility
> >> for a data file recorded by an older version's perf which contains Arm
> >> SPE trace data.  This patch is a workaround in reporting phase, when
> >> detects ARM SPE PMU event and without PERF_SAMPLE_DATA_SRC bit, it will
> >> force to set the bit in the sample type and give a warning info.
> >>
> >> Fixes: bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available")
> >> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> >> Tested-by: German Gomez <german.gomez@arm.com>
> >> ---
> >> v2: Change event name from "arm_spe_" to "arm_spe";
> >>     Add German's test tag.
> > 
> > Tentatively applied, would be great to have James' and Ravi's
> > Acked-by/Reviewed-by, which I'll add before pushing this out if provided
> > in time.
> > 
> > - Arnaldo
> >  
> >>  tools/perf/builtin-report.c | 16 ++++++++++++++++
> >>  1 file changed, 16 insertions(+)
> >>
> >> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> >> index 1ad75c7ba074..acb07a4a9b67 100644
> >> --- a/tools/perf/builtin-report.c
> >> +++ b/tools/perf/builtin-report.c
> >> @@ -353,6 +353,7 @@ static int report__setup_sample_type(struct report *rep)
> >>  	struct perf_session *session = rep->session;
> >>  	u64 sample_type = evlist__combined_sample_type(session->evlist);
> >>  	bool is_pipe = perf_data__is_pipe(session->data);
> >> +	struct evsel *evsel;
> >>  
> >>  	if (session->itrace_synth_opts->callchain ||
> >>  	    session->itrace_synth_opts->add_callchain ||
> >> @@ -407,6 +408,21 @@ static int report__setup_sample_type(struct report *rep)
> >>  	}
> >>  
> >>  	if (sort__mode == SORT_MODE__MEMORY) {
> >> +		/*
> >> +		 * FIXUP: prior to kernel 5.18, Arm SPE missed to set
> >> +		 * PERF_SAMPLE_DATA_SRC bit in sample type.  For backward
> >> +		 * compatibility, set the bit if it's an old perf data file.
> >> +		 */
> >> +		evlist__for_each_entry(session->evlist, evsel) {
> >> +			if (strstr(evsel->name, "arm_spe") &&
> >> +				!(sample_type & PERF_SAMPLE_DATA_SRC)) {
> >> +				ui__warning("PERF_SAMPLE_DATA_SRC bit is not set "
> >> +					    "for Arm SPE event.\n");
> 
> Looks ok to me. Personally I would remove the warning, otherwise people are going to start
> thinking that they need to do something about it or something bad has happened.
> 
> But because we've fixed it up there shouldn't really need to be a warning or any action.

Understand.  The warning is not bad for developers but it might
introduce confusion for users, and if we really want to check the sample
type then we can use 'perf evlist' command, so it's not very useful for
the warning.

I will remove the warning and resend a new patch.

> I don't feel too strongly about this though, so I will leave it up to Leo to make the
> final decision:
> 
> Reviewed-by: James Clark <james.clark@arm.com>

Thanks a lot for reviewing.
Leo

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

* Re: [PATCH v2] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event
  2022-04-14 10:29   ` James Clark
  2022-04-14 11:01     ` Leo Yan
@ 2022-04-14 11:52     ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-14 11:52 UTC (permalink / raw)
  To: James Clark
  Cc: Leo Yan, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ravi Bangoria,
	German Gomez, linux-perf-users, linux-kernel

Em Thu, Apr 14, 2022 at 11:29:48AM +0100, James Clark escreveu:
> 
> 
> On 14/04/2022 02:27, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Apr 13, 2022 at 05:23:17PM +0800, Leo Yan escreveu:
> >> 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 report result if the PERF_SAMPLE_DATA_SRC bit is missed in sample
> >> type.
> >>
> >> The commit ffab48705205 ("perf: arm-spe: Fix perf report --mem-mode")
> >> partially fixes the issue.  It adds PERF_SAMPLE_DATA_SRC bit for Arm SPE
> >> event, this allows the perf data file generated by kernel v5.18-rc1 or
> >> later version can be reported properly.
> >>
> >> On the other hand, perf tool still fails to be backward compatibility
> >> for a data file recorded by an older version's perf which contains Arm
> >> SPE trace data.  This patch is a workaround in reporting phase, when
> >> detects ARM SPE PMU event and without PERF_SAMPLE_DATA_SRC bit, it will
> >> force to set the bit in the sample type and give a warning info.
> >>
> >> Fixes: bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available")
> >> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> >> Tested-by: German Gomez <german.gomez@arm.com>
> >> ---
> >> v2: Change event name from "arm_spe_" to "arm_spe";
> >>     Add German's test tag.
> > 
> > Tentatively applied, would be great to have James' and Ravi's
> > Acked-by/Reviewed-by, which I'll add before pushing this out if provided
> > in time.
> > 
> > - Arnaldo
> >  
> >>  tools/perf/builtin-report.c | 16 ++++++++++++++++
> >>  1 file changed, 16 insertions(+)
> >>
> >> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> >> index 1ad75c7ba074..acb07a4a9b67 100644
> >> --- a/tools/perf/builtin-report.c
> >> +++ b/tools/perf/builtin-report.c
> >> @@ -353,6 +353,7 @@ static int report__setup_sample_type(struct report *rep)
> >>  	struct perf_session *session = rep->session;
> >>  	u64 sample_type = evlist__combined_sample_type(session->evlist);
> >>  	bool is_pipe = perf_data__is_pipe(session->data);
> >> +	struct evsel *evsel;
> >>  
> >>  	if (session->itrace_synth_opts->callchain ||
> >>  	    session->itrace_synth_opts->add_callchain ||
> >> @@ -407,6 +408,21 @@ static int report__setup_sample_type(struct report *rep)
> >>  	}
> >>  
> >>  	if (sort__mode == SORT_MODE__MEMORY) {
> >> +		/*
> >> +		 * FIXUP: prior to kernel 5.18, Arm SPE missed to set
> >> +		 * PERF_SAMPLE_DATA_SRC bit in sample type.  For backward
> >> +		 * compatibility, set the bit if it's an old perf data file.
> >> +		 */
> >> +		evlist__for_each_entry(session->evlist, evsel) {
> >> +			if (strstr(evsel->name, "arm_spe") &&
> >> +				!(sample_type & PERF_SAMPLE_DATA_SRC)) {
> >> +				ui__warning("PERF_SAMPLE_DATA_SRC bit is not set "
> >> +					    "for Arm SPE event.\n");
> 
> Looks ok to me. Personally I would remove the warning, otherwise people are going to start
> thinking that they need to do something about it or something bad has happened.
> 
> But because we've fixed it up there shouldn't really need to be a warning or any action.
> 
> I don't feel too strongly about this though, so I will leave it up to Leo to make the
> final decision:
> 
> Reviewed-by: James Clark <james.clark@arm.com>

Thanks, collecting your review,

- Arnaldo

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

* Re: [PATCH v2] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event
  2022-04-14 11:01     ` Leo Yan
@ 2022-04-14 11:52       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-14 11:52 UTC (permalink / raw)
  To: Leo Yan
  Cc: James Clark, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ravi Bangoria,
	German Gomez, linux-perf-users, linux-kernel

Em Thu, Apr 14, 2022 at 07:01:24PM +0800, Leo Yan escreveu:
> On Thu, Apr 14, 2022 at 11:29:48AM +0100, James Clark wrote:
> > On 14/04/2022 02:27, Arnaldo Carvalho de Melo wrote:
> > > Em Wed, Apr 13, 2022 at 05:23:17PM +0800, Leo Yan escreveu:
> > >> 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 report result if the PERF_SAMPLE_DATA_SRC bit is missed in sample
> > >> type.
> > >>
> > >> The commit ffab48705205 ("perf: arm-spe: Fix perf report --mem-mode")
> > >> partially fixes the issue.  It adds PERF_SAMPLE_DATA_SRC bit for Arm SPE
> > >> event, this allows the perf data file generated by kernel v5.18-rc1 or
> > >> later version can be reported properly.
> > >>
> > >> On the other hand, perf tool still fails to be backward compatibility
> > >> for a data file recorded by an older version's perf which contains Arm
> > >> SPE trace data.  This patch is a workaround in reporting phase, when
> > >> detects ARM SPE PMU event and without PERF_SAMPLE_DATA_SRC bit, it will
> > >> force to set the bit in the sample type and give a warning info.
> > >>
> > >> Fixes: bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available")
> > >> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > >> Tested-by: German Gomez <german.gomez@arm.com>
> > >> ---
> > >> v2: Change event name from "arm_spe_" to "arm_spe";
> > >>     Add German's test tag.
> > > 
> > > Tentatively applied, would be great to have James' and Ravi's
> > > Acked-by/Reviewed-by, which I'll add before pushing this out if provided
> > > in time.
> > > 
> > > - Arnaldo
> > >  
> > >>  tools/perf/builtin-report.c | 16 ++++++++++++++++
> > >>  1 file changed, 16 insertions(+)
> > >>
> > >> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> > >> index 1ad75c7ba074..acb07a4a9b67 100644
> > >> --- a/tools/perf/builtin-report.c
> > >> +++ b/tools/perf/builtin-report.c
> > >> @@ -353,6 +353,7 @@ static int report__setup_sample_type(struct report *rep)
> > >>  	struct perf_session *session = rep->session;
> > >>  	u64 sample_type = evlist__combined_sample_type(session->evlist);
> > >>  	bool is_pipe = perf_data__is_pipe(session->data);
> > >> +	struct evsel *evsel;
> > >>  
> > >>  	if (session->itrace_synth_opts->callchain ||
> > >>  	    session->itrace_synth_opts->add_callchain ||
> > >> @@ -407,6 +408,21 @@ static int report__setup_sample_type(struct report *rep)
> > >>  	}
> > >>  
> > >>  	if (sort__mode == SORT_MODE__MEMORY) {
> > >> +		/*
> > >> +		 * FIXUP: prior to kernel 5.18, Arm SPE missed to set
> > >> +		 * PERF_SAMPLE_DATA_SRC bit in sample type.  For backward
> > >> +		 * compatibility, set the bit if it's an old perf data file.
> > >> +		 */
> > >> +		evlist__for_each_entry(session->evlist, evsel) {
> > >> +			if (strstr(evsel->name, "arm_spe") &&
> > >> +				!(sample_type & PERF_SAMPLE_DATA_SRC)) {
> > >> +				ui__warning("PERF_SAMPLE_DATA_SRC bit is not set "
> > >> +					    "for Arm SPE event.\n");
> > 
> > Looks ok to me. Personally I would remove the warning, otherwise people are going to start
> > thinking that they need to do something about it or something bad has happened.
> > 
> > But because we've fixed it up there shouldn't really need to be a warning or any action.
> 
> Understand.  The warning is not bad for developers but it might
> introduce confusion for users, and if we really want to check the sample
> type then we can use 'perf evlist' command, so it's not very useful for
> the warning.
> 
> I will remove the warning and resend a new patch.

Waiting then
 
> > I don't feel too strongly about this though, so I will leave it up to Leo to make the
> > final decision:
> > 
> > Reviewed-by: James Clark <james.clark@arm.com>
> 
> Thanks a lot for reviewing.
> Leo

-- 

- Arnaldo

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

end of thread, other threads:[~2022-04-14 11:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13  9:23 [PATCH v2] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event Leo Yan
2022-04-14  1:27 ` Arnaldo Carvalho de Melo
2022-04-14 10:29   ` James Clark
2022-04-14 11:01     ` Leo Yan
2022-04-14 11:52       ` Arnaldo Carvalho de Melo
2022-04-14 11:52     ` Arnaldo Carvalho de Melo

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.