1. 04 Jan, 2019 8 commits
    • Jin Yao's avatar
      perf report: Fix wrong iteration count in --branch-history · a3366db0
      Jin Yao authored
      By calculating the removed loops, we can get the iteration count.
      
      But the iteration count could be reported incorrectly, reporting
      impossibly high counts.
      
      That's because previous code uses the number of removed LBR entries for
      the iteration count. That's not good. Fix this by increasing the
      iteration count when a loop is detected.
      
      When matching the chain, the iteration count would be added up, finally we need
      to compute the average value when printing out.
      
      For example,
      
        $ perf report --branch-history --stdio --no-children
      
      Before:
      
        ---f2 +0
           |
           |--33.62%--f1 +9 (cycles:1)
           |          f1 +0
           |          main +22 (cycles:1)
           |          main +17
           |          main +38 (cycles:1)
           |          main +27
           |          f1 +26 (cycles:1)
           |          f1 +24
           |          f2 +27 (cycles:7)
           |          f2 +0
           |          f1 +19 (cycles:1)
           |          f1 +14
           |          f2 +27 (cycles:11)
           |          f2 +0
           |          f1 +9 (cycles:1 iter:2968 avg_cycles:3)
           |          f1 +0
           |          main +22 (cycles:1 iter:2968 avg_cycles:3)
           |          main +17
           |          main +38 (cycles:1 iter:2968 avg_cycles:3)
      
      2968 is an impossible high iteration count and avg_cycles is too small.
      
      After:
      
        ---f2 +0
           |
           |--33.62%--f1 +9 (cycles:1)
           |          f1 +0
           |          main +22 (cycles:1)
           |          main +17
           |          main +38 (cycles:1)
           |          main +27
           |          f1 +26 (cycles:1)
           |          f1 +24
           |          f2 +27 (cycles:7)
           |          f2 +0
           |          f1 +19 (cycles:1)
           |          f1 +14
           |          f2 +27 (cycles:11)
           |          f2 +0
           |          f1 +9 (cycles:1 iter:1 avg_cycles:23)
           |          f1 +0
           |          main +22 (cycles:1 iter:1 avg_cycles:23)
           |          main +17
           |          main +38 (cycles:1 iter:1 avg_cycles:23)
      
      avg_cycles:23 is the average cycles of this iteration.
      
      Fixes: c4ee0625 ("perf report: Calculate the average cycles of iterations")
      Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1546582230-17507-1-git-send-email-yao.jin@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a3366db0
    • Arnaldo Carvalho de Melo's avatar
      tools headers x86: Sync asm/cpufeatures.h copy with the kernel sources · 86c22ab7
      Arnaldo Carvalho de Melo authored
      To get the changes from:
      
        a0aea130 ("KVM: x86: Add CPUID support for new instruction WBNOINVD")
        20c3a2c3 ("x86/speculation: Add support for STIBP always-on preferred mode")
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Robert Hoo <robert.hu@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Lendacky <Thomas.Lendacky@amd.com>
      Link: https://lkml.kernel.org/n/tip-aonti3bu9rhnqe5hlawbidcp@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      86c22ab7
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Sync copy of asm-generic/unistd.h with the kernel sources · 8c91fd60
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        b7d624ab asm-generic: unistd.h: fixup broken macro include.
        4e21565b asm-generic: add kexec_file_load system call to unistd.h
      
      With this the 'kexec_file_load' syscall will be added to arm64's syscall
      table and will appear on the output of 'perf trace' on that platform.
      
      This silences this tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
        diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: AKASHI Takahiro <takahiro.akashi@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Guo Ren <ren_guo@c-sky.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: https://lkml.kernel.org/n/tip-er8j7qhavtdw0kdga3zswynm@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8c91fd60
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Sync linux/kvm.h with the kernel sources · 558517c5
      Arnaldo Carvalho de Melo authored
      To get the changes from these csets:
      
        2bc39970 ("x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID")
        2a31b9db ("kvm: introduce manual dirty log reprotect")
      
      That results in these new KVM IOCTLs being supported in 'perf trace'
      when beautifying the cmd ioctl syscall argument:
      
        $ cp include/uapi/linux/kvm.h tools/include/uapi/linux/kvm.h
        $ tools/perf/trace/beauty/kvm_ioctl.sh > after
        $ diff -u before after
        --- before	2019-01-04 11:44:23.506605301 -0300
        +++ after	2019-01-04 11:44:36.878730583 -0300
        @@ -86,6 +86,8 @@
              [0xbd] = "HYPERV_EVENTFD",
              [0xbe] = "GET_NESTED_STATE",
              [0xbf] = "SET_NESTED_STATE",
        +     [0xc0] = "CLEAR_DIRTY_LOG",
        +     [0xc1] = "GET_SUPPORTED_HV_CPUID",
              [0xe0] = "CREATE_DEVICE",
              [0xe1] = "SET_DEVICE_ATTR",
              [0xe2] = "GET_DEVICE_ATTR",
        $
      
      At some point we should be able to do something:
      
        # perf trace -e ioctl(cmd == KVM_CLEAR_DIRTY_LOG)
      
      And have just those ioctls, optionally with callchains, etc.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Link: https://lkml.kernel.org/n/tip-konm3iigl2os6ritt7d2bori@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      558517c5
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Sync linux/in.h copy from the kernel sources · 4001b6a0
      Arnaldo Carvalho de Melo authored
      To get the changes in this cset:
      
        65cab850 ("net: Allow class-e address assignment via ifconfig ioctl")
      
      The macros changed in this cset are not used in tools/, so this is just
      to silence this perf tools build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
        diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
      
      Cc: Dave Taht <dave.taht@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      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-smghvyxb3budqd1e70i0ylw1@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4001b6a0
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Update i915_drm.h · 8858ecb5
      Arnaldo Carvalho de Melo authored
      To get the changes in these csets:
      
        fe841686 Revert "drm/i915/perf: add a parameter to control the size of OA buffer"
        cd956bfc drm/i915/perf: add a parameter to control the size of OA buffer
        4bdafb9d drm/i915: Remove i915.enable_ppgtt override
      
      Not one of them result in any changes in tools/perf/, this is just to
      silence this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/drm/i915_drm.h' differs from latest version at 'include/uapi/drm/i915_drm.h'
        diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-mdw7ta6qz7d2rl77gf00uqe8@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8858ecb5
    • Jiri Olsa's avatar
      tools iio: Override CFLAGS assignments · 536cdb68
      Jiri Olsa authored
      So user could specify outside CFLAGS values.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20190103161350.11446-3-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      536cdb68
    • Jiri Olsa's avatar
      tools thermal tmon: Use -O3 instead of -O1 if available · 302df34c
      Jiri Olsa authored
      Using -O3 instead of -O1 if it's supported by compiler.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Cc: Markus Mayer <mmayer@broadcom.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Link: http://lkml.kernel.org/r/20190103161350.11446-2-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      302df34c
  2. 03 Jan, 2019 5 commits
    • Arnaldo Carvalho de Melo's avatar
      tools beauty: Make the prctl option table generator catch all PR_ options · 805e4c8b
      Arnaldo Carvalho de Melo authored
      In ba830885 ("arm64: add prctl control for resetting ptrauth keys")
      the PR_PAC_RESET_KEYS prctl option was introduced, get that into the
      regex in addition to PR_GET_* and PR_SET_*:
      
      So just get everything that matches '^#define PR_\w+' this ends up
      adding these entries:
      
        $ tools/perf/trace/beauty/prctl_option.sh  > after
        $ diff -u before after
        --- before	2019-01-03 14:58:51.541807353 -0300
        +++ after	2019-01-03 15:17:05.909583804 -0300
        @@ -19,12 +19,18 @@
                [20] = "SET_ENDIAN",
                [21] = "GET_SECCOMP",
                [22] = "SET_SECCOMP",
        +       [23] = "CAPBSET_READ",
        +       [24] = "CAPBSET_DROP",
                [25] = "GET_TSC",
                [26] = "SET_TSC",
                [27] = "GET_SECUREBITS",
                [28] = "SET_SECUREBITS",
                [29] = "SET_TIMERSLACK",
                [30] = "GET_TIMERSLACK",
        +       [31] = "TASK_PERF_EVENTS_DISABLE",
        +       [32] = "TASK_PERF_EVENTS_ENABLE",
        +       [33] = "MCE_KILL",
        +       [34] = "MCE_KILL_GET",
                [35] = "SET_MM",
                [36] = "SET_CHILD_SUBREAPER",
                [37] = "GET_CHILD_SUBREAPER",
        @@ -33,8 +39,13 @@
                [40] = "GET_TID_ADDRESS",
                [41] = "SET_THP_DISABLE",
                [42] = "GET_THP_DISABLE",
        +       [43] = "MPX_ENABLE_MANAGEMENT",
        +       [44] = "MPX_DISABLE_MANAGEMENT",
                [45] = "SET_FP_MODE",
                [46] = "GET_FP_MODE",
        +       [47] = "CAP_AMBIENT",
        +       [50] = "SVE_SET_VL",
        +       [51] = "SVE_GET_VL",
                [52] = "GET_SPECULATION_CTRL",
                [53] = "SET_SPECULATION_CTRL",
                [54] = "PAC_RESET_KEYS",
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kristina Martsenko <kristina.martsenko@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: https://lkml.kernel.org/n/tip-sg2pkmtjr5988bhbcp4yp6sw@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      805e4c8b
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Sync prctl.h with the kernel sources · 3d32c453
      Arnaldo Carvalho de Melo authored
      To get the changes in ba830885 ("arm64: add prctl control for
      resetting ptrauth keys"), that introduce a prctl with a name that needs
      to be catch by the prctl cmd table generator, which will be done in the
      next cset.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kristina Martsenko <kristina.martsenko@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: https://lkml.kernel.org/n/tip-a1pahzc8lci0ey1fjvv1chdm@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3d32c453
    • Arnaldo Carvalho de Melo's avatar
      tools headers x86: Sync disabled-features.h · 94f45df8
      Arnaldo Carvalho de Melo authored
      To silence the following tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h'
        diff -u tools/arch/x86/include/asm/disabled-features.h arch/x86/include/asm/disabled-features.h
      
      Picking up the changes in dae0a105 ("x86/cpufeatures, x86/fault:
      Mark SMAP as disabled when configured out") that didn't entail any
      functionality change in the tooling side.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-vvge5xh6ii12oszexqknbgwp@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      94f45df8
    • Jin Yao's avatar
      perf stat: Fix endless wait for child process · 8a99255a
      Jin Yao authored
      We hit a 'perf stat' issue by using following script:
      
        #!/bin/bash
      
        sleep 1000 &
        exec perf stat -a -e cycles -I1000 -- sleep 5
      
      Since "perf stat" is launched by exec, the "sleep 1000" would be the
      child process of "perf stat". The wait4() call will not return because
      it's waiting for the child process "sleep 1000" to end. So 'perf stat'
      doesn't return even after 5s passes.
      
      This patch lets 'perf stat' return when the specified child process ends
      (in this case, the specified child process is "sleep 5").
      
      Committer testing:
      
        # cat test.sh
        #!/bin/bash
      
        sleep 10 &
        exec perf stat -a -e cycles -I1000 -- sleep 5
        #
      
      Before:
      
        # time ./test.sh
        #           time             counts unit events
             1.001113090        108,453,351      cycles
             2.002062196        142,075,435      cycles
             3.002896194        164,801,068      cycles
             4.003731666        107,062,140      cycles
             5.002068867        112,241,832      cycles
      
        real	0m10.066s
        user	0m0.016s
        sys	0m0.101s
        #
      
      After:
      
        # time ./test.sh
        #           time             counts unit events
             1.001016096         91,412,027      cycles
             2.002014963        124,063,708      cycles
             3.002883964        125,993,929      cycles
             4.003706470        120,465,734      cycles
             5.002006778        163,560,355      cycles
      
        real	0m5.123s
        user	0m0.014s
        sys	0m0.105s
        #
      Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1546501245-4512-1-git-send-email-yao.jin@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8a99255a
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-4.21-20190103' of... · 2573be22
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-4.21-20190103' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      perf c2c:
      
        Jiri Olsa:
      
        - Change the default coalesce setup to from '--coalesce pid,iaddr' to just '--coalesce iaddr'.
      
        - Increase the HITM ratio limit for displayed cachelines.
      
      perf script:
      
        Andi Kleen:
      
        - Fix LBR skid dump problems in brstackinsn.
      
      perf trace:
      
        Arnaldo Carvalho de Melo:
      
        - Check if the raw_syscalls:sys_{enter,exit} are setup before setting tp filter.
      
        - Do not hardcode the size of the tracepoint common_ fields.
      
        - Beautify USBDEFFS_ ioctl commands.
      
        Colin Ian King:
      
        - Use correct SECCOMP prefix spelling, "SECOMP_*" -> "SECCOMP_*".
      
      perf python:
      
        Jiri Olsa:
      
        - Do not force closing original perf descriptor in evlist.get_pollfd().
      
      tools misc:
      
        Jiri Olsa:
      
        - Allow overriding CFLAGS and LDFLAGS.
      
      perf build:
      
        Stanislav Fomichev:
      
        - Don't unconditionally link the libbfd feature test to -liberty and -lz
      
      thread-stack:
      
        Adrian Hunter:
      
        - Fix processing for the idle task, having a stack per cpu.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2573be22
  3. 02 Jan, 2019 8 commits
  4. 28 Dec, 2018 17 commits
  5. 27 Dec, 2018 2 commits