1. 22 9月, 2017 7 次提交
    • A
      perf tools: Provide mutex wrappers for pthreads rwlocks · 0a7c74ea
      Arnaldo Carvalho de Melo 提交于
      Andi reported a performance drop in single threaded perf tools such as
      'perf script' due to the growing number of locks being put in place to
      allow for multithreaded tools, so wrap the POSIX threads rwlock routines
      with the names used for such kinds of locks in the Linux kernel and then
      allow for tools to ask for those locks to be used or not.
      
      I.e. a tool may have a multithreaded phase and then switch to single
      threaded, like the upcoming patches for the synthesizing of
      PERF_RECORD_{FORK,MMAP,etc} for pre-existing processes to then switch to
      single threaded mode in 'perf top'.
      
      The init routines will not be conditional, this way starting as single
      threaded to then move to multi threaded mode should be possible.
      Reported-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20170404161739.GH12903@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0a7c74ea
    • A
      tools include: Do not use poison with C++ · 6ae8eefc
      Arnaldo Carvalho de Melo 提交于
      LIST_POISON[12] are used to initialize list_head and hlist_node
      pointers, and do void pointer arithmetic, which C++ doesn't like, so, to
      avoid drifting from the kernel by introducing some HLIST_POISON to do
      away with void pointer math, just make those poisoned pointers be NULL
      when building it with a C++ compiler.
      
      Noticed with:
      
        $ make LLVM_CONFIG=/usr/bin/llvm-config-3.9 LIBCLANGLLVM=1
          CXX      util/c++/clang.o
          CXX	   util/c++/clang-test.o
        In file included from /home/lizj/linux/tools/include/linux/list.h:5:0,
                         from /home/lizj/linux/tools/perf/util/namespaces.h:13,
                         from /home/lizj/linux/tools/perf/util/util.h:15,
                         from /home/lizj/linux/tools/perf/util/util-cxx.h:20,
                         from util/c++/clang-c.h:5,
                         from util/c++/clang-test.cpp:2:
        /home/lizj/linux/tools/include/linux/list.h: In function ‘void list_del(list_head*)’:
        /home/lizj/linux/tools/include/linux/poison.h:14:31: error: pointer of type ‘void *’ used in arithmetic [-Werror=pointer-arith]
         # define POISON_POINTER_DELTA 0
                                       ^
        /home/lizj/linux/tools/include/linux/poison.h:22:41: note: in expansion of macro ‘POISON_POINTER_DELTA’
         #define LIST_POISON1  ((void *) 0x100 + POISON_POINTER_DELTA)
                                                 ^
        /home/lizj/linux/tools/include/linux/list.h:107:16: note: in expansion of macro ‘LIST_POISON1’
          entry->next = LIST_POISON1;
                        ^
        In file included from /home/lizj/linux/tools/perf/util/namespaces.h:13:0,
                         from /home/lizj/linux/tools/perf/util/util.h:15,
                         from /home/lizj/linux/tools/perf/util/util-cxx.h:20,
                         from util/c++/clang-c.h:5,
                         from util/c++/clang-test.cpp:2:
        /home/lizj/linux/tools/include/linux/list.h:107:14: error: invalid conversion from ‘void*’ to ‘list_head*’ [-fpermissive]
      Reported-by: NLi Zhijian <lizhijian@cn.fujitsu.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: Philip Li <philip.li@intel.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-m5ei2o0mjshucbr28baf5lqz@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6ae8eefc
    • A
      perf tools: Get all of tools/{arch,include}/ in the MANIFEST · 0e1eed80
      Arnaldo Carvalho de Melo 提交于
      Now that I'm switching the container builds from using a local volume
      pointing to the kernel repository with the perf sources, instead getting
      a detached tarball to be able to use a container cluster, some places
      broke because I forgot to put some of the required files in
      tools/perf/MANIFEST, namely some bitsperlong.h files.
      
      So, to fix it do the same as for tools/build/ and pack the whole
      tools/arch/ directory.
      
      Cc: Adrian Hunter <adrian.hunter@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-wmenpjfjsobwdnfde30qqncj@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0e1eed80
    • A
      tools: Update asm-generic/mman-common.h copy from the kernel · 492e05b0
      Arnaldo Carvalho de Melo 提交于
      To get the defines introduced in the commit aafd4562 ("mm: arch:
      consolidate mmap hugetlb size encodings"), that doesn't brings anything
      interesting for tools/, but also the ones from d2cd9ede ("mm,fork:
      introduce MADV_WIPEONFORK"), which does, and ends up triggering an auto-update
      to the tools/perf/trace/beauty/generated/madvise_behavior_array.c file,
      supporting the newly introduced 'behavior' values.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/mman-common.h' differs from latest version at 'include/uapi/asm-generic/mman-common.h'
      
      Testing it:
      
        # cat madvise.c
        #include <sys/mman.h>
        #include <stdlib.h>
      
        #ifndef MADV_WIPEONFORK
        #define MADV_WIPEONFORK 18
        #endif
        #ifndef MADV_KEEPONFORK
        #define MADV_KEEPONFORK 19
        #endif
      
        int main(void)
        {
              void *ptr = mmap(NULL, 4096, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
      
              madvise(ptr, 4096, MADV_WIPEONFORK);
              madvise(ptr, 4096, MADV_KEEPONFORK);
      
      	return 0;
        }
        [root@jouet c]# perf trace -e mmap,madvise ./madvise
           0.000 ( 0.013 ms): madvise/11732 mmap(len: 8192, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS            ) = 0x7fba6e015000
           0.047 ( 0.004 ms): madvise/11732 mmap(len: 160164, prot: READ, flags: PRIVATE, fd: 3                   ) = 0x7fba6dfed000
           0.084 ( 0.009 ms): madvise/11732 mmap(len: 4000096, prot: EXEC|READ, flags: PRIVATE|DENYWRITE, fd: 3   ) = 0x7fba6da20000
           0.109 ( 0.006 ms): madvise/11732 mmap(addr: 0x7fba6dde7000, len: 24576, prot: READ|WRITE, flags: PRIVATE|DENYWRITE|FIXED, fd: 3, off: 1863680) = 0x7fba6dde7000
           0.125 ( 0.004 ms): madvise/11732 mmap(addr: 0x7fba6dded000, len: 14688, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS|FIXED) = 0x7fba6dded000
           0.150 ( 0.006 ms): madvise/11732 mmap(len: 12288, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS           ) = 0x7fba6dfea000
           0.288 ( 0.003 ms): madvise/11732 mmap(len: 4096, flags: PRIVATE|ANONYMOUS                              ) = 0x7fba6e014000
           0.292 ( 0.002 ms): madvise/11732 madvise(start: 0x7fba6e014000, len_in: 4096, behavior: MADV_WIPEONFORK) = 0
           0.295 ( 0.001 ms): madvise/11732 madvise(start: 0x7fba6e014000, len_in: 4096, behavior: MADV_KEEPONFORK) = 0
        # uname -a
        Linux jouet 4.13.0+ #2 SMP Mon Sep 18 17:22:46 -03 2017 x86_64 x86_64 x86_64 GNU/Linux
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-yev9rexu02cl7cjeozzmrl9t@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      492e05b0
    • A
      perf trace beauty madvise: Generate 'behavior' string table from kernel headers · 5a54c2f5
      Arnaldo Carvalho de Melo 提交于
      This is one more case where the way that syscall parameter values are
      defined in kernel headers are easy to parse using a shell script that
      will then generate the string table that gets used by the madvise
      'behaviour' argument beautifier.
      
      This way as soon as the header syncronization mechanism in perf's build
      system detects a change in a copy of a kernel ABI header and that file
      is syncronized, we get 'perf trace' updated automagically.
      
      So, when we syncronize this:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/mman-common.h' differs from latest version at 'include/uapi/asm-generic/mman-common.h'
      
      We'll get these:
      
        #define MADV_WIPEONFORK 18              /* Zero memory on fork, child only */
        #define MADV_KEEPONFORK 19              /* Undo MADV_WIPEONFORK */
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-dolb0ghds4ui7wc1npgkchvc@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5a54c2f5
    • X
      perf tests: Remove Intel CQM perf test · 5c9295bf
      Xiaochen Shen 提交于
      Intel CQM perf test is obsolete for perf PMU code has been removed in
      commit c39a0e2c ("x86/perf/cqm: Wipe out perf based cqm").
      Signed-off-by: NXiaochen Shen <xiaochen.shen@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Pei P Jia <pei.p.jia@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vikas Shivappa <vikas.shivappa@linux.intel.com>
      Link: http://lkml.kernel.org/r/1505797057-16300-1-git-send-email-xiaochen.shen@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5c9295bf
    • A
      perf stat: Fix adding multiple event groups · 411bc316
      Andi Kleen 提交于
      The -M metric group parser threw away the events of earlier groups when
      multiple groups were specified. Fix this here by not overwriting the
      string incorrectly.
      
      Now this works correctly:
      
      % perf stat -M Summary,SMT --metric-only -a sleep 1
      
       Performance counter stats for 'system wide':
      
      Instructions CPI CLKS         CPU_Utilization GFLOPs SMT_2T_Utilization SMT_2T_Utilization Kernel_Utilization CoreIPC CORE_CLKS
      900907376.0  2.7 2398954144.0 0.1             0.0    0.2                0.2                0.1                0.4     2080822855.5
      
      while previously it would only show the SMT metrics.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170914205735.18431-1-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      411bc316
  2. 18 9月, 2017 4 次提交
  3. 13 9月, 2017 29 次提交