Skip to contentSkip to conversation

perf report: remove warning on missing raw data for s390

PATCH Applied Thomas Richter 3 participants 3 messages Nov 22, 2023 – Nov 27, 2023 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf report: remove warning on missing raw data for s390

Command

 # ./perf report -i /tmp/111 -D > /dev/null
emits an error message when a sample for event CRYPTO_ALL in the
perf.data file does not contain any raw data. This is ok.
Do not trigger this warning when the sample in the perf.data files
does not contain any raw data at all.
Check for availability of raw data for all events and return if
none is available.

Output before:

 # ./perf report -i /tmp/111 -D > /dev/null
 Invalid CRYPTO_ALL raw data encountered
 Invalid CRYPTO_ALL raw data encountered
 Invalid CRYPTO_ALL raw data encountered
 #

Output after:

 # ./perf report -i /tmp/111 -D > /dev/null
 #
Fixes b539deafbadb ("perf report: Add s390 raw data interpretation for PAI counters")
---
 tools/perf/util/s390-sample-raw.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/perf/util/s390-sample-raw.c +5 -4
index 29a744eeb71e..53383e97ec9d 100644
@@ -51,8 +51,6 @@ static bool s390_cpumcfdg_testctr(struct perf_sample *sample)
 	struct cf_trailer_entry *te;
 	struct cf_ctrset_entry *cep, ce;
 
-	if (!len)
-		return false;
 	while (offset < len) {
 		cep = (struct cf_ctrset_entry *)(buf + offset);
 		ce.def = be16_to_cpu(cep->def);
@@ -234,10 +232,9 @@ struct pai_data {		/* Event number and value */
  */
 static bool s390_pai_all_test(struct perf_sample *sample)
 {
-	unsigned char *buf = sample->raw_data;
 	size_t len = sample->raw_size;
 
-	if (len < 0xa || !buf)
+	if (len < 0xa)
 		return false;
 	return true;
 }
@@ -299,6 +296,10 @@ void evlist__s390_sample_raw(struct evlist *evlist, union perf_event *event,
 	if (!evsel)
 		return;
 
+	/* Check for raw data in sample */
+	if (!sample->raw_size || !sample->raw_data)
+		return;
+
 	/* Display raw data on screen */
 	if (evsel->core.attr.config == PERF_EVENT_CPUM_CF_DIAG) {
 		if (!evsel->pmu)
Signature · 1 line
2.41.0
maintainer Acked-by on v1 1/1
#1 lore raw

Hello,

Quoted 17 lines · Thomas Richter

Command

 # ./perf report -i /tmp/111 -D > /dev/null
emits an error message when a sample for event CRYPTO_ALL in the
perf.data file does not contain any raw data. This is ok.
Do not trigger this warning when the sample in the perf.data files
does not contain any raw data at all.
Check for availability of raw data for all events and return if
none is available.

Output before:

 # ./perf report -i /tmp/111 -D > /dev/null
 Invalid CRYPTO_ALL raw data encountered
 Invalid CRYPTO_ALL raw data encountered
 Invalid CRYPTO_ALL raw data encountered
 #
Quoted 7 lines

Output after:

 # ./perf report -i /tmp/111 -D > /dev/null
 #
Fixes b539deafbadb ("perf report: Add s390 raw data interpretation for PAI counters")
Quoted 30 lines
---
 tools/perf/util/s390-sample-raw.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/perf/util/s390-sample-raw.c +1 -4
index 29a744eeb71e..53383e97ec9d 100644
@@ -51,8 +51,6 @@ static bool s390_cpumcfdg_testctr(struct perf_sample *sample)
        struct cf_trailer_entry *te;
        struct cf_ctrset_entry *cep, ce;
 
-       if (!len)
-               return false;
        while (offset < len) {
                cep = (struct cf_ctrset_entry *)(buf + offset);
                ce.def = be16_to_cpu(cep->def);
@@ -234,10 +232,9 @@ struct pai_data {          /* Event number and value */
  */
 static bool s390_pai_all_test(struct perf_sample *sample)
 {
-       unsigned char *buf = sample->raw_data;
        size_t len = sample->raw_size;
 
-       if (len < 0xa || !buf)
+       if (len < 0xa)
                return false;
        return true;
 }

tools/perf/util/s390-sample-raw.c void evlist__s390_sample_raw(struct evlist *evlist, union perf_event *event, · line 301

Quoted 6 lines
tools/perf/util/s390-sample-raw.c +3 -0
@@ -299,6 +296,10 @@ void evlist__s390_sample_raw(struct evlist *evlist, union perf_event *event,
        if (!evsel)
                return;
 
+       /* Check for raw data in sample */
+       if (!sample->raw_size || !sample->raw_data)
+               return;

I was thinking it should check if evsel->attr.sample_type has PERF_SAMPLE_RAW. But evsel__parse_sample() sets the sample->raw_data and ->raw_size only if it has the flag. So I think it's fine.

Thanks,
Namhyung

Quoted 8 lines
tools/perf/util/s390-sample-raw.c +1 -1
+
        /* Display raw data on screen */
        if (evsel->core.attr.config == PERF_EVENT_CPUM_CF_DIAG) {
                if (!evsel->pmu)
--

2.41.0

maintainer Applied
#2 lore raw

Em Wed, Nov 22, 2023 at 06:34:14PM -0800, Namhyung Kim escreveu:

Quoted 24 lines

Hello,

Quoted 21 lines · Thomas Richter

Command

 # ./perf report -i /tmp/111 -D > /dev/null
emits an error message when a sample for event CRYPTO_ALL in the
perf.data file does not contain any raw data. This is ok.
Do not trigger this warning when the sample in the perf.data files
does not contain any raw data at all.
Check for availability of raw data for all events and return if
none is available.

Output before:

 # ./perf report -i /tmp/111 -D > /dev/null
 Invalid CRYPTO_ALL raw data encountered
 Invalid CRYPTO_ALL raw data encountered
 Invalid CRYPTO_ALL raw data encountered
 #

Output after:

 # ./perf report -i /tmp/111 -D > /dev/null
 #
Quoted 5 lines
Quoted 3 lines
Fixes b539deafbadb ("perf report: Add s390 raw data interpretation for PAI counters")

Thanks, applied to perf-tools-next.

- Arnaldo