1. 15 7月, 2021 1 次提交
    • A
      perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK_MIN_VALUE) · d08c84e0
      Arnaldo Carvalho de Melo 提交于
      In fedora rawhide the PTHREAD_STACK_MIN define may end up expanded to a
      sysconf() call, and that will return 'long int', breaking the build:
      
          45 fedora:rawhide                : FAIL gcc version 11.1.1 20210623 (Red Hat 11.1.1-6) (GCC)
            builtin-sched.c: In function 'create_tasks':
            /git/perf-5.14.0-rc1/tools/include/linux/kernel.h:43:24: error: comparison of distinct pointer types lacks a cast [-Werror]
               43 |         (void) (&_max1 == &_max2);              \
                  |                        ^~
            builtin-sched.c:673:34: note: in expansion of macro 'max'
              673 |                         (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
                  |                                  ^~~
            cc1: all warnings being treated as errors
      
        $ grep __sysconf /usr/include/*/*.h
        /usr/include/bits/pthread_stack_min-dynamic.h:extern long int __sysconf (int __name) __THROW;
        /usr/include/bits/pthread_stack_min-dynamic.h:#   define PTHREAD_STACK_MIN __sysconf (__SC_THREAD_STACK_MIN_VALUE)
        /usr/include/bits/time.h:extern long int __sysconf (int);
        /usr/include/bits/time.h:# define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
        $
      
      So cast it to int to cope with that.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d08c84e0
  2. 24 3月, 2021 1 次提交
  3. 30 11月, 2020 1 次提交
  4. 13 10月, 2020 1 次提交
    • J
      perf sched: Show start of latency as well · dc000c45
      Joel Fernandes (Google) 提交于
      The 'perf sched latency' tool is really useful at showing worst-case
      latencies that task encountered since wakeup. However it shows only the
      end of the latency. Often times the start of a latency is interesting as
      it can show what else was going on at the time to cause the latency. I
      certainly myself spending a lot of time backtracking to the start of the
      latency in "perf sched script" which wastes a lot of time.
      
      This patch therefore adds a new column "Max delay start". Considering
      this, also rename "Maximum delay at" to "Max delay end" as its easier to
      understand.
      
      Example of the new output:
      
        ----------------------------------------------------------------------------------------------------------------------------------
         Task                  | Runtime ms  | Switches | Avg delay ms  | Max delay ms   | Max delay start         | Max delay end       |
        ----------------------------------------------------------------------------------------------------------------------------------
         MediaScannerSer:11936 |  651.296 ms |    67978 | avg: 0.113 ms | max: 77.250 ms | max start: 477.691360 s | max end: 477.768610 s
         audio@2.0-servi:(3)   |    0.000 ms |     3440 | avg: 0.034 ms | max: 72.267 ms | max start: 477.697051 s | max end: 477.769318 s
         AudioOut_1D:8112      |    0.000 ms |     2588 | avg: 0.083 ms | max: 64.020 ms | max start: 477.710740 s | max end: 477.774760 s
         Time-limited te:14973 | 7966.090 ms |    24807 | avg: 0.073 ms | max: 15.563 ms | max start: 477.162746 s | max end: 477.178309 s
         surfaceflinger:8049   |    9.680 ms |      603 | avg: 0.063 ms | max: 13.275 ms | max start: 476.931791 s | max end: 476.945067 s
         HeapTaskDaemon:(3)    | 1588.830 ms |     7040 | avg: 0.065 ms | max:  6.880 ms | max start: 473.666043 s | max end: 473.672922 s
         mount-passthrou:(3)   | 1370.809 ms |    68904 | avg: 0.011 ms | max:  6.524 ms | max start: 478.090630 s | max end: 478.097154 s
         ReferenceQueueD:(3)   |   11.794 ms |     1725 | avg: 0.014 ms | max:  6.521 ms | max start: 476.119782 s | max end: 476.126303 s
         writer:14077          |   18.410 ms |     1427 | avg: 0.036 ms | max:  6.131 ms | max start: 474.169675 s | max end: 474.175805 s
      Signed-off-by: NJoel Fernandes (Google) <joel@joelfernandes.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20200925235634.4089867-1-joel@joelfernandes.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dc000c45
  5. 21 8月, 2020 1 次提交
  6. 13 8月, 2020 1 次提交
  7. 06 5月, 2020 3 次提交
  8. 06 1月, 2020 1 次提交
    • D
      perf sched timehist: Add support for filtering on CPU · c30d630d
      David Ahern 提交于
      Allow user to limit output to one or more CPUs. Really helpful on
      systems with a large number of cpus.
      
      Committer testing:
      
        # perf sched record -a sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 1.765 MB perf.data (1412 samples) ]
        [root@quaco ~]# perf sched timehist | head
        Samples do not have callchains.
                   time    cpu  task name                       wait time  sch delay   run time
                                [tid/pid]                          (msec)     (msec)     (msec)
        --------------- ------  ------------------------------  ---------  ---------  ---------
           66307.802686 [0000]  perf[13086]                         0.000      0.000      0.000
           66307.802700 [0000]  migration/0[12]                     0.000      0.001      0.014
           66307.802766 [0001]  perf[13086]                         0.000      0.000      0.000
           66307.802774 [0001]  migration/1[15]                     0.000      0.001      0.007
           66307.802841 [0002]  perf[13086]                         0.000      0.000      0.000
           66307.802849 [0002]  migration/2[20]                     0.000      0.001      0.008
           66307.802913 [0003]  perf[13086]                         0.000      0.000      0.000
        #
        # perf sched timehist --cpu 2 | head
        Samples do not have callchains.
                   time    cpu  task name                       wait time  sch delay   run time
                                [tid/pid]                          (msec)     (msec)     (msec)
        --------------- ------  ------------------------------  ---------  ---------  ---------
           66307.802841 [0002]  perf[13086]                         0.000      0.000      0.000
           66307.802849 [0002]  migration/2[20]                     0.000      0.001      0.008
           66307.964485 [0002]  <idle>                              0.000      0.000    161.635
           66307.964811 [0002]  CPU 0/KVM[3589/3561]                0.000      0.056      0.325
           66307.965477 [0002]  <idle>                              0.325      0.000      0.666
           66307.965553 [0002]  CPU 0/KVM[3589/3561]                0.666      0.024      0.076
           66307.966456 [0002]  <idle>                              0.076      0.000      0.903
        #
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/20191204173925.66976-1-dsahern@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c30d630d
  9. 12 11月, 2019 1 次提交
  10. 26 9月, 2019 2 次提交
  11. 21 9月, 2019 1 次提交
  12. 20 9月, 2019 2 次提交
  13. 01 9月, 2019 1 次提交
  14. 30 8月, 2019 1 次提交
  15. 27 8月, 2019 1 次提交
    • J
      libperf: Add PERF_RECORD_LOST 'struct lost_event' to perf/event.h · 5290ed69
      Jiri Olsa 提交于
      Move the lost_event event definition to libperf's event.h header
      include.
      
      In order to keep libperf simple, we switch 'u64/u32/u16/u8' types used
      events to their generic '__u*' versions.
      
      Perf added 'u*' types mainly to ease up printing __u64 values as stated
      in the linux/types.h comment:
      
        /*
         * We define u64 as uint64_t for every architecture
         * so that we can print it with "%"PRIx64 without getting warnings.
         *
         * typedef __u64 u64;
         * typedef __s64 s64;
         */
      
      Add and use new PRI_lu64 and PRI_lx64 macros for that.  Use extra '_' to
      ease up the reading and differentiate them from standard PRI*64 macros.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      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>
      Link: http://lkml.kernel.org/r/20190825181752.722-7-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5290ed69
  16. 30 7月, 2019 7 次提交
  17. 09 7月, 2019 1 次提交
  18. 26 6月, 2019 2 次提交
  19. 23 2月, 2019 1 次提交
    • J
      perf data: Add global path holder · 2d4f2799
      Jiri Olsa 提交于
      Add a 'path' member to 'struct perf_data'. It will keep the configured
      path for the data (const char *). The path in struct perf_data_file is
      now dynamically allocated (duped) from it.
      
      This scheme is useful/used in following patches where struct
      perf_data::path holds the 'configure' directory path and struct
      perf_data_file::path holds the allocated path for specific files.
      
      Also it actually makes the code little simpler.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/20190221094145.9151-3-jolsa@kernel.org
      [ Fixup data-convert-bt.c missing conversion ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2d4f2799
  20. 25 1月, 2019 1 次提交
  21. 22 1月, 2019 1 次提交
    • R
      perf tools: Replace automatic const char[] variables by statics · 49b8e2be
      Rasmus Villemoes 提交于
      An automatic const char[] variable gets initialized at runtime, just
      like any other automatic variable. For long strings, that uses a lot of
      stack and wastes time building the string; e.g. for the "No %s
      allocation events..." case one has:
      
        444516:       48 b8 4e 6f 20 25 73 20 61 6c   movabs $0x6c61207325206f4e,%rax # "No %s al"
        ...
        444674:       48 89 45 80                     mov    %rax,-0x80(%rbp)
        444678:       48 b8 6c 6f 63 61 74 69 6f 6e   movabs $0x6e6f697461636f6c,%rax # "location"
        444682:       48 89 45 88                     mov    %rax,-0x78(%rbp)
        444686:       48 b8 20 65 76 65 6e 74 73 20   movabs $0x2073746e65766520,%rax # " events "
        444690:       66 44 89 55 c4                  mov    %r10w,-0x3c(%rbp)
        444695:       48 89 45 90                     mov    %rax,-0x70(%rbp)
        444699:       48 b8 66 6f 75 6e 64 2e 20 20   movabs $0x20202e646e756f66,%rax
      
      Make them all static so that the compiler just references objects in .rodata.
      
      Committer testing:
      
      Ok, using dwarves's codiff tool:
      
          $ codiff --functions /tmp/perf.before ~/bin/perf
        builtin-sched.c:
          cmd_sched                 |  -48
         1 function changed, 48 bytes removed, diff: -48
      
        builtin-report.c:
          cmd_report                |  -32
         1 function changed, 32 bytes removed, diff: -32
      
        builtin-kmem.c:
          cmd_kmem                  |  -64
          build_alloc_func_list     |  -50
         2 functions changed, 114 bytes removed, diff: -114
      
        builtin-c2c.c:
          perf_c2c__report          | -390
         1 function changed, 390 bytes removed, diff: -390
      
        ui/browsers/header.c:
          tui__header_window        | -104
         1 function changed, 104 bytes removed, diff: -104
      
        /home/acme/bin/perf:
         9 functions changed, 688 bytes removed, diff: -688
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      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: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20181102230624.20064-1-linux@rasmusvillemoes.dkSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      49b8e2be
  22. 05 6月, 2018 2 次提交
  23. 07 3月, 2018 2 次提交
  24. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      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: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  25. 31 10月, 2017 2 次提交
  26. 13 9月, 2017 1 次提交