1. 05 Nov, 2018 2 commits
  2. 20 Sep, 2018 2 commits
    • Adrian Hunter's avatar
      perf intel-pt: Implement decoder flags for trace begin / end · bea63857
      Adrian Hunter authored
      
      Have the Intel PT decoder implement the new Intel PT decoder flags for
      trace begin / end.
      
      Previously, the decoder would indicate begin / end by a branch from / to
      zero. That hides useful information, in particular when a trace ends
      with a call. That happens when using address filters, for example:
      
        $ perf record -e intel_pt/cyc,mtc_period=0,noretcomp/u --filter='filter main @ /bin/uname ' uname Linux
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.031 MB perf.data ]
      
      Before:
      
        $ perf script --itrace=cre -Ftime,flags,ip,sym,symoff,addr --ns
         7249.622183310:   tr strt         0 [unknown] =>   401590 main+0x0
         7249.622183311:   call       4015b9 main+0x29 =>        0 [unknown]
         7249.622183711:   tr strt         0 [unknown] =>   4015be main+0x2e
         7249.622183714:   call       4015c8 main+0x38 =>        0 [unknown]
         7249.622247731:   tr strt         0 [unknown] =>   4015cd main+0x3d
         7249.622247760:   call       4015d7 main+0x47 =>        0 [unknown]
         7249.622248340:   tr strt         0 [unknown] =>   4015dc main+0x4c
         7249.622248341:   call       4015e1 main+0x51 =>        0 [unknown]
         7249.622248681:   tr strt         0 [unknown] =>   4015e6 main+0x56
         7249.622248682:   call       4015eb main+0x5b =>        0 [unknown]
         7249.622248970:   tr strt         0 [unknown] =>   4015f0 main+0x60
         7249.622248971:   call       401612 main+0x82 =>        0 [unknown]
         7249.622249757:   tr strt         0 [unknown] =>   401617 main+0x87
         7249.622249770:   call       401847 main+0x2b7 =>        0 [unknown]
         7249.622250606:   tr strt         0 [unknown] =>   40184c main+0x2bc
         7249.622250612:   call       4019bf main+0x42f =>        0 [unknown]
         7249.622256823:   tr strt         0 [unknown] =>   4019c4 main+0x434
         7249.622256863:   call       4019f5 main+0x465 =>        0 [unknown]
         7249.622264217:   tr strt         0 [unknown] =>   4019fa main+0x46a
         7249.622264235:   call       401832 main+0x2a2 =>        0 [unknown]
      
      After:
      
        $ perf script --itrace=cre -Ftime,flags,ip,sym,symoff,addr --ns
         7249.622183310:   tr strt              0 [unknown] =>   401590 main+0x0
         7249.622183311:   tr end  call    4015b9 main+0x29 =>   401ef0 set_program_name+0x0
         7249.622183711:   tr strt              0 [unknown] =>   4015be main+0x2e
         7249.622183714:   tr end  call    4015c8 main+0x38 =>   4014b0 setlocale@plt+0x0
         7249.622247731:   tr strt              0 [unknown] =>   4015cd main+0x3d
         7249.622247760:   tr end  call    4015d7 main+0x47 =>   4012d0 bindtextdomain@plt+0x0
         7249.622248340:   tr strt              0 [unknown] =>   4015dc main+0x4c
         7249.622248341:   tr end  call    4015e1 main+0x51 =>   4012b0 textdomain@plt+0x0
         7249.622248681:   tr strt              0 [unknown] =>   4015e6 main+0x56
         7249.622248682:   tr end  call    4015eb main+0x5b =>   404340 atexit+0x0
         7249.622248970:   tr strt              0 [unknown] =>   4015f0 main+0x60
         7249.622248971:   tr end  call    401612 main+0x82 =>   401320 getopt_long@plt+0x0
         7249.622249757:   tr strt              0 [unknown] =>   401617 main+0x87
         7249.622249770:   tr end  call    401847 main+0x2b7 =>   401360 uname@plt+0x0
         7249.622250606:   tr strt              0 [unknown] =>   40184c main+0x2bc
         7249.622250612:   tr end  call    4019bf main+0x42f =>   401b10 print_element+0x0
         7249.622256823:   tr strt              0 [unknown] =>   4019c4 main+0x434
         7249.622256863:   tr end  call    4019f5 main+0x465 =>   401340 __overflow@plt+0x0
         7249.622264217:   tr strt              0 [unknown] =>   4019fa main+0x46a
         7249.622264235:   tr end  call    401832 main+0x2a2 =>   401520 exit@plt+0x0
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20180920130048.31432-7-adrian.hunter@intel.com
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bea63857
    • Adrian Hunter's avatar
      perf intel-pt: Add decoder flags for trace begin / end · c6b5da09
      Adrian Hunter authored
      
      Previously, the decoder would indicate begin / end by a branch from / to
      zero. That hides useful information, in particular when a trace ends
      with a call. To prepare for remedying that, add Intel PT decoder flags
      for trace begin / end and map them to the existing sample flags.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20180920130048.31432-6-adrian.hunter@intel.com
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c6b5da09
  3. 25 Jun, 2018 1 commit
  4. 06 Jun, 2018 3 commits
  5. 01 Jun, 2018 1 commit
  6. 08 Mar, 2018 3 commits
  7. 15 Dec, 2017 1 commit
  8. 06 Dec, 2017 1 commit
    • Ingo Molnar's avatar
      tooling/headers: Synchronize updated s390 and x86 UAPI headers · 34c9ca37
      Ingo Molnar authored
      
      There were two trivial updates to these upstream UAPI headers:
      
        arch/s390/include/uapi/asm/kvm.h
        arch/s390/include/uapi/asm/kvm_perf.h
        arch/x86/lib/x86-opcode-map.txt
      
      Synchronize them with their tooling copies.
      
      (The x86 opcode map includes a new instruction pattern now.)
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      34c9ca37
  9. 29 Nov, 2017 1 commit
  10. 28 Nov, 2017 1 commit
  11. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  12. 28 Aug, 2017 1 commit
  13. 30 Jun, 2017 1 commit
  14. 27 Jun, 2017 1 commit
  15. 21 Jun, 2017 13 commits
  16. 19 Jun, 2017 1 commit
  17. 16 Mar, 2017 1 commit
    • Andi Kleen's avatar
      perf script: Add 'brstackinsn' for branch stacks · 48d02a1d
      Andi Kleen authored
      
      Implement printing instruction sequences as hex dump for branch stacks.
      
      This relies on the x86 instruction decoder used by the PT decoder to
      find the lengths of instructions to dump them individually.
      
      This is good enough for pattern matching.
      
      This allows to study hot paths for individual samples, together with
      branch misprediction and cycle count / IPC information if available (on
      Skylake systems).
      
        % perf record -b ...
        % perf script -F brstackinsn
        ...
          read_hpet+67:
                ffffffff9905b843        insn: 74 ea                     # PRED
                ffffffff9905b82f        insn: 85 c9
                ffffffff9905b831        insn: 74 12
                ffffffff9905b833        insn: f3 90
                ffffffff9905b835        insn: 48 8b 0f
                ffffffff9905b838        insn: 48 89 ca
                ffffffff9905b83b        insn: 48 c1 ea 20
                ffffffff9905b83f        insn: 39 f2
                ffffffff9905b841        insn: 89 d0
                ffffffff9905b843        insn: 74 ea                     # PRED
      
      Only works when no special branch filters are specified.
      
      Occasionally the path does not reach up to the sample IP, as the LBRs
      may be frozen before executing a final jump. In this case we print a
      special message.
      
      The instruction dumper piggy backs on the existing infrastructure from
      the IP PT decoder.
      
      An earlier iteration of this patch relied on a disassembler, but this
      version only uses the existing instruction decoder.
      
      Committer note:
      
      Added hint about how to get suitable perf.data files for use with
      '-F brstackinsm':
      
        $ perf record usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.018 MB perf.data (8 samples) ]
        $
        $ perf script -F brstackinsn
        Display of branch stack assembler requested, but non all-branch filter set
        Hint: run 'perf record -b ...'
        $
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Link: http://lkml.kernel.org/r/20170223234634.583-1-andi@firstfloor.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      48d02a1d
  18. 03 Mar, 2017 1 commit
    • Adrian Hunter's avatar
      perf intel-PT/BTS: Add missing initialization · f1c4d1ad
      Adrian Hunter authored
      
        $ perf test decoder
        57: x86 instruction decoder - new instructions : FAILED!
        $
      
        Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 80 78 56 34 12 	bndstx %bnd0,0x12345678(%rax)
        Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 85 78 56 34 12 	bndstx %bnd0,0x12345678(%rbp)
        Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 84 01 78 56 34 12 	bndstx %bnd0,0x12345678(%rcx,%rax,1)
        Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 84 05 78 56 34 12 	bndstx %bnd0,0x12345678(%rbp,%rax,1)
        Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 84 08 78 56 34 12 	bndstx %bnd0,0x12345678(%rax,%rcx,1)
      
      There is missing initialization.  It only affects the test because it is
      checking 'rel' even in cases where there is no value.
      
      Fix it.
      Reported-and-Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/08c6ad07-7994-3e56-b20e-d75727ca7765@intel.com
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f1c4d1ad
  19. 01 Mar, 2017 1 commit
  20. 14 Feb, 2017 1 commit
  21. 09 Feb, 2017 1 commit
    • Arnaldo Carvalho de Melo's avatar
      perf intel-pt: Use __fallthrough · 7ea6856d
      Arnaldo Carvalho de Melo authored
      
      To address new warnings emmited by gcc 7, e.g.::
      
          CC       /tmp/build/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.o
          CC       /tmp/build/perf/tests/parse-events.o
        util/intel-pt-decoder/intel-pt-pkt-decoder.c: In function 'intel_pt_pkt_desc':
        util/intel-pt-decoder/intel-pt-pkt-decoder.c:499:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
           if (!(packet->count))
              ^
        util/intel-pt-decoder/intel-pt-pkt-decoder.c:501:2: note: here
          case INTEL_PT_CYC:
          ^~~~
          CC       /tmp/build/perf/util/intel-pt-decoder/intel-pt-decoder.o
        cc1: all warnings being treated as errors
      Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-mf0hw789pu9x855us5l32c83@git.kernel.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7ea6856d
  22. 24 Oct, 2016 1 commit