Skip to contentSkip to conversation

perf: cs-etm: Improve missing sink warning message

PATCH Applied James Clark 3 participants 3 messages Jan 24, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 perf: cs-etm: Improve missing sink warning message

Make the sink error message more similar to the event error message that reminds about missing kernel support. The available sinks are also determined by the hardware so mention that too.

Also, usually it's not necessary to specify the sink, so add that as a hint.

Now the error for a made up sink looks like this:

  $ perf record -e cs_etm/@abc/
  Couldn't find sink "abc" on event cs_etm/@abc/.
  Missing kernel or device support?

Hint: An appropriate sink will be picked automatically if one isn't is specified.

For any error other than ENOENT, the same message as before is displayed.

---
V1 -> V2: Keep old error message unless it's ENOENT

 tools/perf/arch/arm/util/cs-etm.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
tools/perf/arch/arm/util/cs-etm.c +9 -3
index 481e170cd3f1..7f71c8a237ff 100644
@@ -283,9 +283,15 @@ static int cs_etm_set_sink_attr(struct perf_pmu *pmu,
 
 		ret = perf_pmu__scan_file(pmu, path, "%x", &hash);
 		if (ret != 1) {
-			pr_err("failed to set sink \"%s\" on event %s with %d (%s)\n",
-			       sink, evsel__name(evsel), errno,
-			       str_error_r(errno, msg, sizeof(msg)));
+			if (errno == ENOENT)
+				pr_err("Couldn't find sink \"%s\" on event %s\n"
+				       "Missing kernel or device support?\n\n"
+				       "Hint: An appropriate sink will be picked automatically if one isn't specified.\n",
+				       sink, evsel__name(evsel));
+			else
+				pr_err("Failed to set sink \"%s\" on event %s with %d (%s)\n",
+				       sink, evsel__name(evsel), errno,
+				       str_error_r(errno, msg, sizeof(msg)));
 			return ret;
 		}
 

base-commit: 5670ebf54bd26482f57a094c53bdc562c106e0a9

Signature · 1 line
2.39.1
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 13 lines · James Clark

Make the sink error message more similar to the event error message that reminds about missing kernel support. The available sinks are also determined by the hardware so mention that too.

Also, usually it's not necessary to specify the sink, so add that as a hint.

Now the error for a made up sink looks like this:

   $ perf record -e cs_etm/@abc/
   Couldn't find sink "abc" on event cs_etm/@abc/.
   Missing kernel or device support?
Quoted 6 lines

Hint: An appropriate sink will be picked automatically if one isn't is specified.

For any error other than ENOENT, the same message as before is displayed.

maintainer Applied
#2 lore raw

Em Tue, Jan 24, 2023 at 11:08:32AM +0000, Suzuki K Poulose escreveu:

Quoted 14 lines · James Clark
Quoted 13 lines

Make the sink error message more similar to the event error message that reminds about missing kernel support. The available sinks are also determined by the hardware so mention that too.

Also, usually it's not necessary to specify the sink, so add that as a hint.

Now the error for a made up sink looks like this:

   $ perf record -e cs_etm/@abc/
   Couldn't find sink "abc" on event cs_etm/@abc/.
   Missing kernel or device support?
Quoted 8 lines
Quoted 6 lines

Hint: An appropriate sink will be picked automatically if one isn't is specified.

For any error other than ENOENT, the same message as before is displayed.

Thanks, applied.

- Arnaldo