1. 29 8月, 2019 3 次提交
    • I
      perf evsel: Kernel profiling is disallowed only when perf_event_paranoid > 1 · aa97293f
      Igor Lubashev 提交于
      Perf was too restrictive about sysctl kernel.perf_event_paranoid. The
      kernel only disallows profiling when perf_event_paranoid > 1. Make perf
      do the same.
      
      Committer testing:
      
      For a non-root user:
      
        $ id
        uid=1000(acme) gid=1000(acme) groups=1000(acme),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
        $
      
      Before:
      
      We were restricting it to just userspace (:u suffix) even for a
      workload started by the user:
      
        $ perf record sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.001 MB perf.data (8 samples) ]
        $ perf evlist
        cycles:u
        $ perf evlist -v
        cycles:u: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|PERIOD, read_format: ID, disabled: 1, inherit: 1, exclude_kernel: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
        $ perf report --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        # Total Lost Samples: 0
        #
        # Samples: 8  of event 'cycles:u'
        # Event count (approx.): 1040396
        #
        # Overhead  Command  Shared Object     Symbol
        # ........  .......  ................  ......................
        #
            68.36%  sleep    libc-2.29.so      [.] _dl_addr
            27.33%  sleep    ld-2.29.so        [.] dl_main
             3.80%  sleep    ld-2.29.so        [.] _dl_setup_hash
        #
        # (Tip: Order by the overhead of source file name and line number: perf report -s srcline)
        #
        $
        $
      
      After:
      
      When the kernel allows profiling the kernel in that scenario:
      
        $ perf record sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.023 MB perf.data (11 samples) ]
        $ perf evlist
        cycles
        $ perf evlist -v
        cycles: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|PERIOD, read_format: ID, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
        $
        $ perf report --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        # Total Lost Samples: 0
        #
        # Samples: 11  of event 'cycles'
        # Event count (approx.): 1601964
        #
        # Overhead  Command  Shared Object     Symbol
        # ........  .......  ................  ..........................
        #
            28.14%  sleep    [kernel.vmlinux]  [k] __rb_erase_color
            27.21%  sleep    [kernel.vmlinux]  [k] unmap_page_range
            27.20%  sleep    ld-2.29.so        [.] __tunable_get_val
            15.24%  sleep    [kernel.vmlinux]  [k] thp_get_unmapped_area
             1.96%  perf     [kernel.vmlinux]  [k] perf_event_exec
             0.22%  perf     [kernel.vmlinux]  [k] native_sched_clock
             0.02%  perf     [kernel.vmlinux]  [k] intel_bts_enable_local
             0.00%  perf     [kernel.vmlinux]  [k] native_write_msr
        #
        # (Tip: Boolean options have negative forms, e.g.: perf report --no-children)
        #
        $
      Reported-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIgor Lubashev <ilubashe@akamai.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/1566869956-7154-4-git-send-email-ilubashe@akamai.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      aa97293f
    • I
      perf tools: Use CAP_SYS_ADMIN with perf_event_paranoid checks · dda1bf8e
      Igor Lubashev 提交于
      The kernel is using CAP_SYS_ADMIN instead of euid==0 to override
      perf_event_paranoid check. Make perf do the same.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> # coresight part
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/1566869956-7154-3-git-send-email-ilubashe@akamai.comSigned-off-by: NIgor Lubashev <ilubashe@akamai.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dda1bf8e
    • I
      perf event: Check ref_reloc_sym before using it · e9a6882f
      Igor Lubashev 提交于
      Check for ref_reloc_sym before using it instead of checking
      symbol_conf.kptr_restrict and relying solely on that check.
      Reported-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Signed-off-by: NIgor Lubashev <ilubashe@akamai.com>
      Tested-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/1566869956-7154-2-git-send-email-ilubashe@akamai.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e9a6882f
  2. 28 8月, 2019 3 次提交
  3. 27 8月, 2019 18 次提交
  4. 26 8月, 2019 16 次提交