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.rich...@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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to