linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] perf: cs-etm: Improve missing sink warning message
@ 2023-01-24 11:02 James Clark
  2023-01-24 11:08 ` Suzuki K Poulose
  0 siblings, 1 reply; 3+ messages in thread
From: James Clark @ 2023-01-24 11:02 UTC (permalink / raw)
  To: linux-perf-users, acme, suzuki.poulose
  Cc: linux-kernel, James Clark, Mathieu Poirier, Mike Leach, Leo Yan,
	John Garry, Will Deacon, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	coresight, linux-arm-kernel

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.

Signed-off-by: James Clark <james.clark@arm.com>
---
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(-)

diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index 481e170cd3f1..7f71c8a237ff 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -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
-- 
2.39.1


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

* Re: [PATCH v2] perf: cs-etm: Improve missing sink warning message
  2023-01-24 11:02 [PATCH v2] perf: cs-etm: Improve missing sink warning message James Clark
@ 2023-01-24 11:08 ` Suzuki K Poulose
  2023-01-24 18:35   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Suzuki K Poulose @ 2023-01-24 11:08 UTC (permalink / raw)
  To: James Clark, linux-perf-users, acme
  Cc: linux-kernel, Mathieu Poirier, Mike Leach, Leo Yan, John Garry,
	Will Deacon, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, coresight,
	linux-arm-kernel

On 24/01/2023 11:02, James Clark wrote:
> 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.
> 
> Signed-off-by: James Clark <james.clark@arm.com>

Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com>



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

* Re: [PATCH v2] perf: cs-etm: Improve missing sink warning message
  2023-01-24 11:08 ` Suzuki K Poulose
@ 2023-01-24 18:35   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-01-24 18:35 UTC (permalink / raw)
  To: Suzuki K Poulose
  Cc: James Clark, linux-perf-users, linux-kernel, Mathieu Poirier,
	Mike Leach, Leo Yan, John Garry, Will Deacon, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, coresight, linux-arm-kernel

Em Tue, Jan 24, 2023 at 11:08:32AM +0000, Suzuki K Poulose escreveu:
> On 24/01/2023 11:02, James Clark wrote:
> > 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.
> > 
> > Signed-off-by: James Clark <james.clark@arm.com>
> 
> Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com>

Thanks, applied.

- Arnaldo


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

end of thread, other threads:[~2023-01-24 18:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-24 11:02 [PATCH v2] perf: cs-etm: Improve missing sink warning message James Clark
2023-01-24 11:08 ` Suzuki K Poulose
2023-01-24 18:35   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).