perf intel-pt: Refine kernel decoding only warning message
authorAdrian Hunter <adrian.hunter@intel.com>
Thu, 28 May 2020 12:08:59 +0000 (15:08 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 28 May 2020 14:37:45 +0000 (11:37 -0300)
Stop the message displaying when user space is not being traced.

Example:

  Prerequisites:

    sudo setcap "cap_sys_rawio,cap_sys_admin,cap_sys_ptrace,cap_syslog,cap_ipc_lock=ep" ~/bin/perf
    sudo chmod +r /proc/kcore

  Before:

    $ perf record --no-switch-events --kcore -a -e intel_pt//k -- sleep 0.001
    Warning:
    Intel Processor Trace decoding will not be possible except for kernel tracing!
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.838 MB perf.data ]

  After:

    $ perf record --no-switch-events --kcore -a -e intel_pt//k -- sleep 0.001
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 1.068 MB perf.data ]

    $ sudo chmod go-r /proc/kcore
    $ sudo setcap -r ~/bin/perf

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: http://lore.kernel.org/lkml/20200528120859.21604-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/x86/util/intel-pt.c

index de69c8a..839ef52 100644 (file)
@@ -883,7 +883,8 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
         * per-cpu with no sched_switch (except workload-only).
         */
        if (!ptr->have_sched_switch && !perf_cpu_map__empty(cpus) &&
-           !target__none(&opts->target))
+           !target__none(&opts->target) &&
+           !intel_pt_evsel->core.attr.exclude_user)
                ui__warning("Intel Processor Trace decoding will not be possible except for kernel tracing!\n");
 
        return 0;