public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf record: Change error message on failure
@ 2012-09-13 10:20 Robert Richter
  2012-09-13 15:07 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Richter @ 2012-09-13 10:20 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Ingo Molnar, linux-kernel, Robert Richter

Only report

 No CONFIG_PERF_EVENTS=y kernel support configured?

if the syscall fails with ENOSYS. In other cases CONFIG_PERF_EVENTS is
set and might confuse users. The default message is now:

 Not all events could be opened.

Signed-off-by: Robert Richter <robert.richter@amd.com>
---
 tools/perf/builtin-record.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ae7c1c9..0290c91 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -305,19 +305,19 @@ try_again:
 			error("sys_perf_event_open() syscall returned with %d (%s).  /bin/dmesg may provide additional information.\n",
 			      err, strerror(err));
 
+			if (err == ENOSYS)
+				pr_err("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
 #if defined(__i386__) || defined(__x86_64__)
-			if (attr->type == PERF_TYPE_HARDWARE &&
-			    err == EOPNOTSUPP) {
+			else if (attr->type == PERF_TYPE_HARDWARE &&
+				 err == EOPNOTSUPP)
 				pr_err("No hardware sampling interrupt available."
 				       " No APIC? If so then you can boot the kernel"
 				       " with the \"lapic\" boot parameter to"
 				       " force-enable it.\n");
-				rc = -err;
-				goto out;
-			}
 #endif
+			else
+				pr_err("Not all events could be opened.\n");
 
-			pr_err("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
 			rc = -err;
 			goto out;
 		}
-- 
1.7.8.6



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

* Re: [PATCH] perf record: Change error message on failure
  2012-09-13 10:20 [PATCH] perf record: Change error message on failure Robert Richter
@ 2012-09-13 15:07 ` Ingo Molnar
  2012-09-13 15:21   ` Robert Richter
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2012-09-13 15:07 UTC (permalink / raw)
  To: Robert Richter; +Cc: Arnaldo Carvalho de Melo, linux-kernel, Peter Zijlstra


* Robert Richter <robert.richter@amd.com> wrote:

> Only report
> 
>  No CONFIG_PERF_EVENTS=y kernel support configured?
> 
> if the syscall fails with ENOSYS. In other cases CONFIG_PERF_EVENTS is
> set and might confuse users. The default message is now:
> 
>  Not all events could be opened.

Indeed, and it would be nice to be even less passive-aggressive 
and figure out and display the exact error condition?

Thanks,

	Ingo

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

* Re: [PATCH] perf record: Change error message on failure
  2012-09-13 15:07 ` Ingo Molnar
@ 2012-09-13 15:21   ` Robert Richter
  2012-09-13 15:25     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Richter @ 2012-09-13 15:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Arnaldo Carvalho de Melo, linux-kernel, Peter Zijlstra

On 13.09.12 17:07:20, Ingo Molnar wrote:
> 
> * Robert Richter <robert.richter@amd.com> wrote:
> 
> > Only report
> > 
> >  No CONFIG_PERF_EVENTS=y kernel support configured?
> > 
> > if the syscall fails with ENOSYS. In other cases CONFIG_PERF_EVENTS is
> > set and might confuse users. The default message is now:
> > 
> >  Not all events could be opened.
> 
> Indeed, and it would be nice to be even less passive-aggressive 
> and figure out and display the exact error condition?

The complete error message shows the error condition and is like the
following:

 # perf record -e cycles:ppk sleep 1
 
   Error: sys_perf_event_open() syscall returned with 22 (Invalid argument).  /bin/dmesg may provide additional information.
 
 Not all events could be opened.
 sleep: Terminated

-Robert

-- 
Advanced Micro Devices, Inc.
Operating System Research Center


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

* Re: [PATCH] perf record: Change error message on failure
  2012-09-13 15:21   ` Robert Richter
@ 2012-09-13 15:25     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2012-09-13 15:25 UTC (permalink / raw)
  To: Robert Richter; +Cc: Arnaldo Carvalho de Melo, linux-kernel, Peter Zijlstra


* Robert Richter <robert.richter@amd.com> wrote:

> On 13.09.12 17:07:20, Ingo Molnar wrote:
> > 
> > * Robert Richter <robert.richter@amd.com> wrote:
> > 
> > > Only report
> > > 
> > >  No CONFIG_PERF_EVENTS=y kernel support configured?
> > > 
> > > if the syscall fails with ENOSYS. In other cases CONFIG_PERF_EVENTS is
> > > set and might confuse users. The default message is now:
> > > 
> > >  Not all events could be opened.
> > 
> > Indeed, and it would be nice to be even less passive-aggressive 
> > and figure out and display the exact error condition?
> 
> The complete error message shows the error condition and is like the
> following:
> 
>  # perf record -e cycles:ppk sleep 1
>  
>    Error: sys_perf_event_open() syscall returned with 22 (Invalid argument).  /bin/dmesg may provide additional information.
>  
>  Not all events could be opened.
>  sleep: Terminated

So in this case a better message would be something like:

    Error: sys_perf_event_open() syscall failed because the 'cycles:ppk' event could not be opened
    sleep: Terminated

The user is not interested in the dmesg details, nor in that the 
error code is 22 -EINVAL.

Thanks,

	Ingo

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

end of thread, other threads:[~2012-09-13 15:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-13 10:20 [PATCH] perf record: Change error message on failure Robert Richter
2012-09-13 15:07 ` Ingo Molnar
2012-09-13 15:21   ` Robert Richter
2012-09-13 15:25     ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox