On Thu, Sep 10, 2015 at 04:00:30PM +0900, Namhyung Kim wrote: > On Mon, Sep 07, 2015 at 10:38:07AM +0200, Jiri Olsa wrote: > > Enhancing parsing events tracepoint error output. Adding > > more verbose output when the tracepoint is not found or > > the tracing event path cannot be access. > > > > $ sudo perf record -e sched:sched_krava ls > > event syntax error: 'sched:sched_krava' > > \___ unknown tracepoint > > > > Error: File /sys/kernel/debug/tracing//tracing/events/sched/sched_krava > > not found. > > Hint: Perhaps this kernel misses some CONFIG_ setting to enable this > > feature?. > > > > Run 'perf list' for a list of valid events > > ... > > > > $ perf record -e sched:sched_krava ls > > event syntax error: 'sched:sched_krava' > > \___ can't access trace events > > > > Error: No permissions to read > > /sys/kernel/debug/tracing//tracing/events/sched/sched_krava > > Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug' > > What about tracefs? On my system, tracefs is mounted on > /sys/kernel/debug/tracing thus I cannot access trace events after > remounting debugfs with mode=755.
right, patch below keeps the actual mount and display proper info.. could you please try? > > Also, IIRC tracepoint events adds PERF_SAMPLE_RAW bit automatically, > and it requires perf_event_paranoid being -1 for non-root user, right? there's related error message when you try to open the tracepoint, the whole session is like: [jolsa@krava perf]$ ./perf record -e sched:sched_switch ls event syntax error: 'sched:sched_switch' \___ can't access trace events Error: No permissions to read /sys/kernel/debug/tracing/events/sched/sched_switch Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/tracing' Run 'perf list' for a list of valid events usage: perf record [<options>] [<command>] or: perf record [<options>] -- <command> [<options>] -e, --event <event> event selector. use 'perf list' to list available events [jolsa@krava perf]$ sudo mount -o remount,mode=755 /sys/kernel/debug/tracing [jolsa@krava perf]$ ./perf record -e sched:sched_switch ls Error: You may not have permission to collect stats. Consider tweaking /proc/sys/kernel/perf_event_paranoid: -1 - Not paranoid at all 0 - Disallow raw tracepoint access for unpriv 1 - Disallow cpu events for unpriv 2 - Disallow kernel profiling for unpriv thanks, jirka --- diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c index 38aca2dd1946..0406a7d5c891 100644 --- a/tools/lib/api/fs/tracing_path.c +++ b/tools/lib/api/fs/tracing_path.c @@ -12,12 +12,14 @@ #include "tracing_path.h" +char tracing_mnt[PATH_MAX + 1] = "/sys/kernel/debug"; char tracing_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing"; char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events"; static void __tracing_path_set(const char *tracing, const char *mountpoint) { + snprintf(tracing_mnt, sizeof(tracing_mnt), "%s", mountpoint); snprintf(tracing_path, sizeof(tracing_path), "%s/%s", mountpoint, tracing); snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s", @@ -109,19 +111,10 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename) "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'"); break; case EACCES: { - const char *mountpoint = debugfs__mountpoint(); - - if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) { - const char *tracefs_mntpoint = tracefs__mountpoint(); - - if (tracefs_mntpoint) - mountpoint = tracefs__mountpoint(); - } - snprintf(buf, size, "Error:\tNo permissions to read %s/%s\n" "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", - tracing_events_path, filename, mountpoint); + tracing_events_path, filename, tracing_mnt); } break; default: -- 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/