1. 08 4月, 2015 7 次提交
    • Y
      perf sched replay: Alloc the memory of pid_to_task dynamically to adapt to the... · cb06ac25
      Yunlong Song 提交于
      perf sched replay: Alloc the memory of pid_to_task dynamically to adapt to the unexpected change of pid_max
      
      The current memory allocation of struct task_desc *pid_to_task[MAX_PID]
      is in a permanent and preset way, and it has two problems:
      
      Problem 1: If the pid_max, which is the max number of pids in the
      system, is much smaller than MAX_PID (1024*1000), then it causes a waste
      of stack memory. This may happen in the case where the number of cpu
      cores is much smaller than 1000.
      
      Problem 2: If the pid_max is changed from the default value to a value
      larger than MAX_PID, then it will cause assertion failure problem. The
      maximum value of pid_max can be set to pid_max_max (see pidmap_init
      defined in kernel/pid.c), which equals to PID_MAX_LIMIT. In x86_64,
      PID_MAX_LIMIT is 4*1024*1024 (defined in include/linux/threads.h). This
      value is much larger than MAX_PID, and will take up 32768 Kbytes
      (4*1024*1024*8/1024) for memory allocation of pid_to_task, which is much
      larger than the default 8192 Kbytes of the stack size of calling
      process.
      
      Due to these two problems, we use calloc to allocate the memory of
      pid_to_task dynamically.
      
      Example:
      
      Test environment: x86_64 with 160 cores
      
       $ cat /proc/sys/kernel/pid_max
       163840
       $ echo 1025000 > /proc/sys/kernel/pid_max
       $ cat /proc/sys/kernel/pid_max
       1025000
      
      Run some applications until the pid of some process is greater than
      the value of MAX_PID (1024*1000).
      
      Before this patch:
      
       $ perf sched replay
       run measurement overhead: 221 nsecs
       sleep measurement overhead: 55480 nsecs
       the run test took 1000008 nsecs
       the sleep test took 1063151 nsecs
       perf: builtin-sched.c:330: register_pid: Assertion `!(pid >= 1024000)'
       failed.
       Aborted
      
      After this patch:
      
       $ perf sched replay
       run measurement overhead: 221 nsecs
       sleep measurement overhead: 55435 nsecs
       the run test took 1000004 nsecs
       the sleep test took 1059312 nsecs
       nr_run_events:        10
       nr_sleep_events:      1562
       nr_wakeup_events:     5
       task      0 (                  :1:         1), nr_events: 1
       task      1 (                  :2:         2), nr_events: 1
       task      2 (                  :3:         3), nr_events: 1
       task      3 (                  :5:         5), nr_events: 1
       ...
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427809596-29559-4-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cb06ac25
    • Y
      perf sched replay: Increase the MAX_PID value to fix assertion failure problem · a35e27d0
      Yunlong Song 提交于
      Current MAX_PID is only 65536, which will cause assertion failure problem
      when CPU cores are more than 64 in x86_64.
      
      This is because the pid_max value in x86_64 is at least
      PIDS_PER_CPU_DEFAULT * num_possible_cpus() (see function pidmap_init
      defined in kernel/pid.c), where PIDS_PER_CPU_DEFAULT is 1024 (defined in
      include/linux/threads.h).
      
      Thus for MAX_PID = 65536, the correspoinding CPU cores are
      65536/1024=64.  This is obviously not enough at all for x86_64, and will
      cause an assertion failure problem due to BUG_ON(pid >= MAX_PID) in the
      codes.
      
      We increase MAX_PID value from 65536 to 1024*1000, which can be used in
      x86_64 with 1000 cores.
      
      This number is finally decided according to the limitation of stack size
      of calling process.
      
      Use 'ulimit -a', the result shows the stack size of any process is 8192
      Kbytes, which is defined in include/uapi/linux/resource.h (#define
      _STK_LIM (8*1024*1024)).
      
      Thus we choose a large enough value for MAX_PID, and make it satisfy to
      the limitation of the stack size, i.e., making the perf process take up
      a memory space just smaller than 8192 Kbytes.
      
      We have calculated and tested that 1024*1000 is OK for MAX_PID.
      
      This means perf sched replay can now be used with at most 1000 cores in
      x86_64 without any assertion failure problem.
      
      Example:
      
      Test environment: x86_64 with 160 cores
      
       $ cat /proc/sys/kernel/pid_max
       163840
      
      Before this patch:
      
       $ perf sched replay
       run measurement overhead: 240 nsecs
       sleep measurement overhead: 55379 nsecs
       the run test took 1000004 nsecs
       the sleep test took 1059424 nsecs
       perf: builtin-sched.c:330: register_pid: Assertion `!(pid >= 65536)'
       failed.
       Aborted
      
      After this patch:
      
       $ perf sched replay
       run measurement overhead: 221 nsecs
       sleep measurement overhead: 55397 nsecs
       the run test took 999920 nsecs
       the sleep test took 1053313 nsecs
       nr_run_events:        10
       nr_sleep_events:      1562
       nr_wakeup_events:     5
       task      0 (                  :1:         1), nr_events: 1
       task      1 (                  :2:         2), nr_events: 1
       task      2 (                  :3:         3), nr_events: 1
       task      3 (                  :5:         5), nr_events: 1
       ...
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427809596-29559-3-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a35e27d0
    • Y
      perf sched replay: Use struct task_desc instead of struct task_task for correct meaning · 0755bc4d
      Yunlong Song 提交于
      There is no struct task_task at all, thus it is a typo error in the old
      commits, now fix it to what it should be in order to avoid unnecessary
      misunderstanding.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427809596-29559-2-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0755bc4d
    • J
      perf kmem: Respect -i option · 28939e1a
      Jiri Olsa 提交于
      Currently the perf kmem does not respect -i option.
      
      Initializing the file.path properly after options get parsed.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/1428298576-9785-2-git-send-email-namhyung@kernel.orgSigned-off-by: NNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      28939e1a
    • N
      tools lib traceevent: Honor operator priority · 3201f0dc
      Namhyung Kim 提交于
      Currently it ignores operator priority and just sets processed args as a
      right operand.  But it could result in priority inversion in case that
      the right operand is also a operator arg and its priority is lower.
      
      For example, following print format is from new kmem events.
      
        "page=%p", REC->pfn != -1UL ? (((struct page *)(0xffffea0000000000UL)) + (REC->pfn)) : ((void *)0)
      
      But this was treated as below:
      
        REC->pfn != ((null - 1UL) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0)
      
      In this case, the right arg was '?' operator which has lower priority.
      But it just sets the whole arg so making the output confusing - page was
      always 0 or 1 since that's the result of logical operation.
      
      With this patch, it can handle it properly like following:
      
        ((REC->pfn != (null - 1UL)) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0)
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/1428298576-9785-10-git-send-email-namhyung@kernel.org
      [ Replaced 'swap' with 'rotate' in a comment as requested by Steve and agreed by Namhyung ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3201f0dc
    • W
      perf kmaps: Check kmaps to make code more robust · ba92732e
      Wang Nan 提交于
      This patch add checks in places where map__kmap is used to get kmaps
      from struct kmap.
      
      Error messages are added at map__kmap to warn invalid accessing of kmap
      (for the case of !map->dso->kernel, kmap(map) does not exists at all).
      
      Also, introduces map__kmaps() to warn uninitialized kmaps.
      Reviewed-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Cc: pi3orama@163.com
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Link: http://lkml.kernel.org/r/1428394966-131044-2-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ba92732e
    • H
      perf evlist: Fix inverted logic in perf_mmap__empty · 8ea92ceb
      He Kuang 提交于
      perf_evlist__mmap_consume() uses perf_mmap__empty() to judge whether
      perf_mmap is empty and can be released. But the result is inverted so
      fix it.
      Signed-off-by: NHe Kuang <hekuang@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1428399071-7141-1-git-send-email-hekuang@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8ea92ceb
  2. 03 4月, 2015 16 次提交
    • I
      Merge tag 'perf-core-for-mingo' of... · 6645f318
      Ingo Molnar 提交于
      Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      User visible changes:
      
        - Support unnamed union/structure members data collection in 'perf probe'. (Masami Hiramatsu)
      
        - Support missing -f to override perf.data file ownership. (Yunlong Song)
      
      Infrastructure changes:
      
        - No need to lookup thread twice when processing samples in 'perf script'. (Arnaldo Carvalho de Melo)
      
        - No need to pass thread twice to the scripting callbacks. (Arnaldo Carvalho de Melo)
      
        - No need to pass thread twice to the db-export facility. (Arnaldo Carvalho de Melo)
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      6645f318
    • Y
      perf data: Support using -f to override perf.data file ownership for 'convert' · bd05954b
      Yunlong Song 提交于
      Enable perf data convert to use perf.data when it is not owned by
      current user or root.
      
      Example:
      
       # perf record ls
       # chown Yunlong.Song:Yunlong.Song perf.data
       # ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 28260 Apr  2 17:35 perf.data
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf data convert --to-ctf=./ctf-data/
       File perf.data not owned by current user or root (use -f to override)
       # perf data convert --to-ctf=./ctf-data/ -f
         Error: unknown switch `f'
      
        usage: perf data convert [<options>]
      
           -v, --verbose         be more verbose
           -i, --input <file>    input file name
               --to-ctf ...      Convert to CTF format
      
      After this patch:
      
       # perf data convert --to-ctf=./ctf-data/
       File perf.data not owned by current user or root (use -f to override)
       # perf data convert --to-ctf=./ctf-data/ -f
       # ls ctf-data/
       metadata  perf_stream_0
      
      As shown above, the -f option really works now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-11-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bd05954b
    • Y
      perf trace: Support using -f to override perf.data file ownership · e366a6d8
      Yunlong Song 提交于
      Enable perf trace to use perf.data when it is not owned by current user
      or root.
      
      Example:
      
       # perf trace record ls
       # chown Yunlong.Song:Yunlong.Song perf.data
       # ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 4153101 Apr  2 15:28 perf.data
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf trace -i perf.data
       File perf.data not owned by current user or root (use -f to override)
       # perf trace -i perf.data -f
         Error: unknown switch `f'
      
        usage: perf trace [<options>] [<command>]
           or: perf trace [<options>] -- <command> [<options>]
           or: perf trace record [<options>] [<command>]
           or: perf trace record [<options>] -- <command> [<options>]
      
               --event <event>   event selector. use 'perf list' to list
       						  available events
               --comm            show the thread COMM next to its id
               --tool_stats      show tool stats
           -e, --expr <expr>     list of events to trace
           -o, --output <file>   output file name
           -i, --input <file>    Analyze events in file
           -p, --pid <pid>       trace events on existing process id
           -t, --tid <tid>       trace events on existing thread id
               --filter-pids <float>
        ...
      
      As shown above, the -f option does not work at all.
      
      After this patch:
      
       # perf trace -i perf.data
       File perf.data not owned by current user or root (use -f to override)
       # perf trace -i perf.data -f
       0.056 ( 0.002 ms): ls/47325 brk(                                 ...
       0.108 ( 0.018 ms): ls/47325 mmap(len: 4096, prot: READ|WRITE,    ...
       0.145 ( 0.013 ms): ls/47325 access(filename: 0x7f31259a0eb0,     ...
       0.172 ( 0.008 ms): ls/47325 open(filename: 0x7fffeb9a0d00,       ...
       0.180 ( 0.004 ms): ls/47325 stat(filename: 0x7fffeb9a0d00,       ...
       0.185 ( 0.004 ms): ls/47325 open(filename: 0x7fffeb9a0d00,       ...
       0.189 ( 0.003 ms): ls/47325 stat(filename: 0x7fffeb9a0d00,       ...
       0.195 ( 0.004 ms): ls/47325 open(filename: 0x7fffeb9a0d00,       ...
       0.199 ( 0.002 ms): ls/47325 stat(filename: 0x7fffeb9a0d00,       ...
       0.205 ( 0.004 ms): ls/47325 open(filename: 0x7fffeb9a0d00,       ...
       0.211 ( 0.004 ms): ls/47325 stat(filename: 0x7fffeb9a0d00,       ...
       0.220 ( 0.007 ms): ls/47325 open(filename: 0x7f312599e8ff,       ...
       ...
       ...
      
      As shown above, the -f option really works now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-10-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e366a6d8
    • Y
      perf timechart: Support using -f to override perf.data file ownership · 44f7e432
      Yunlong Song 提交于
      Enable perf timechart to use perf.data when it is not owned by current
      user or root.
      
      Example:
      
       # perf timechart record ls
       # chown Yunlong.Song:Yunlong.Song perf.data
       # ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 5471744 Apr  2 15:15 perf.data
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf timechart
       File perf.data not owned by current user or root (use -f to override)
       # perf timechart -f
         Error: unknown switch `f'
      
        usage: perf timechart [<options>] {record}
      
           -i, --input <file>    input file name
           -o, --output <file>   output file name
           -w, --width <n>       page width
               --highlight <duration or task name>
                                 highlight tasks. Pass duration in ns or process name.
           -P, --power-only      output power data only
           -T, --tasks-only      output processes data only
           -p, --process <process>
                                 process selector. Pass a pid or process name.
               --symfs <directory>
                                 Look for files with symbols relative to this directory
           -n, --proc-num <n>    min. number of tasks to print
           -t, --topology        sort CPUs according to topology
               --io-skip-eagain  skip EAGAIN errors
               --io-min-time <time>
                                 all IO faster than min-time will visually appear longer
               --io-merge-dist <time>
                                 merge events that are merge-dist us apart
      
      As shown above, the -f option does not work at all.
      
      After this patch:
      
       # perf timechart
       File perf.data not owned by current user or root (use -f to override)
       # perf timechart -f
       Written 0.0 seconds of trace to output.svg.
       # cat output.svg
       <?xml version="1.0" standalone="no"?>
       <!DOCTYPE svg SYSTEM "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
       <svg width="1000" height="10110" version="1.1" xmlns="http://www.w3.org/2000/svg">
       <defs>
         <style type="text/css">
           <![CDATA[
             rect          { stroke-width: 1; }
       ...
       ...
      
      As shown above, the -f option really works now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-9-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      44f7e432
    • Y
      perf script: Support using -f to override perf.data file ownership · 06af0f2c
      Yunlong Song 提交于
      Enable perf script to use perf.data when it is not owned by current user
      or root. Change the short option name of --fields to -F to avoid confusion
      with --force.
      
      Example:
      
       # perf record ls
       # chown Yunlong.Song:Yunlong.Song perf.data
       # ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 28360 Apr  2 14:53 perf.data
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf script
       File perf.data not owned by current user or root (use -f to override)
       # perf script -f
         Error: switch `f' requires a value
      
        usage: perf script [<options>]
           or: perf script [<options>] record <script> [<record-options>] <command>
           or: perf script [<options>] report <script> [script-args]
           or: perf script [<options>] <script> [<record-options>] <command>
           or: perf script [<options>] <top-script> [script-args]
      
           -f, --fields <str>    comma separated output fields prepend with
           'type:'. Valid types: hw,sw,trace,raw. Fields:
           comm,tid,pid,time,cpu,event,trace,ip,sym,dso,addr,symoff,period
      
      As shown above, the -f option does not work at all. And -f is already
      taken up by --fields, which makes --force confused, so change the short
      option name of --fields to -F like what other perf commands do (e.g.
      perf report -F) and use -f as the short option name of --force.
      
      After this patch:
      
       # perf script
       File perf.data not owned by current user or root (use -f to override)
       # perf script -f
       :41298 41298 2590086.564226:          1 cycles:  ffffffff8103efc6
       native_write_msr_safe ([kernel.kallsyms])
       :41298 41298 2590086.564244:          1 cycles:  ffffffff8103efc6
       native_write_msr_safe ([kernel.kallsyms])
       :41298 41298 2590086.564249:          7 cycles:  ffffffff8103efc6
       native_write_msr_safe ([kernel.kallsyms])
       :41298 41298 2590086.564255:        176 cycles:  ffffffff8103efc6
       native_write_msr_safe ([kernel.kallsyms])
           ls 41298 2590086.567346:       4059 cycles:  ffffffff8105a592
           raise_softirq ([kernel.kallsyms])
           ls 41298 2590086.567353:       3717 cycles:  ffffffff8105a592
           raise_softirq ([kernel.kallsyms])
           ls 41298 2590086.567358:      63058 cycles:  ffffffff8105a592
           raise_softirq ([kernel.kallsyms])
           ls 41298 2590086.567448:    1706255 cycles:            406ae0
           [unknown] (/usr/bin/ls)
      
      As shown above, the -f option really works now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-8-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      06af0f2c
    • Y
      perf mem: Support using -f to override perf.data file ownership · 62a1a63a
      Yunlong Song 提交于
      Enable perf mem to use perf.data when it is not owned by current user or
      root.
      
      Example:
      
       # perf mem -t load record ls
       # chown Yunlong.Song:Yunlong.Song perf.data
       # ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 16392 Apr  2 14:34 perf.data
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf mem -D report
       File perf.data not owned by current user or root (use -f to override)
       # perf mem -D -f report
         Error: unknown switch `f'
      
        usage: perf mem [<options>] {record|report}
      
           -t, --type <type>     memory operations(load,store) Default load,store
           -D, --dump-raw-samples
                                 dump raw samples in ASCII
           -U, --hide-unresolved
                                 Only display entries resolved to a symbol
           -i, --input <file>    input file name
           -C, --cpu <cpu>       list of cpus to profile
           -x, --field-separator <separator>
                                 separator for columns, no spaces will be added
                                 between columns '.' is reserved.
      
      As shown above, the -f option does not work at all.
      
      After this patch:
      
       # perf mem -D report
       File perf.data not owned by current user or root (use -f to override)
       # perf mem -D -f report
       # PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL
       39095 39095 0xffffffff81127e40 0x016ffff887f45148338 8 0x68100142
       /proc/kcore:perf_event_aux
       39095 39095 0xffffffff8100a3fe 0xffff89007f8cb7d0 6 0x68100142
       /proc/kcore:native_sched_clock
       39095 39095 0xffffffff81309139 0xffff88bf44c9ded8 6 0x68100142
       /proc/kcore:acpi_map_lookup
       39095 39095 0xffffffff810f8c4c 0xffff89007f8ccd88 6 0x68100142
       /proc/kcore:rcu_nmi_exit
       39095 39095 0xffffffff81136346 0xffff88fea995dd50 6 0x68100142
       /proc/kcore:unlock_page
       39095 39095 0xffffffff812a64a2 0xffff88fea995dcc8 6 0x68100142
       /proc/kcore:half_md4_transform
       39095 39095 0x7f0cf877c7e9 0x25dfb94 6 0x68100142
       /lib64/libc-2.19.so:__readdir64
       39095 39095 0x7f0cf87575a3 0x7f0cf9163731 6 0x68100142
       /lib64/libc-2.19.so:__strcoll_l
       39095 39095 0xffffffff8116910e 0xffffea01c1bfbd50 23 0x68100242
       /proc/kcore:page_remove_rmap
      
      As shown above, the -f option really works now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-7-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      62a1a63a
    • Y
      perf lock: Support using -f to override perf.data file ownership · c4ac732a
      Yunlong Song 提交于
      Enable perf lock to use perf.data when it is not owned by current user
      or root.
      
      Example:
      
       # perf lock record ls
       # chown Yunlong.Song:Yunlong.Song perf.data
       # ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 4880686 Apr  2 14:14 perf.data
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf lock report
       File perf.data not owned by current user or root (use -f to override)
       Initializing perf session failed
       # perf lock report -f
         Error: unknown switch `f'
      
        usage: perf lock report [<options>]
      
           -k, --key <acquired>  key for sorting (acquired / contended /
           avg_wait / wait_total / wait_max / wait_min)
      
      As shown above, the -f option does not work at all.
      
      After this patch:
      
       # perf lock report
       File perf.data not owned by current user or root (use -f to override)
       Initializing perf session failed
       # perf lock report -f
                      Name   acquired  contended   avg wait (ns) total wait (ns) ...
      
       &ldata->output_l...        128          0               0               0 ...
                &ctx->lock        114          0               0               0 ...
               &p->pi_lock        112          0               0               0 ...
       &(&pool->lock)->...        112          0               0               0 ...
       &(&dentry->d_loc...         70          0               0               0 ...
       &(&newf->file_lo...         62          0               0               0 ...
       &(&fs->lock)->rl...         43          0               0               0 ...
       ...
      
      As shown above, the -f option really works now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-6-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c4ac732a
    • Y
      perf kvm: Support using -f to override perf.data.guest file ownership · 8cc5ec1f
      Yunlong Song 提交于
      Enable perf kvm to use perf.data.guest when it is not owned by current
      user or root.
      
      Example:
      
       # perf kvm stat record ls
       # chown Yunlong.Song:Yunlong.Song perf.data.guest
       # ls -al perf.data.guest
       -rw------- 1 Yunlong.Song Yunlong.Song 4128937 Apr  2 11:05 perf.data.guest
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf kvm stat report
       File perf.data.guest not owned by current user or root (use -f to override)
       Initializing perf session failed
       # perf kvm stat report -f
         Error: unknown switch `f'
      
        usage: perf kvm stat report [<options>]
      
               --event <report event>
                                 event for reporting: vmexit, mmio (x86 only),
                                 ioport (x86 only)
               --vcpu <n>        vcpu id to report
           -k, --key <sort-key>  key for sorting: sample(sort by samples
       						   number) time (sort by avg time)
           -p, --pid <pid>       analyze events only for given process id(s)
      
      As shown above, the -f option does not work at all.
      
      After this patch:
      
       # perf kvm stat report
       File perf.data.guest not owned by current user or root (use -f to override)
       Initializing perf session failed
       # perf kvm stat report -f
       Analyze events for all VMs, all VCPUs:
      
         VM-EXIT    Samples  Samples%     Time%    Min Time    Max Time   Avg time
      
       Total Samples:0, Total events handled time:0.00us.
      
      As shown above, the -f option really works now. Since we have not
      launched any KVM related process, the result shows 0 sample here.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-5-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8cc5ec1f
    • Y
      perf kmem: Support using -f to override perf.data file ownership · d1eeb77c
      Yunlong Song 提交于
      Enable perf kmem to use perf.data when it is not owned by current user
      or root.
      
      Example:
      
       # perf kmem record ls
       # chown Yunlong.Song:Yunlong.Song perf.data
       # ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 5315665 Apr  2 10:54 perf.data
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf kmem stat
       File perf.data not owned by current user or root (use -f to override)
       # perf kmem stat -f
         Error: unknown switch `f'
      
        usage: perf kmem [<options>] {record|stat}
      
           -i, --input <file>    input file name
           -v, --verbose         be more verbose (show symbol address, etc)
               --caller          show per-callsite statistics
               --alloc           show per-allocation statistics
           -s, --sort <key[,key2...]>
                                 sort by keys: ptr, call_site, bytes, hit,
                                 pingpong, frag
           -l, --line <num>      show n lines
               --raw-ip          show raw ip instead of symbol
      
      As shown above, the -f option does not work at all.
      
      After this patch:
      
       # perf kmem stat
       File perf.data not owned by current user or root (use -f to override)
       # perf kmem stat -f
       SUMMARY
       =======
       Total bytes requested: 437599
       Total bytes allocated: 615472
       Total bytes wasted on internal fragmentation: 177873
       Internal fragmentation: 28.900259%
       Cross CPU allocations: 6/1192
      
      As shown above, the -f option really works now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-4-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d1eeb77c
    • Y
      perf inject: Support using -f to override perf.data file ownership · ccaa474c
      Yunlong Song 提交于
      Enable perf inject to use perf.data when it is not owned by current user
      or root.
      
      Example:
      
       # perf record ls
       # chown Yunlong.Song:Yunlong.Song perf.data
       # ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 28260 Apr  2 10:37 perf.data
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf inject -v -b -i perf.data -o perf.data.new
       File perf.data not owned by current user or root (use -f to override)
       # perf inject -v -b -i perf.data -o perf.data.new -f
         Error: unknown switch `f'
      
        usage: perf inject [<options>]
      
           -b, --build-ids       Inject build-ids into the output stream
           -i, --input <file>    input file name
           -o, --output <file>   output file name
           -s, --sched-stat      Merge sched-stat and sched-switch for getting
           events where and how long tasks slept
           -v, --verbose         be more verbose (show build ids, etc)
               --kallsyms <file>
                                 kallsyms pathname
      
      As shown above, the -f option does not work at all.
      
      After this patch:
      
       # perf inject -v -b -i perf.data -o perf.data.new
       File perf.data not owned by current user or root (use -f to override)
       # perf inject -v -b -i perf.data -o perf.data.new -f
       build id event received for [kernel.kallsyms]:
       f6dcb66d8b98f1c0d9eb87bf043444b69f91d30c
       symsrc__init: cannot get elf header.
       Looking at the vmlinux_path (7 entries long)
       Using /proc/kcore for kernel object code
       Using /proc/kallsyms for symbols
      
      As shown above, the -f option really works now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-3-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ccaa474c
    • Y
      perf evlist: Support using -f to override perf.data file ownership · 9e3b6ec1
      Yunlong Song 提交于
      Enable perf evlist to use perf.data when it is not owned by current user
      or root.
      
      Example:
      
       # perf record ls
       # chown Yunlong.Song:Yunlong.Song perf.data
       # ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 28260 Apr  2 10:18 perf.data
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf evlist
       File perf.data not owned by current user or root (use -f to override)
       # perf evlist -f
         Error: unknown switch `f'
      
        usage: perf evlist [<options>]
      
           -i, --input <file>    Input file name
           -F, --freq            Show the sample frequency
           -v, --verbose         Show all event attr details
           -g, --group           Show event group information
      
      As shown above, the -f option does not work at all.
      
      After this patch:
      
       # perf evlist
       File perf.data not owned by current user or root (use -f to override)
       # perf evlist -f
       cycles
      
      As shown above, the -f option really works now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-2-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9e3b6ec1
    • M
      perf probe: Fix to track down unnamed union/structure members · c7273835
      Masami Hiramatsu 提交于
      Fix 'perf probe' to track down unnamed union/structure members.
      
      perf probe did not track down the tree of unnamed union/structure
      members, since it just failed to find given "name" in a parent
      structure/union.  To solve this issue, I've introduced 2 changes.
      
      - Fix die_find_member() to track down the type-DIE if it is
        unnamed, and if it contains the specified member, returns the
        unnamed member.
        (note that we don't return found member, since unnamed member
         has the offset in the parent structure)
      - Fix convert_variable_fields() to track down the unnamed union/
        structure (one-by-one).
      
      With this patch, perf probe can access unnamed fields:
        -----
        #./perf probe -nfx ./perf lock__delete ops 'locked_ops=ops->locked.ops'
        Added new event:
          probe_perf:lock__delete (on lock__delete in /home/mhiramat/ksrc/linux-3/tools/perf/perf with ops locked_ops=ops->locked.ops)
      
        You can now use it in all perf tools, such as:
      
                perf record -e probe_perf:lock__delete -aR sleep 1
        -----
      Reported-by: NArnaldo Carvalho de Melo <acme@kernel.org>
      Report-Link: https://lkml.org/lkml/2015/3/5/431Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.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/20150402073312.14482.37942.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c7273835
    • A
      perf db-export: No need to have ->thread twice in struct export_sample · b83e868d
      Arnaldo Carvalho de Melo 提交于
      As it comes from address_location->thread, that is already stored as
      export_sample->al, where the thread can be obtained.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/20150402141542.GA9630@kernel.org
      Link: http://lkml.kernel.org/n/tip-bzotbl4epoztw0jd6sm2stpf@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b83e868d
    • A
      perf db-export: No need to pass thread twice to db_export__sample · 7327259d
      Arnaldo Carvalho de Melo 提交于
      As it is available via another parameter, address_location->thread.
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: lkml.kernel.org/r/551D08F8.3040706@intel.com
      Link: http://lkml.kernel.org/n/tip-6dbn0tcm9hyv92g7h3zj2dbt@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7327259d
    • A
      perf scripting: No need to pass thread twice to the scripting callbacks · f9d5d549
      Arnaldo Carvalho de Melo 提交于
      It is already in the addr_location, so remove the redundant 'thread'
      parameter from the callback signatures.
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1427906210-10519-3-git-send-email-acme@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f9d5d549
    • A
      perf script: No need to lookup thread twice · 79628f2c
      Arnaldo Carvalho de Melo 提交于
      We get the thread when we call perf_event__preprocess_sample(), no need
      to do it before that.
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1427906210-10519-2-git-send-email-acme@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      79628f2c
  3. 02 4月, 2015 17 次提交