1. 08 11月, 2021 1 次提交
  2. 29 9月, 2021 1 次提交
  3. 03 9月, 2021 1 次提交
  4. 14 7月, 2021 1 次提交
  5. 10 7月, 2021 2 次提交
  6. 29 4月, 2021 1 次提交
  7. 24 3月, 2021 1 次提交
  8. 01 12月, 2020 1 次提交
  9. 14 10月, 2020 1 次提交
    • A
      perf tools: Add support for exclusive groups/events · 0997a266
      Andi Kleen 提交于
      Peter suggested that using the exclusive mode in perf could avoid some
      problems with bad scheduling of groups. Exclusive is implemented in the
      kernel, but wasn't exposed by the perf tool, so hard to use without
      custom low level API users.
      
      Add support for marking groups or events with :e for exclusive in the
      perf tool.  The implementation is basically the same as the existing
      pinned attribute.
      
      Committer testing:
      
        # perf test "parse event"
         6: Parse event definition strings                                  : Ok
        # perf test -v "parse event" |& grep :u*e
        running test 56 'instructions:uep'
        running test 57 '{cycles,cache-misses,branch-misses}:e'
        #
        #
        # grep "model name" -m1 /proc/cpuinfo
        model name	: AMD Ryzen 9 3900X 12-Core Processor
        #
        # perf stat -a -e '{cycles,cache-misses,branch-misses}:e' sleep 1
      
         Performance counter stats for 'system wide':
      
             <not counted>      cycles                                                        (0.00%)
             <not counted>      cache-misses                                                  (0.00%)
             <not counted>      branch-misses                                                 (0.00%)
      
               1.001269893 seconds time elapsed
      
        Some events weren't counted. Try disabling the NMI watchdog:
        	echo 0 > /proc/sys/kernel/nmi_watchdog
        	perf stat ...
        	echo 1 > /proc/sys/kernel/nmi_watchdog
        # echo 0 > /proc/sys/kernel/nmi_watchdog
        # perf stat -a -e '{cycles,cache-misses,branch-misses}:e' sleep 1
      
         Performance counter stats for 'system wide':
      
             1,298,663,141      cycles
                30,962,215      cache-misses
                 5,325,150      branch-misses
      
               1.001474934 seconds time elapsed
      
        #
        # The output for asking for precise events on AMD needs to improve, it
        # supposedly works only for system wide or per CPU
        #
        # perf stat -a -e '{cycles,cache-misses,branch-misses}:uep' sleep 1
        Error:
        The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles).
        /bin/dmesg | grep -i perf may provide additional information.
      
        # perf stat -a -e '{cycles,cache-misses,branch-misses}:ue' sleep 1
      
         Performance counter stats for 'system wide':
      
               746,363,126      cycles
                16,881,611      cache-misses
                 2,871,259      branch-misses
      
               1.001636066 seconds time elapsed
      
        #
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20201014144255.22699-1-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0997a266
  10. 01 9月, 2020 1 次提交
    • J
      perf parse-events: Set exclude_guest=1 for user-space counting · 943b69ac
      Jin Yao 提交于
      Currently if we run 'perf record -e cycles:u', exclude_guest=0.
      
      But it doesn't make sense in most cases that we request for
      user-space counting but we also get the guest report.
      
      Of course, we also need to consider 'perf kvm' usage case that
      authorized perf users on the host may only want to count guest user
      space events. For example,
      
        # perf kvm --guest record -e cycles:u
      
      When we have 'exclude_guest=1' for 'perf kvm' usage, we may get nothing
      from guest events.
      
      To keep perf semantics consistent and clear, this patch sets
      exclude_guest=1 for user-space counting but except for 'perf kvm' usage.
      
      Before:
      
        perf record -e cycles:u ./div
        perf evlist -v
        cycles:u: ..., exclude_kernel: 1, exclude_hv: 1, ...
      
      After:
        perf record -e cycles:u ./div
        perf evlist -v
        cycles:u: ..., exclude_kernel: 1, exclude_hv: 1,  exclude_guest: 1, ...
      
      Before:
        perf kvm --guest record -e cycles:u -vvv
      
      perf_event_attr:
      
        size                             120
        { sample_period, sample_freq }   4000
        sample_type                      IP|TID|TIME|ID|CPU|PERIOD
        read_format                      ID
        disabled                         1
        inherit                          1
        exclude_kernel                   1
        exclude_hv                       1
        freq                             1
        sample_id_all                    1
      
      After:
      
        perf kvm --guest record -e cycles:u -vvv
      
      perf_event_attr:
        size                             120
        { sample_period, sample_freq }   4000
        sample_type                      IP|TID|TIME|ID|CPU|PERIOD
        read_format                      ID
        disabled                         1
        inherit                          1
        exclude_kernel                   1
        exclude_hv                       1
        freq                             1
        sample_id_all                    1
      
      For Before/After, exclude_guest are both 0 for perf kvm usage.
      
      perf test 6
      
       6: Parse event definition strings             : Ok
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Tested-by: NLike Xu <like.xu@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: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200814012120.16647-1-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      943b69ac
  11. 30 7月, 2020 2 次提交
  12. 06 5月, 2020 4 次提交
  13. 18 4月, 2020 1 次提交
    • J
      perf parser: Add support to specify rXXX event with pmu · 3a6c51e4
      Jiri Olsa 提交于
      The current rXXXX event specification creates event under PERF_TYPE_RAW
      pmu type. This change allows to use rXXXX within pmu syntax, so it's
      type is used via the following syntax:
      
        -e 'cpu/r3c/'
        -e 'cpum_cf/r0/'
      
      The XXXX number goes directly to perf_event_attr::config the same way as
      in '-e rXXXX' event. The perf_event_attr::type is filled with pmu type.
      
      Committer testing:
      
      So, lets see what goes in perf_event_attr::config for, say, the
      'instructions' PERF_TYPE_HARDWARE (0) event, first we should look at how
      to encode this event as a PERF_TYPE_RAW event for this specific CPU, an
      AMD Ryzen 5:
      
        # cat /sys/devices/cpu/events/instructions
        event=0xc0
        #
      
      Then try with it _and_ the instruction, just to see that they are close
      enough:
      
        # perf stat -e rc0,instructions sleep 1
      
         Performance counter stats for 'sleep 1':
      
                   919,794      rc0
                   919,898      instructions
      
               1.000754579 seconds time elapsed
      
               0.000715000 seconds user
               0.000000000 seconds sys
        #
      
      Now we should try, before this patch, the PMU event encoding:
      
        # perf stat -e cpu/rc0/ sleep 1
        event syntax error: 'cpu/rc0/'
                                 \___ unknown term
      
        valid terms: event,edge,inv,umask,cmask,config,config1,config2,name,period,percore
        #
      
      Now with this patch, the three ways of specifying the 'instructions' CPU
      counter are accepted:
      
        # perf stat -e cpu/rc0/,rc0,instructions sleep 1
      
         Performance counter stats for 'sleep 1':
      
                   892,948      cpu/rc0/
                   893,052      rc0
                   893,156      instructions
      
               1.000931819 seconds time elapsed
      
               0.000916000 seconds user
               0.000000000 seconds sys
      
        #
      Requested-by: NThomas Richter <tmricht@linux.ibm.com>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: NThomas Richter <tmricht@linux.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lore.kernel.org/lkml/20200416221405.437788-1-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3a6c51e4
  14. 19 11月, 2019 1 次提交
    • I
      perf parse: Report initial event parsing error · a910e466
      Ian Rogers 提交于
      Record the first event parsing error and report. Implementing feedback
      from Jiri Olsa:
      
        https://lkml.org/lkml/2019/10/28/680
      
      An example error is:
      
        $ tools/perf/perf stat -e c/c/
        WARNING: multiple event parsing errors
        event syntax error: 'c/c/'
                               \___ unknown term
      
        valid terms: event,filter_rem,filter_opc0,edge,filter_isoc,filter_tid,filter_loc,filter_nc,inv,umask,filter_opc1,tid_en,thresh,filter_all_op,filter_not_nm,filter_state,filter_nm,config,config1,config2,name,period,percore
      
      Initial error:
      
        event syntax error: 'c/c/'
                            \___ Cannot find PMU `c'. Missing kernel support?
        Run 'perf list' for a list of valid events
      
         Usage: perf stat [<options>] [<command>]
      
            -e, --event <event>   event selector. use 'perf list' to list available events
      Signed-off-by: NIan Rogers <irogers@google.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Anju T Sudhakar <anju@linux.vnet.ibm.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Link: http://lore.kernel.org/lkml/20191116074652.9960-1-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a910e466
  15. 25 9月, 2019 1 次提交
  16. 20 9月, 2019 1 次提交
  17. 01 9月, 2019 1 次提交
  18. 30 7月, 2019 7 次提交
  19. 11 6月, 2019 1 次提交
  20. 15 2月, 2019 1 次提交
  21. 31 7月, 2018 1 次提交
    • S
      perf tests: Fix complex event name parsing · a6f39cec
      Sandipan Das 提交于
      The 'umask' event parameter is unsupported on some architectures like
      powerpc64.
      
      This can be observed on a powerpc64le system running Fedora 27 as shown
      below.
      
        # perf test "Parse event definition strings" -v
         6: Parse event definition strings                        :
        --- start ---
        test child forked, pid 45915
        ...
        running test 3 'cpu/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks',period=0x1,event=0x2,umask=0x3/ukp'Invalid event/parameter 'umask'
        Invalid event/parameter 'umask'
        failed to parse event 'cpu/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks',period=0x1,event=0x2,umask=0x3/ukp', err 1, str 'unknown term'
        event syntax error: '..,event=0x2,umask=0x3/ukp'
                                          \___ unknown term
      
        valid terms: event,mark,pmc,cache_sel,pmcxsel,unit,thresh_stop,thresh_start,combine,thresh_sel,thresh_cmp,sample_mode,config,config1,config2,name,period,freq,branch_type,time,call-graph,stack-size,no-inherit,inherit,max-stack,no-overwrite,overwrite,driver-config
      
        mem_access -> cpu/event=0x10401e0/
        running test 0 'config=10,config1,config2=3,umask=1'
        test child finished with 1
        ---- end ----
        Parse event definition strings: FAILED!
      
      Committer testing:
      
      After applying the patch these test passes and in verbose mode we get:
      
        # perf test -v "event definition"
         6: Parse event definition strings:
        --- start ---
        test child forked, pid 11061
        running test 0 'syscalls:sys_enter_openat'Using CPUID GenuineIntel-6-9E
        <SNIP>
        running test 53 'cycles/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks'/Duk'
        running test 0 'cpu/config=10,config1,config2=3,period=1000/u'
        running test 1 'cpu/config=1,name=krava/u,cpu/config=2/u'
        running test 2 'cpu/config=1,call-graph=fp,time,period=100000/,cpu/config=2,call-graph=no,time=0,period=2000/'
        running test 3 'cpu/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks',period=0x1,event=0x2/ukp'
        <SNIP>
        test child finished with 0
        ---- end ----
        Parse event definition strings: Ok
        #
      Suggested-by: NRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Signed-off-by: NSandipan Das <sandipan@linux.ibm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Fixes: 06dc5bf2 ("perf tests: Check that complex event name is parsed correctly")
      Link: http://lkml.kernel.org/r/20180726105502.31670-1-sandipan@linux.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a6f39cec
  22. 25 7月, 2018 1 次提交
    • A
      perf tests: Check that complex event name is parsed correctly · 06dc5bf2
      Alexey Budankov 提交于
      Extend regression testing to cover case of complex event names enabled
      by the cset f92da712 ("perf record: Enable arbitrary event names
      thru name= modifier").
      
      Testing it:
      
        # perf test
         1: vmlinux symtab matches kallsyms                       : Skip
         2: Detect openat syscall event                           : Ok
         3: Detect openat syscall event on all cpus               : Ok
         4: Read samples using the mmap interface                 : Ok
         5: Test data source output                               : Ok
         6: Parse event definition strings                        : Ok		<===!
         7: Simple expression parser                              : Ok
      ...
      
      Committer testing:
      
        # perf test "event definition"
         6: Parse event definition strings                        : Ok
        # perf test -v 6 2> /tmp/before
        # perf test -v 6 2> /tmp/after
        # diff -u /tmp/before /tmp/after
        --- /tmp/before	2018-06-19 10:50:21.485572638 -0300
        +++ /tmp/after	2018-06-19 10:50:40.886572896 -0300
        @@ -1,6 +1,6 @@
          6: Parse event definition strings                        :
         --- start ---
        -test child forked, pid 24259
        +test child forked, pid 24904
         running test 0 'syscalls:sys_enter_openat'Using CPUID GenuineIntel-6-3D
         registering plugin: /root/.traceevent/plugins/plugin_kvm.so
         registering plugin: /root/.traceevent/plugins/plugin_hrtimer.so
        @@ -136,9 +136,11 @@
         running test 50 '4:0x6530160/name=numpmu/'
         running test 51 'L1-dcache-misses/name=cachepmu/'
         running test 52 'intel_pt//u'
        +running test 53 'cycles/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks'/Duk'
         running test 0 'cpu/config=10,config1,config2=3,period=1000/u'
         running test 1 'cpu/config=1,name=krava/u,cpu/config=2/u'
         running test 2 'cpu/config=1,call-graph=fp,time,period=100000/,cpu/config=2,call-graph=no,time=0,period=2000/'
        +running test 3 'cpu/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks',period=0x1,event=0x2,umask=0x3/ukp'
         el-capacity -> cpu/event=0x54,umask=0x2/
         el-conflict -> cpu/event=0x54,umask=0x1/
         el-start -> cpu/event=0xc8,umask=0x1/
        #
      Signed-off-by: NAlexey Budankov <alexey.budankov@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/ad30b774-219b-7b80-c610-4e9e298cf8a7@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      06dc5bf2
  23. 25 6月, 2018 2 次提交
    • J
      perf tests: Add valid callback for parse-events test · 16ddcfbf
      Jiri Olsa 提交于
      Adding optional 'valid' callback for events tests in parse-events
      object, so we don't try to parse PMUs, which are not supported.
      
      Following line is displayed for skipped test:
      
        running test 52 'intel_pt//u'... SKIP
      
      Committer note:
      
      Use named initializers in the struct evlist_test variable to avoid
      breaking the build on centos:5, 6 and others with a similar gcc:
      
        cc1: warnings being treated as errors
        tests/parse-events.c: In function 'test_pmu_events':
        tests/parse-events.c:1817: error: missing initializer
        tests/parse-events.c:1817: error: (near initialization for 'e.type')
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Kim Phillips <kim.phillips@arm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Link: http://lkml.kernel.org/r/20180611093422.1005-2-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      16ddcfbf
    • J
      perf tests: Add event parsing error handling to parse events test · 933ccf20
      Jiri Olsa 提交于
      Add missing error handling for parse_events calls in test_event function
      that led to following segfault on s390:
      
        running test 52 'intel_pt//u'
        perf: Segmentation fault
        ...
        /lib64/libc.so.6(vasprintf+0xe6) [0x3fffca3f106]
        /lib64/libc.so.6(asprintf+0x46) [0x3fffca1aa96]
        ./perf(parse_events_add_pmu+0xb8) [0x80132088]
        ./perf(parse_events_parse+0xc62) [0x8019529a]
        ./perf(parse_events+0x98) [0x801341c0]
        ./perf(test__parse_events+0x48) [0x800cd140]
        ./perf(cmd_test+0x26a) [0x800bd44a]
        test child interrupted
      
      Adding the struct parse_events_error argument to parse_events call. Also
      adding parse_events_print_error to get more details on the parsing
      failures, like:
      
        # perf test 6 -v
        running test 52 'intel_pt//u'failed to parse event 'intel_pt//u', err 1, str 'Cannot find PMU `intel_pt'. Missing kernel support?'
        event syntax error: 'intel_pt//u'
                             \___ Cannot find PMU `intel_pt'. Missing kernel support?
      
      Committer note:
      
      Use named initializers in the struct parse_events_error variable to
      avoid breaking the build on centos5, 6 and others with a similar gcc:
      
        cc1: warnings being treated as errors
        tests/parse-events.c: In function 'test_event':
        tests/parse-events.c:1696: error: missing initializer
        tests/parse-events.c:1696: error: (near initialization for 'err.str')
      Reported-by: NKim Phillips <kim.phillips@arm.com>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NKim Phillips <kim.phillips@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Link: http://lkml.kernel.org/r/20180611093422.1005-1-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      933ccf20
  24. 05 6月, 2018 1 次提交
  25. 18 5月, 2018 2 次提交
  26. 15 5月, 2018 1 次提交
  27. 27 12月, 2017 1 次提交