perf record: Change error message on failure
PATCH 1/1 perf record: Change error message on failure
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.
--- tools/perf/builtin-record.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
tools/perf/builtin-record.c +6 -6
@@ -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; }
Signature · 1 line
1.7.8.6
Quoted 8 lines · Robert Richter
Only report
No
CONFIG_PERF_EVENTS=ykernel support configured?if the syscall fails with ENOSYS. In other cases
CONFIG_PERF_EVENTSis 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
Quoted 7 lines · Ingo Molnar
Quoted 4 lines · Robert Richter
Only report
No
CONFIG_PERF_EVENTS=ykernel support configured?
Quoted 7 lines
Quoted 4 lines
if the syscall fails with ENOSYS. In other cases
CONFIG_PERF_EVENTSis 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
Signature · 2 lines
Advanced Micro Devices, Inc. Operating System Research Center
Quoted 19 lines · Robert Richter
Quoted 7 lines · Ingo Molnar
Quoted 4 lines · Robert Richter
Only report
No
CONFIG_PERF_EVENTS=ykernel support configured?Quoted 7 lines
Quoted 4 lines
if the syscall fails with ENOSYS. In other cases
CONFIG_PERF_EVENTSis 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:
Quoted 6 lines
# perf record -e cycles:ppk sleep 1Error:
sys_perf_event_open()syscall returned with 22 (Invalid argument)./bin/dmesgmay 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