1. 15 8月, 2019 9 次提交
    • A
      perf evswitch: Introduce OPTS_EVSWITCH() for cmd line processing · add3a719
      Arnaldo Carvalho de Melo 提交于
      All tools will want those, so provide a convenient way to get them.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-v16pe3sbf3wjmn152u18f649@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      add3a719
    • A
      perf evswitch: Add the names of on/off events · 0b495b12
      Arnaldo Carvalho de Melo 提交于
      So that we can have macros for the OPT_ entries and also for finding
      those in an evlist, this way other tools will use this very easily.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-q0og1xoqqi0w38ve5u0a43k2@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0b495b12
    • A
      perf evswitch: Move switch logic to use in other tools · 8829e56f
      Arnaldo Carvalho de Melo 提交于
      Now other tools that want switching can use an evswitch for that, just
      set it up and add it to the PERF_RECORD_SAMPLE processing function.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-b1trj1q97qwfv251l66q3noj@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8829e56f
    • A
      perf evswitch: Move struct to a separate header to use in other tools · d2360442
      Arnaldo Carvalho de Melo 提交于
      Now that we see that the simple userspace-based "slicing" of events
      using delimiter events ("markers") works, lets move it to a separate
      header to make it available to other tools, next step will be having
      the switch on/off check done at the PERF_RECORD_SAMPLE processing
      function moved too.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-z0cyi9ifzlr37cedr9xztc1k@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d2360442
    • A
      perf script: Allow specifying event to switch off processing of other events · dd41f660
      Arnaldo Carvalho de Melo 提交于
      Counterpart of --switch-on:
      
        # perf record -e sched:*,syscalls:sys_*_nanosleep sleep 1
        [ perf record: Woken up 36 times to write data ]
        [ perf record: Captured and wrote 0.032 MB perf.data (10 samples) ]
        #
        # perf script
            :20918 20918 [002] 109866.143696:            sched:sched_waking: comm=perf pid=20919 prio=120 target_cpu=001
            :20918 20918 [002] 109866.143702:            sched:sched_wakeup: perf:20919 [120] success=1 CPU:001
             sleep 20919 [001] 109866.144081:      sched:sched_process_exec: filename=/usr/bin/sleep pid=20919 old_pid=20919
             sleep 20919 [001] 109866.144408:  syscalls:sys_enter_nanosleep: rqtp: 0x7ffc2384fef0, rmtp: 0x00000000
             sleep 20919 [001] 109866.144411:      sched:sched_stat_runtime: comm=sleep pid=20919 runtime=521249 [ns] vruntime=202919398131 [n>
             sleep 20919 [001] 109866.144412:            sched:sched_switch: sleep:20919 [120] S ==> swapper/1:0 [120]
           swapper     0 [001] 109867.144568:            sched:sched_waking: comm=sleep pid=20919 prio=120 target_cpu=001
           swapper     0 [001] 109867.144586:            sched:sched_wakeup: sleep:20919 [120] success=1 CPU:001
             sleep 20919 [001] 109867.144614:   syscalls:sys_exit_nanosleep: 0x0
             sleep 20919 [001] 109867.144753:      sched:sched_process_exit: comm=sleep pid=20919 prio=120
        #
        # perf script --switch-off syscalls:sys_exit_nanosleep
            :20918 20918 [002] 109866.143696:            sched:sched_waking: comm=perf pid=20919 prio=120 target_cpu=001
            :20918 20918 [002] 109866.143702:            sched:sched_wakeup: perf:20919 [120] success=1 CPU:001
             sleep 20919 [001] 109866.144081:      sched:sched_process_exec: filename=/usr/bin/sleep pid=20919 old_pid=20919
             sleep 20919 [001] 109866.144408:  syscalls:sys_enter_nanosleep: rqtp: 0x7ffc2384fef0, rmtp: 0x00000000
             sleep 20919 [001] 109866.144411:      sched:sched_stat_runtime: comm=sleep pid=20919 runtime=521249 [ns] vruntime=202919398131 [n>
             sleep 20919 [001] 109866.144412:            sched:sched_switch: sleep:20919 [120] S ==> swapper/1:0 [120]
           swapper     0 [001] 109867.144568:            sched:sched_waking: comm=sleep pid=20919 prio=120 target_cpu=001
           swapper     0 [001] 109867.144586:            sched:sched_wakeup: sleep:20919 [120] success=1 CPU:001
             sleep 20919 [001] 109867.144753:      sched:sched_process_exit: comm=sleep pid=20919 prio=120
        #
        # perf script --switch-on syscalls:sys_enter_nanosleep --switch-off syscalls:sys_exit_nanosleep
             sleep 20919 [001] 109866.144411:      sched:sched_stat_runtime: comm=sleep pid=20919 runtime=521249 [ns] vruntime=202919398131 [n>
             sleep 20919 [001] 109866.144412:            sched:sched_switch: sleep:20919 [120] S ==> swapper/1:0 [120]
           swapper     0 [001] 109867.144568:            sched:sched_waking: comm=sleep pid=20919 prio=120 target_cpu=001
           swapper     0 [001] 109867.144586:            sched:sched_wakeup: sleep:20919 [120] success=1 CPU:001
        #
        # perf script --switch-on syscalls:sys_enter_nanosleep --switch-off syscalls:sys_exit_nanosleep --show-on-off
             sleep 20919 [001] 109866.144408:  syscalls:sys_enter_nanosleep: rqtp: 0x7ffc2384fef0, rmtp: 0x00000000
             sleep 20919 [001] 109866.144411:      sched:sched_stat_runtime: comm=sleep pid=20919 runtime=521249 [ns] vruntime=202919398131 [n>
             sleep 20919 [001] 109866.144412:            sched:sched_switch: sleep:20919 [120] S ==> swapper/1:0 [120]
           swapper     0 [001] 109867.144568:            sched:sched_waking: comm=sleep pid=20919 prio=120 target_cpu=001
           swapper     0 [001] 109867.144586:            sched:sched_wakeup: sleep:20919 [120] success=1 CPU:001
             sleep 20919 [001] 109867.144614:   syscalls:sys_exit_nanosleep: 0x0
        #
      
      Now think about using this together with 'perf probe' to create custom on/off
      events in your app :-)
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-li3j01c4tmj9kw6ydsl8swej@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dd41f660
    • A
      perf script: Allow showing the --switch-on event · 6469eb6d
      Arnaldo Carvalho de Melo 提交于
      One may want to see the --switch-on event as well, allow for that, using
      the previous cset example:
      
        # perf script --switch-on syscalls:sys_enter_nanosleep --show-on-off
              sleep 13638 [001] 108237.582286: syscalls:sys_enter_nanosleep: rqtp: 0x7fff1948ac40, rmtp: 0x00000000
              sleep 13638 [001] 108237.582289:     sched:sched_stat_runtime: comm=sleep pid=13638 runtime=578104 [ns] vruntime=202889459556 [ns]
              sleep 13638 [001] 108237.582291:           sched:sched_switch: sleep:13638 [120] S ==> swapper/1:0 [120]
            swapper     0 [001] 108238.582428:           sched:sched_waking: comm=sleep pid=13638 prio=120 target_cpu=001
            swapper     0 [001] 108238.582458:           sched:sched_wakeup: sleep:13638 [120] success=1 CPU:001
              sleep 13638 [001] 108238.582698:     sched:sched_stat_runtime: comm=sleep pid=13638 runtime=173915 [ns] vruntime=202889633471 [ns]
              sleep 13638 [001] 108238.582782:     sched:sched_process_exit: comm=sleep pid=13638 prio=120
        #
        # perf script --switch-on syscalls:sys_enter_nanosleep
              sleep 13638 [001] 108237.582289:     sched:sched_stat_runtime: comm=sleep pid=13638 runtime=578104 [ns] vruntime=202889459556 [ns]
              sleep 13638 [001] 108237.582291:           sched:sched_switch: sleep:13638 [120] S ==> swapper/1:0 [120]
            swapper     0 [001] 108238.582428:           sched:sched_waking: comm=sleep pid=13638 prio=120 target_cpu=001
            swapper     0 [001] 108238.582458:           sched:sched_wakeup: sleep:13638 [120] success=1 CPU:001
              sleep 13638 [001] 108238.582698:     sched:sched_stat_runtime: comm=sleep pid=13638 runtime=173915 [ns] vruntime=202889633471 [ns]
              sleep 13638 [001] 108238.582782:     sched:sched_process_exit: comm=sleep pid=13638 prio=120
        #
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Link: https://lkml.kernel.org/n/tip-0omwwoywj1v63gu8cz0tr0cy@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6469eb6d
    • A
      perf script: Allow specifying event to switch on processing of other events · f90a2417
      Arnaldo Carvalho de Melo 提交于
      Sometime we want to only consider events after something happens, so
      allow discarding events till such events is found, e.g.:
      
      Record all scheduler tracepoints and the sys_enter_nanosleep syscall
      event for the 'sleep 1' workload:
      
        # perf record -e sched:*,syscalls:sys_enter_nanosleep sleep 1
        [ perf record: Woken up 31 times to write data ]
        [ perf record: Captured and wrote 0.032 MB perf.data (10 samples) ]
        #
      
      So we have these events in the generated perf data file:
      
        # perf evlist
        sched:sched_kthread_stop
        sched:sched_kthread_stop_ret
        sched:sched_waking
        sched:sched_wakeup
        sched:sched_wakeup_new
        sched:sched_switch
        sched:sched_migrate_task
        sched:sched_process_free
        sched:sched_process_exit
        sched:sched_wait_task
        sched:sched_process_wait
        sched:sched_process_fork
        sched:sched_process_exec
        sched:sched_stat_wait
        sched:sched_stat_sleep
        sched:sched_stat_iowait
        sched:sched_stat_blocked
        sched:sched_stat_runtime
        sched:sched_pi_setprio
        sched:sched_move_numa
        sched:sched_stick_numa
        sched:sched_swap_numa
        sched:sched_wake_idle_without_ipi
        syscalls:sys_enter_nanosleep
        # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
        #
      
      Then show all of the events that actually took place in this 'perf record' session:
      
        # perf script
                :13637 13637 [002] 108237.581529:            sched:sched_waking: comm=perf pid=13638 prio=120 target_cpu=001
                :13637 13637 [002] 108237.581537:            sched:sched_wakeup: perf:13638 [120] success=1 CPU:001
                 sleep 13638 [001] 108237.581992:      sched:sched_process_exec: filename=/usr/bin/sleep pid=13638 old_pid=13638
                 sleep 13638 [001] 108237.582286:  syscalls:sys_enter_nanosleep: rqtp: 0x7fff1948ac40, rmtp: 0x00000000
                 sleep 13638 [001] 108237.582289:      sched:sched_stat_runtime: comm=sleep pid=13638 runtime=578104 [ns] vruntime=202889459556 [ns]
                 sleep 13638 [001] 108237.582291:            sched:sched_switch: sleep:13638 [120] S ==> swapper/1:0 [120]
               swapper     0 [001] 108238.582428:            sched:sched_waking: comm=sleep pid=13638 prio=120 target_cpu=001
               swapper     0 [001] 108238.582458:            sched:sched_wakeup: sleep:13638 [120] success=1 CPU:001
                 sleep 13638 [001] 108238.582698:      sched:sched_stat_runtime: comm=sleep pid=13638 runtime=173915 [ns] vruntime=202889633471 [ns]
                 sleep 13638 [001] 108238.582782:      sched:sched_process_exit: comm=sleep pid=13638 prio=120
        #
      
      Now lets see only the ones that took place after a certain "marker":
      
        # perf script --switch-on syscalls:sys_enter_nanosleep
                 sleep 13638 [001] 108237.582289:      sched:sched_stat_runtime: comm=sleep pid=13638 runtime=578104 [ns] vruntime=202889459556 [ns]
                 sleep 13638 [001] 108237.582291:            sched:sched_switch: sleep:13638 [120] S ==> swapper/1:0 [120]
               swapper     0 [001] 108238.582428:            sched:sched_waking: comm=sleep pid=13638 prio=120 target_cpu=001
               swapper     0 [001] 108238.582458:            sched:sched_wakeup: sleep:13638 [120] success=1 CPU:001
                 sleep 13638 [001] 108238.582698:      sched:sched_stat_runtime: comm=sleep pid=13638 runtime=173915 [ns] vruntime=202889633471 [ns]
                 sleep 13638 [001] 108238.582782:      sched:sched_process_exit: comm=sleep pid=13638 prio=120
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-f1oo0ufdhrkx6nhy2lj1ierm@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f90a2417
    • H
      perf vendor events intel: Add Tremontx event file v1.02 · 11e54d35
      Haiyan Song 提交于
      Add a Intel event file for perf.
      Signed-off-by: NHaiyan Song <haiyanx.song@intel.com>
      Reviewed-by: NKan Liang <kan.liang@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20190815035942.30602-1-haiyanx.song@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      11e54d35
    • T
      Merge tag 'perf-core-for-mingo-5.4-20190814' of... · 4511708b
      Thomas Gleixner 提交于
      Merge tag 'perf-core-for-mingo-5.4-20190814' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo:
      
      Intel PT:
      
        Adrian Hunter:
      
        - Add PEBS via Intel PT support, the kernel bits went via PeterZ.
      
      perf record:
      
        Alexander Shishkin:
      
        - Add an option to take an AUX snapshot on exit.
      
        Tan Xiaojun:
      
        - Support aarch64 random socket_id assignment, just like was fixed for S/390.
      
      tools:
      
        Andy Shevchenko:
      
        - Keep list of tools in alphabetical order on 'make -C tools help'.
      
      perf session:
      
        Arnaldo Carvalho de Melo:
      
        - Avoid infinite loop when seeing invalid header.size, reported by
          Vince Weaver using a perf.data fuzzer.
      
      Documentation:
      
        Vince Weaver:
      
        - Clarify HEADER_SAMPLE_TOPOLOGY format in the perf.data spec.
      
      perf config:
      
        Arnaldo Carvalho de Melo:
      
        - Honour $PERF_CONFIG env var to specify alternate .perfconfig.
      
      perf test:
      
        Arnaldo Carvalho de Melo:
      
        - Disable ~/.perfconfig to get default output in 'perf trace' tests.
      
      perf top:
      
        Arnaldo Carvalho de Melo:
      
        - Set display thread COMM to help with debugging.
      
        - Collapse and resort evsels in a group, so that we have output
          similar to 'perf report' when using event groups, i.e.
      
            perf top -e '{cycles,instructions}'
      
          Will have two columns, and the instructions one will work.
      
      core:
      
        Igor Lubashev:
      
        - Detect if libcap development files are available so that we
          can use capabilities to match the checks made by the kernel instead
          of using plain (geteuid() == 0).
      
      Intel:
      
        Haiyan Song:
      
        - Add Icelake V1.00 event file.
      
      perf trace:
      
        Leo Yan:
      
        - Fix segmentation fault when access syscall info on arm64.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4511708b
  2. 14 8月, 2019 16 次提交
  3. 13 8月, 2019 13 次提交
    • I
      tools build: Add capability-related feature detection · 74d5f3d0
      Igor Lubashev 提交于
      Add utilities to help checking capabilities of the running procss.  Make
      perf link with libcap, if it is available. If no libcap-dev[el], assume
      no capabilities.
      
      Committer testing:
      
        $ make O=/tmp/build/perf -C tools/perf install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j8' parallel build
      
        Auto-detecting system features:
        <SNIP>
        ...                        libbfd: [ on  ]
        ...                        libcap: [ OFF ]
        ...                        libelf: [ on  ]
        <SNIP>
        Makefile.config:833: No libcap found, disables capability support, please install libcap-devel/libcap-dev
        <SNIP>
        $ grep libcap /tmp/build/perf/FEATURE-DUMP
        feature-libcap=0
        $ cat /tmp/build/perf/feature/test-libcap.make.output
        test-libcap.c:2:10: fatal error: sys/capability.h: No such file or directory
            2 | #include <sys/capability.h>
              |          ^~~~~~~~~~~~~~~~~~
        compilation terminated.
        $
      
      Now install libcap-devel and try again:
      
        $ make O=/tmp/build/perf -C tools/perf install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j8' parallel build
        Warning: Kernel ABI header at 'tools/include/linux/bits.h' differs from latest version at 'include/linux/bits.h'
        diff -u tools/include/linux/bits.h include/linux/bits.h
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
        Auto-detecting system features:
        <SNIP>
        ...                        libbfd: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        <SNIP>>
          CC       /tmp/build/perf/jvmti/libjvmti.o
        <SNIP>>
        $ grep libcap /tmp/build/perf/FEATURE-DUMP
        feature-libcap=1
        $ cat /tmp/build/perf/feature/test-libcap.make.output
        $ ldd /tmp/build/perf/feature/test-libcap.make.bin
        ldd: /tmp/build/perf/feature/test-libcap.make.bin: No such file or directory
        $ ldd /tmp/build/perf/feature/test-libcap.bin
        	linux-vdso.so.1 (0x00007ffc35bfe000)
        	libcap.so.2 => /lib64/libcap.so.2 (0x00007ff9c62ff000)
        	libc.so.6 => /lib64/libc.so.6 (0x00007ff9c6139000)
        	/lib64/ld-linux-x86-64.so.2 (0x00007ff9c6326000)
        $
      Signed-off-by: NIgor Lubashev <ilubashe@akamai.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      [ split from a larger patch ]
      Link: http://lkml.kernel.org/r/8a1e76cf5c7c9796d0d4d240fbaa85305298aafa.1565188228.git.ilubashe@akamai.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      74d5f3d0
    • A
      perf top: Collapse and resort all evsels in a group · 40d81772
      Arnaldo Carvalho de Melo 提交于
      And link them, i.e. find the hist entries in the non-leader events and
      link them to the ones in the leader.
      
      This should be the same thing already done for the 'perf report' case,
      but now we do it periodically.
      
      With this in place we get percentages in from the second overhead column
      on, not just on the first (the leader).
      
      Try it using:
      
        perf top --stdio -e '{cycles,instructions}'
      
      You should see something like:
      
         PerfTop:   20776 irqs/sec  kernel:68.7%  exact:  0.0% lost: 0/0 drop: 0/0 [cycles],  (all, 8 CPUs)
        ---------------------------------------------------------------------------------------------------
      
           4.44%   0.44%  [kernel]                 [k] do_syscall_64
           2.27%   0.17%  [kernel]                 [k] entry_SYSCALL_64
           1.73%   0.27%  [kernel]                 [k] syscall_return_via_sysret
           1.60%   0.91%  [kernel]                 [k] _raw_spin_lock_irqsave
           1.45%   3.53%  libglib-2.0.so.0.6000.4  [.] g_string_insert_unichar
           1.39%   0.21%  [kernel]                 [k] copy_user_enhanced_fast_string
           1.26%   1.15%  [kernel]                 [k] psi_task_change
           1.16%   0.14%  libpixman-1.so.0.38.0    [.] 0x000000000006f403
           1.00%   0.32%  [kernel]                 [k] __sched_text_start
           0.97%   2.11%  [kernel]                 [k] n_tty_write
           0.96%   0.04%  [kernel]                 [k] queued_spin_lock_slowpath
           0.93%   0.88%  [kernel]                 [k] menu_select
           0.87%   0.14%  [kernel]                 [k] try_to_wake_up
           0.77%   0.10%  libpixman-1.so.0.38.0    [.] 0x000000000006f40b
           0.73%   0.09%  libpixman-1.so.0.38.0    [.] 0x000000000006f413
           0.69%   0.48%  libc-2.29.so             [.] __memmove_avx_unaligned_erms
           0.68%   0.29%  [kernel]                 [k] _raw_spin_lock_irq
           0.61%   0.04%  libpixman-1.so.0.38.0    [.] 0x000000000006f423
           0.60%   0.37%  [kernel]                 [k] native_sched_clock
           0.57%   0.23%  [kernel]                 [k] do_idle
           0.57%   0.23%  [kernel]                 [k] __fget
           0.56%   0.30%  [kernel]                 [k] __switch_to_asm
           0.56%   0.00%  libc-2.29.so             [.] __memset_avx2_erms
           0.52%   0.32%  [kernel]                 [k] _raw_spin_lock
           0.49%   0.24%  [kernel]                 [k] n_tty_poll
           0.49%   0.54%  libglib-2.0.so.0.6000.4  [.] g_mutex_lock
           0.48%   0.62%  [kernel]                 [k] _raw_spin_unlock_irqrestore
           0.47%   0.27%  [kernel]                 [k] __switch_to
           0.47%   0.25%  [kernel]                 [k] pick_next_task_fair
           0.45%   0.17%  [kernel]                 [k] filldir64
           0.40%   0.16%  [kernel]                 [k] update_rq_clock
           0.39%   0.19%  [kernel]                 [k] enqueue_task_fair
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-uw8cjeifxvjpkjp6x2iil0ar@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      40d81772
    • A
      perf hist: Remove dummy entries when finding real ones. · 5f8b4d5d
      Arnaldo Carvalho de Melo 提交于
      When he have an event group we have multiple struct hist instances, one
      per evsel, and in each of these hists we may have hist_entries that
      point to the same thing being observed, say a symbol, i.e. if we're
      looking at instructions and cycles, then we'll have one hist_entry in
      the "instructions" evsel and another in the "cycles" evsel.
      
      We need to link those to then show one column for each. When we're
      looking at some other pair of events, say instructions and cache misses,
      we may have just the "instructions" hist entry and not one for "cache
      misses", as instructions not necessarily generate cache misses, as the
      logic expects one hist_entry per evsel, we end up adding "dummy"
      hist_entries.
      
      This is enough for 'perf report', that does this matching operation
      (hists__match()) just once after processing all events, but for 'perf
      top', we do this at each refresh, so we may finally find events matching
      and then we need to trow away the dummies and link with the real events.
      
      So if we find a match, traverse the link of matches and trow away
      dummies for that hists.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-dwvtjqqifsbsczeb35q6mqkk@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5f8b4d5d
    • L
      perf trace: Fix segmentation fault when access syscall info on arm64 · 3e70008a
      Leo Yan 提交于
      'perf trace' reports the segmentation fault as below on Arm64:
      
        # perf trace -e string -e augmented_raw_syscalls.c
        LLVM: dumping tools/perf/examples/bpf/augmented_raw_syscalls.o
        perf: Segmentation fault
        Obtained 12 stack frames.
        perf(sighandler_dump_stack+0x47) [0xaaaaac96ac87]
        linux-vdso.so.1(+0x5b7) [0xffffadbeb5b7]
        /lib/aarch64-linux-gnu/libc.so.6(strlen+0x10) [0xfffface7d5d0]
        /lib/aarch64-linux-gnu/libc.so.6(_IO_vfprintf+0x1ac7) [0xfffface49f97]
        /lib/aarch64-linux-gnu/libc.so.6(__vsnprintf_chk+0xc7) [0xffffacedfbe7]
        perf(scnprintf+0x97) [0xaaaaac9ca3ff]
        perf(+0x997bb) [0xaaaaac8e37bb]
        perf(cmd_trace+0x28e7) [0xaaaaac8ec09f]
        perf(+0xd4a13) [0xaaaaac91ea13]
        perf(main+0x62f) [0xaaaaac8a147f]
        /lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0xe3) [0xfffface22d23]
        perf(+0x57723) [0xaaaaac8a1723]
        Segmentation fault
      
      This issue is introduced by commit 30a910d7 ("perf trace:
      Preallocate the syscall table"), it allocates trace->syscalls.table[]
      array and the element count is 'trace->sctbl->syscalls.nr_entries'; but
      on Arm64, the system call number is not continuously used; e.g. the
      syscall maximum id is 436 but the real entries is only 281.
      
      So the table is allocated with 'nr_entries' as the element count, but it
      accesses the table with the syscall id, which might be out of the bound
      of the array and cause the segmentation fault.
      
      This patch allocates trace->syscalls.table[] with the element count is
      'trace->sctbl->syscalls.max_id + 1', this allows any id to access the
      table without out of the bound.
      Signed-off-by: NLeo Yan <leo.yan@linaro.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Fixes: 30a910d7 ("perf trace: Preallocate the syscall table")
      Link: http://lkml.kernel.org/r/20190809104752.27338-1-leo.yan@linaro.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3e70008a
    • A
      perf hists: Do not link a pair if already linked · 7d1a5efa
      Arnaldo Carvalho de Melo 提交于
      When we have multiple events in a group we link hist_entries in the
      non-leader evsel hists to the one in the leader that points to the same
      sorting criteria, in hists__match().
      
      For 'perf report' we do this just once and then print the results, but
      for 'perf top' we need to look if this was already done in the previous
      refresh of the screen, so check for that and don't try to link again.
      
      This is part of having 'perf top' using the hists browser for showing
      multiple events in multiple columns.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-iwvb37rgb7upswhruwpcdnhw@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7d1a5efa
    • A
      perf top: Set display thread COMM to help with debugging · 1205a271
      Arnaldo Carvalho de Melo 提交于
      When we want to attach just to the thread that updates the display it
      helps having its COMM stand out, so change it from the default "perf" to
      "perf-top-UI".
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-5w0hmlk3zfvysxvpsh763k9w@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1205a271
    • H
      perf vendor events intel: Add Icelake V1.00 event file · b115df07
      Haiyan Song 提交于
      Add a Intel event file for perf.
      Signed-off-by: NHaiyan Song <haiyanx.song@intel.com>
      Reviewed-by: NKan Liang <kan.liang@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/8859095e-5b02-d6b7-fbdc-3f42b714bae0@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b115df07
    • L
      perf tools: Fix paths in include statements · 2b75863b
      Luke Mujica 提交于
      These paths point to the wrong location but still work because they get
      picked up by a -I flag that happens to direct to the correct file. Fix
      paths to lead to the actual file location without help from include
      flags.
      Signed-off-by: NLuke Mujica <lukemujica@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/20190719202253.220261-1-lukemujica@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2b75863b
    • A
      perf test vfs_getname: Disable ~/.perfconfig to get default output · 4fe94ce1
      Arnaldo Carvalho de Melo 提交于
      To get the expected output we have to ignore whatever changes the user
      has in its ~/.perfconfig file, so set PERF_CONFIG to /dev/null to
      achieve that.
      
      Before:
      
        # egrep 'trace|show_' ~/.perfconfig
        [trace]
        	show_zeros = yes
        	show_duration = no
        	show_timestamp = no
        	show_arg_names = no
        	show_prefix = yes
        # echo $PERF_CONFIG
      
        # perf test "trace + vfs_getname"
        70: Check open filename arg using perf trace + vfs_getname: FAILED!
        # export PERF_CONFIG=/dev/null
        # perf test "trace + vfs_getname"
        70: Check open filename arg using perf trace + vfs_getname: Ok
        #
      
      After:
      
        # egrep 'trace|show_' ~/.perfconfig
        [trace]
        	show_zeros = yes
        	show_duration = no
        	show_timestamp = no
        	show_arg_names = no
        	show_prefix = yes
        # echo $PERF_CONFIG
      
        # perf test "trace + vfs_getname"
        70: Check open filename arg using perf trace + vfs_getname: Ok
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Link: https://lkml.kernel.org/n/tip-3up27pexg5i3exuzqrvt4m8u@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4fe94ce1
    • A
      perf config: Document the PERF_CONFIG environment variable · 5de9e5fd
      Arnaldo Carvalho de Melo 提交于
      There was a provision for setting this variable, but not the
      getenv("PERF_CONFIG") call to set it, as this was fixed in the previous
      cset, document that it can be used to ask for using an alternative
      .perfconfig file or to disable reading whatever file exists in the
      system or home directory, i.e. using:
      
        export PERF_CONFIG=/dev/null
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Link: https://lkml.kernel.org/n/tip-0u4o967hsk7j0o50zp9ctn89@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5de9e5fd
    • A
      perf config: Honour $PERF_CONFIG env var to specify alternate .perfconfig · 61a461fc
      Arnaldo Carvalho de Melo 提交于
      We had this comment in Documentation/perf_counter/config.c, i.e. since
      when we got this from the git sources, but never really did that
      getenv("PERF_CONFIG"), do it now as I need to disable whatever
      ~/.perfconfig root has so that tests parsing tool output are done for
      the expected default output or that we specify an alternate config file
      that when read will make the tools produce expected output.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Fixes: 07800601 ("perf_counter tools: add in basic glue from Git")
      Link: https://lkml.kernel.org/n/tip-jo209zac9rut0dz1rqvbdlgm@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      61a461fc
    • A
      perf session: Avoid infinite loop when seeing invalid header.size · 57fc032a
      Arnaldo Carvalho de Melo 提交于
      Vince reported that when fuzzing the userland perf tool with a bogus
      perf.data file he got into a infinite loop in 'perf report'.
      
      Changing the return of fetch_mmaped_event() to ERR_PTR(-EINVAL) for that
      case gets us out of that infinite loop.
      Reported-by: NVince Weaver <vincent.weaver@maine.edu>
      Tested-by: NVince Weaver <vincent.weaver@maine.edu>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20190726211415.GE24867@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      57fc032a
    • A
      Merge remote-tracking branch 'torvalds/master' into perf/core · 272172bd
      Arnaldo Carvalho de Melo 提交于
      To get closer to upstream and check if we need to sync more UAPI
      headers, pick up fixes for libbpf that prevent perf's container tests
      from completing successfuly, etc.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      272172bd
  4. 12 8月, 2019 2 次提交
    • L
      Linux 5.3-rc4 · d45331b0
      Linus Torvalds 提交于
      d45331b0
    • L
      Merge tag 'dax-fixes-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · b6c0649c
      Linus Torvalds 提交于
      Pull dax fixes from Dan Williams:
       "A filesystem-dax and device-dax fix for v5.3.
      
        The filesystem-dax fix is tagged for stable as the implementation has
        been mistakenly throwing away all cow pages on any truncate or hole
        punch operation as part of the solution to coordinate device-dma vs
        truncate to dax pages.
      
        The device-dax change fixes up a regression this cycle from the
        introduction of a common 'internal per-cpu-ref' implementation.
      
        Summary:
      
         - Fix dax_layout_busy_page() to not discard private cow pages of
           fs/dax private mappings.
      
         - Update the memremap_pages core to properly cleanup on behalf of
           internal reference-count users like device-dax"
      
      * tag 'dax-fixes-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
        mm/memremap: Fix reuse of pgmap instances with internal references
        dax: dax_layout_busy_page() should not unmap cow pages
      b6c0649c