Skip to content
  1. Sep 03, 2013
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · 61bf86ad
      Ingo Molnar authored
      
      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:
      
       * 'perf trace' arg formatting improvements to allow masking arguments
         in syscalls such as futex and open, where the some arguments are
         ignored and thus should not be printed depending on other args.
      
       * Beautify futex open, openat, open_by_handle_at, lseek and futex syscalls.
      
       * Add dummy software event to use when wanting just to keep receiving
         PERF_RECORD_{MMAP,COMM,etc}, add test for it, from Adrian Hunter.
      
       * Fix symbol offset computation for some dsos in 'perf script', from David Ahern.
      
       * Skip unsupported hardware events in 'perf list', from Namhyung Kim.
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      61bf86ad
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Tell arg formatters the arg index · 31cd3855
      Arnaldo Carvalho de Melo authored
      
      
      ... so that it can mask args relative to its position, like the 'mode' arg
      that may or not be printed according to the 'flags' (O_CREAT) value.
      
       [root@zoo ~]# perf trace -a -e openat,open_by_handle_at | head -1
          469.754 ( 0.034 ms): 1183 openat(dfd: -100, filename: 0x7fbde40014b0, flags: CLOEXEC|DIRECTORY|NONBLOCK) = 23
       [root@zoo ~]#
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-bgokqpkufd4sio7ixxknf1ux@git.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      31cd3855
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Add beautifier for open's flags arg · be65a89a
      Arnaldo Carvalho de Melo authored
      
      
      Suppressing the mode when O_CREAT not present, needs improvements on the
      arg masking mechanism to be reused in openat, open_by_handle_at,
      mq_open:
      
      [root@zoo ~]# perf trace -a -e open | grep -v 'flags: RDONLY' | head -5
         147.541 ( 0.028 ms): 1188 open(filename: 0x33c17782fb, flags: CLOEXEC   ) = 23
         229.898 ( 0.020 ms): 2071 open(filename: 0x3d93c80, flags: NOATIME      ) = -1 EPERM Operation not permitted
      
      [root@zoo ~]# perf trace -a -e open | grep CREAT
        1406.697 ( 0.024 ms): 616 open(filename: 0x7fffc3a0f910, flags: CREAT|TRUNC|WRONLY, mode: 438 ) = -1 ENOENT No such file or directory
        2032.770 ( 0.804 ms): 4354 open(filename: 0x7f33ac814368, flags: CREAT|EXCL|RDWR, mode: 384   ) = 115
      ^C[root@zoo ~]#
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-c7vm6klaf995qw1vqdih5t7q@git.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      be65a89a
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Add beautifier for lseek's whence arg · 579e7865
      Arnaldo Carvalho de Melo authored
      
      
       [root@zoo ~]# perf trace -a -e lseek | head -1
          546.922 ( 0.004 ms): 1184 lseek(fd: 26, offset: 0, whence: CUR) = 2
       [root@zoo ~]#
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-2eiuhwz9jbnhj80q6jaqeji4@git.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      579e7865
    • David Ahern's avatar
      perf tools: Fix symbol offset computation for some dsos · 0b8c25d9
      David Ahern authored
      
      
      For some dsos (e.g., libc, libpthread, kernel modules) the symbol offset
      is huge. e.g.,
      
      qemu-kvm 17238/17242 [007] 762235.640311:
          ffffffff816288a1 __schedule+0x451 ([kernel.kallsyms])
          ffffffff81629609 schedule+0x29 ([kernel.kallsyms])
          ffffffffa00a6ded kvm_vcpu_block+0xffffffffa00a106d (/lib/modules/3.11.0-rc1+/kernel/arch/x86/kvm/kvm.ko)
          ffffffffa00bae6b kvm_arch_vcpu_ioctl_run+0xffffffffa00a118b (/lib/modules/3.11.0-rc1+/kernel/arch/x86/kvm/kvm.ko)
          ffffffffa00a4d7a kvm_vcpu_ioctl+0xffffffffa00a141a (/lib/modules/3.11.0-rc1+/kernel/arch/x86/kvm/kvm.ko)
          ffffffff811a7bdb do_vfs_ioctl+0x8b ([kernel.kallsyms])
          ffffffff811a80c1 sys_ioctl+0x91 ([kernel.kallsyms])
          ffffffff81633182 system_call+0x72 ([kernel.kallsyms])
              7f882a97af27 __GI___ioctl+0x7f882a891007 (/lib64/libc-2.14.90.so)
                 100000002 [unknown] ([unknown])
      
      It seems to be maps with a non-0 start. Taking that into account the
      offsets are correct:
      
      qemu-kvm 17238/17242 [007] 762235.640311:
          ffffffff816288a1 __schedule+0x451 ([kernel.kallsyms])
          ffffffff81629609 schedule+0x29 ([kernel.kallsyms])
          ffffffffa00a6ded kvm_vcpu_block+0x6d (/lib/modules/3.11.0-rc1+/kernel/arch/x86/kvm/kvm.ko)
          ffffffffa00bae6b kvm_arch_vcpu_ioctl_run+0x18b (/lib/modules/3.11.0-rc1+/kernel/arch/x86/kvm/kvm.ko)
          ffffffffa00a4d7a kvm_vcpu_ioctl+0x41a (/lib/modules/3.11.0-rc1+/kernel/arch/x86/kvm/kvm.ko)
          ffffffff811a7bdb do_vfs_ioctl+0x8b ([kernel.kallsyms])
          ffffffff811a80c1 sys_ioctl+0x91 ([kernel.kallsyms])
          ffffffff81633182 system_call+0x72 ([kernel.kallsyms])
              7f882a97af27 __GI___ioctl+0x7 (/lib64/libc-2.14.90.so)
                 100000002 [unknown] ([unknown])
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Link: http://lkml.kernel.org/r/1375026512-45826-1-git-send-email-dsahern@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0b8c25d9
    • Namhyung Kim's avatar
      perf list: Skip unsupported events · b41f1cec
      Namhyung Kim authored
      
      
      Some hardware events might not be supported on a system.  Listing those
      events seems meaningless and confusing to users.  Let's skip them.
      
      Before:
        $ perf list cache | wc -l
        33
      
      After:
        $ perf list cache | wc -l
        27
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377571313-14722-1-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b41f1cec
    • Adrian Hunter's avatar
      perf tests: Add 'keep tracking' test · 395c3070
      Adrian Hunter authored
      
      
      Add a test for the newly added PERF_COUNT_SW_DUMMY event.  The test
      checks that tracking events continue when an event is disabled but a
      dummy software event is not disabled.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Tested-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377975053-3811-4-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      395c3070
    • Adrian Hunter's avatar
      perf tools: Add support for PERF_COUNT_SW_DUMMY · d22d1a2a
      Adrian Hunter authored
      
      
      Add support for the new dummy software event PERF_COUNT_SW_DUMMY.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Tested-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377975053-3811-3-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d22d1a2a
    • Adrian Hunter's avatar
      perf: Add a dummy software event to keep tracking · fa0097ee
      Adrian Hunter authored
      
      
      When an event is disabled the "tracking" events selected by the 'mmap',
      'comm' and 'task' bits of struct perf_event_attr, are also disabled.
      However, the information those events provide is necessary to resolve
      symbols for when the main event is re-enabled.
      
      The "tracking" events can be kept enabled by putting them on another
      event, but that requires an event that otherwise does nothing.  A new
      software event PERF_COUNT_SW_DUMMY is added for that purpose.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377975053-3811-2-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fa0097ee
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Add beautifier for futex 'operation' parm · f9da0b0c
      Arnaldo Carvalho de Melo authored
      
      
      That uses the arg mask mechanism just introduced to suppress ignored
      arguments according to the futex operation.
      
      Based on an initial patch from David Ahern that showed the need for some
      way to allow args to tell how many further args should be shown.
      
      Initial-patch-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-0k30it46r4hv5eanefbdmj5t@git.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f9da0b0c
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Allow syscall arg formatters to mask args · 6e7eeb51
      Arnaldo Carvalho de Melo authored
      
      
      The futex syscall ignores some arguments according to the 'operation'
      arg, so allow arg formatters to mask those.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-abqrg3oldgfsdnltfrvso9f7@git.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6e7eeb51
  2. Sep 02, 2013
  3. Aug 31, 2013
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · ea79ca0d
      Ingo Molnar authored
      
      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:
      
       * Tidy up sample parsing validation, from Adrian Hunter.
      
       * Make events stream always parsable by adding a new sample_type bit:
         PERF_SAMPLE_IDENTIFIER, that when requested will be always aat a fixed
         position in all PERF_RECORD_ records, from Adrian Hunter.
      
       * Add a sample parsing test, from Adrian Hunter.
      
       * Add option to 'perf trace' to analyze events in a file versus live,
         so that one can do:
      
         [root@zoo ~]# perf record -a -e raw_syscalls:* sleep 1
         [ perf record: Woken up 0 times to write data ]
         [ perf record: Captured and wrote 25.150 MB perf.data (~1098836 samples) ]
         [root@zoo ~]# perf trace -i perf.data -e futex --duration 1
            17.799 ( 1.020 ms): 7127 futex(uaddr: 0x7fff3f6c6674, op: 393, val: 1, utime: 0x7fff3f6c6470, ua
           113.344 (95.429 ms): 7127 futex(uaddr: 0x7fff3f6c6674, op: 393, val: 1, utime: 0x7fff3f6c6470, uaddr2: 0x7fff3f6c6648, val3: 4294967
           133.778 ( 1.042 ms): 18004 futex(uaddr: 0x7fff3f6c6674, op: 393, val: 1, utime: 0x7fff3f6c6470, uaddr2: 0x7fff3f6c6648, val3: 429496
         [root@zoo ~]#
      
         From David Ahern.
      
       * Honor target pid / tid options in 'perf trace' when analyzing a file,
         from David Ahern.
      
       * Handle missing HUGEPAGE defines in the mmap beautifier in 'perf trace',
         from David Ahern.
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ea79ca0d
    • David Ahern's avatar
      perf trace: Handle missing HUGEPAGE defines · f2935f3e
      David Ahern authored
      
      
      Needed for compile on Fedora 12 which goes back to the 2.6.32 kernel.
      Might be needed for RHEL6. I use F12 to compile static binaries for
      Wind River Linux 4.3.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Link: http://lkml.kernel.org/n/tip-nd0d7rbajgm8k6tah3xv34v1@git.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f2935f3e
  4. Aug 30, 2013
    • David Ahern's avatar
      perf trace: Honor target pid / tid options when analyzing a file · bdc89661
      David Ahern authored
      
      
      Allows capture of raw_syscall events for all processes or threads in a
      task and then analyzing specific ones.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377750593-48046-4-git-send-email-dsahern@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bdc89661
    • David Ahern's avatar
      perf trace: Add option to analyze events in a file versus live · 6810fc91
      David Ahern authored
      
      
      Allows capture of raw_syscall:* events and analyzed at a later time.
      
      v2: change -i option from inherit to input name for consistency with
          other perf commands
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377750593-48046-3-git-send-email-dsahern@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6810fc91
    • David Ahern's avatar
      perf evlist: Add tracepoint lookup by name · a2f2804a
      David Ahern authored
      
      
      Will be used by upcoming perf-trace replay option.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377750593-48046-2-git-send-email-dsahern@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a2f2804a
    • Adrian Hunter's avatar
      perf tests: Add a sample parsing test · 045f8cd8
      Adrian Hunter authored
      
      
      Add a test that checks that sample parsing is correctly implemented.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-12-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      045f8cd8
    • Adrian Hunter's avatar
      perf tools: Add a function to calculate sample event size · b1cf6f65
      Adrian Hunter authored
      
      
      Add perf_event__sample_event_size() which can be used when synthesizing
      sample events to determine how big the resulting event will be, and
      therefore how much memory to allocate.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-11-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b1cf6f65
    • Adrian Hunter's avatar
      perf tools: Expand perf_event__synthesize_sample() · d03f2170
      Adrian Hunter authored
      
      
      Expand perf_event__synthesize_sample() to handle all sample format bits.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-10-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d03f2170
    • Adrian Hunter's avatar
      perf tools: Add missing 'abi' member to 'struct regs_dump' · 5b95a4a3
      Adrian Hunter authored
      
      
      And store the parsed value there.  Note that the 'abi' is 0 (no
      registers), 1 (32-bit registers) or 2 (64-bit registers), but the
      registers are anyway copied one-by-one as 64-bit values onto the event
      i.e. see 'perf_output_sample_regs()'
      
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-9-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5b95a4a3
    • Adrian Hunter's avatar
      perf tools: Add support for PERF_SAMPLE_IDENTIFIER · 75562573
      Adrian Hunter authored
      
      
      Enable parsing of samples with sample format bit PERF_SAMPLE_IDENTIFIER.
      In addition, if the kernel supports it, prefer it to selecting
      PERF_SAMPLE_ID thereby allowing non-matching sample types.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-8-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      75562573
    • Adrian Hunter's avatar
      perf evlist: Move perf_evlist__config() to a new source file · faf96706
      Adrian Hunter authored
      
      
      perf_evlist__config() must be moved to a separate source file to avoid
      Python link errors when adding support for PERF_SAMPLE_IDENTIFIER.
      
      It is appropriate to do this because perf_evlist__config() is a helper
      function for event recording.  It is used by tools to apply recording
      options to perf_evlist.  It is not used by the Python API.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-7-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      faf96706
    • Adrian Hunter's avatar
      perf: make events stream always parsable · ff3d527c
      Adrian Hunter authored
      
      
      The event stream is not always parsable because the format of a sample
      is dependent on the sample_type of the selected event.  When there is
      more than one selected event and the sample_types are not the same then
      parsing becomes problematic.  A sample can be matched to its selected
      event using the ID that is allocated when the event is opened.
      Unfortunately, to get the ID from the sample means first parsing it.
      
      This patch adds a new sample format bit PERF_SAMPLE_IDENTIFER that puts
      the ID at a fixed position so that the ID can be retrieved without
      parsing the sample.  For sample events, that is the first position
      immediately after the header.  For non-sample events, that is the last
      position.
      
      In this respect parsing samples requires that the sample_type and ID
      values are recorded.  For example, perf tools records struct
      perf_event_attr and the IDs within the perf.data file.  Those must be
      read first before it is possible to parse samples found later in the
      perf.data file.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarStephane Eranian <eranian@google.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-6-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ff3d527c
    • Adrian Hunter's avatar
      perf tools: Remove references to struct ip_event · ef89325f
      Adrian Hunter authored
      
      
      The ip_event struct assumes fixed positions for ip, pid and tid.  That
      is no longer true with the addition of PERF_SAMPLE_IDENTIFIER.  The
      information is anyway in struct sample, so use that instead.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-5-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ef89325f
    • Adrian Hunter's avatar
      perf callchain: Remove unnecessary validation · 07940293
      Adrian Hunter authored
      
      
      Now that the sample parsing correctly checks data sizes there is no
      reason for it to be done again for callchains.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-4-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      07940293
    • Adrian Hunter's avatar
      perf evsel: Tidy up sample parsing overflow checking · 03b6ea9b
      Adrian Hunter authored
      
      
      The size of data retrieved from a sample event must be validated to
      ensure it does not go past the end of the event.  That was being done
      sporadically and without considering integer overflows.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-3-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      03b6ea9b
  5. Aug 29, 2013
    • Adrian Hunter's avatar
      perf tools: change machine__findnew_thread() to set thread pid · 314add6b
      Adrian Hunter authored
      
      
      Add a new parameter for 'pid' to machine__findnew_thread().
      Change callers to pass 'pid' when it is known.
      
      Note that callers sometimes want to find the main thread
      which has the memory maps.  The main thread has tid == pid
      so the usage in that case is:
      
      	machine__findnew_thread(machine, pid, pid)
      
      whereas the usage to find the specific thread is:
      
      	machine__findnew_thread(machine, pid, tid)
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1377591794-30553-2-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      314add6b
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · 00e4cb1c
      Ingo Molnar authored
      
      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:
      
       * Don't install scripting files files when perl/python support is disabled.
      
       * Support ! in -e expressions in 'perf trace', to filter a list of syscalls.
      
       * Add --verbose and -o/--output options to 'perf trace'.
      
       * Introduce better formatting of syscall arguments in 'perf trace',
         including so far beautifiers for mmap, madvise, syscall return
         values.
      
       * Fixup jobserver setup in libtraceevent makefile.
      
       * Debug improvements from Adrian Hunter.
      
       * Try to increase the file descriptor limits on EMFILE, from Andi Kleen.
      
       * Remove unused force option in 'perf kvm', from David Ahern.
      
       * Make 'perf trace' command line arguments consistent with 'perf record',
         from David Ahern.
      
       * Fix correlation of samples coming after PERF_RECORD_EXIT event, from
         David Ahern.
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      00e4cb1c
    • Ingo Molnar's avatar
      Merge branch 'linus' into perf/core · aee2bce3
      Ingo Molnar authored
      
      
      Pick up the latest upstream fixes.
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      aee2bce3
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew Morton) · c95389b4
      Linus Torvalds authored
      Merge fixes from Andrew Morton:
       "Five fixes.
      
        err, make that six.  let me try again"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        fs/ocfs2/super.c: Use bigger nodestr to accomodate 32-bit node numbers
        memcg: check that kmem_cache has memcg_params before accessing it
        drivers/base/memory.c: fix show_mem_removable() to handle missing sections
        IPC: bugfix for msgrcv with msgtyp < 0
        Omnikey Cardman 4000: pull in ioctl.h in user header
        timer_list: correct the iterator for timer_list
      c95389b4
    • Goldwyn Rodrigues's avatar
      fs/ocfs2/super.c: Use bigger nodestr to accomodate 32-bit node numbers · 49fa8140
      Goldwyn Rodrigues authored
      
      
      While using pacemaker/corosync, the node numbers are generated using IP
      address as opposed to serial node number generation.  This may not fit
      in a 8-byte string.  Use a bigger string to print the complete node
      number.
      
      Signed-off-by: default avatarGoldwyn Rodrigues <rgoldwyn@suse.com>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      49fa8140
    • Andrey Vagin's avatar
      memcg: check that kmem_cache has memcg_params before accessing it · 6f6b8951
      Andrey Vagin authored
      
      
      If the system had a few memory groups and all of them were destroyed,
      memcg_limited_groups_array_size has non-zero value, but all new caches
      are created without memcg_params, because memcg_kmem_enabled() returns
      false.
      
      We try to enumirate child caches in a few places and all of them are
      potentially dangerous.
      
      For example my kernel is compiled with CONFIG_SLAB and it crashed when I
      tryed to mount a NFS share after a few experiments with kmemcg.
      
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
        IP: [<ffffffff8118166a>] do_tune_cpucache+0x8a/0xd0
        PGD b942a067 PUD b999f067 PMD 0
        Oops: 0000 [#1] SMP
        Modules linked in: fscache(+) ip6table_filter ip6_tables iptable_filter ip_tables i2c_piix4 pcspkr virtio_net virtio_balloon i2c_core floppy
        CPU: 0 PID: 357 Comm: modprobe Not tainted 3.11.0-rc7+ #59
        Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
        task: ffff8800b9f98240 ti: ffff8800ba32e000 task.ti: ffff8800ba32e000
        RIP: 0010:[<ffffffff8118166a>]  [<ffffffff8118166a>] do_tune_cpucache+0x8a/0xd0
        RSP: 0018:ffff8800ba32fb70  EFLAGS: 00010246
        RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
        RDX: 0000000000000000 RSI: ffff8800b9f98910 RDI: 0000000000000246
        RBP: ffff8800ba32fba0 R08: 0000000000000002 R09: 0000000000000004
        R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000010
        R13: 0000000000000008 R14: 00000000000000d0 R15: ffff8800375d0200
        FS:  00007f55f1378740(0000) GS:ffff8800bfa00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
        CR2: 00007f24feba57a0 CR3: 0000000037b51000 CR4: 00000000000006f0
        Call Trace:
          enable_cpucache+0x49/0x100
          setup_cpu_cache+0x215/0x280
          __kmem_cache_create+0x2fa/0x450
          kmem_cache_create_memcg+0x214/0x350
          kmem_cache_create+0x2b/0x30
          fscache_init+0x19b/0x230 [fscache]
          do_one_initcall+0xfa/0x1b0
          load_module+0x1c41/0x26d0
          SyS_finit_module+0x86/0xb0
          system_call_fastpath+0x16/0x1b
      
      Signed-off-by: default avatarAndrey Vagin <avagin@openvz.org>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Glauber Costa <glommer@openvz.org>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6f6b8951
    • Russ Anderson's avatar
      drivers/base/memory.c: fix show_mem_removable() to handle missing sections · 21ea9f5a
      Russ Anderson authored
      
      
      "cat /sys/devices/system/memory/memory*/removable" crashed the system.
      
      The problem is that show_mem_removable() is passing a
      bad pfn to is_mem_section_removable(), which causes
      
          if (!node_online(page_to_nid(page)))
      
      to blow up.  Why is it passing in a bad pfn?
      
      The reason is that show_mem_removable() will loop sections_per_block
      times.  sections_per_block is 16, but mem->section_count is 8,
      indicating holes in this memory block.  Checking that the memory section
      is present before checking to see if the memory section is removable
      fixes the problem.
      
         harp5-sys:~ # cat /sys/devices/system/memory/memory*/removable
         0
         1
         1
         1
         1
         1
         1
         1
         1
         1
         1
         1
         1
         1
         BUG: unable to handle kernel paging request at ffffea00c3200000
         IP: [<ffffffff81117ed1>] is_pageblock_removable_nolock+0x1/0x90
         PGD 83ffd4067 PUD 37bdfce067 PMD 0
         Oops: 0000 [#1] SMP
         Modules linked in: autofs4 binfmt_misc rdma_ucm rdma_cm iw_cm ib_addr ib_srp scsi_transport_srp scsi_tgt ib_ipoib ib_cm ib_uverbs ib_umad iw_cxgb3 cxgb3 mdio mlx4_en mlx4_ib ib_sa mlx4_core ib_mthca ib_mad ib_core fuse nls_iso8859_1 nls_cp437 vfat fat joydev loop hid_generic usbhid hid hwperf(O) numatools(O) dm_mod iTCO_wdt ipv6 iTCO_vendor_support igb i2c_i801 ioatdma i2c_algo_bit ehci_pci pcspkr lpc_ich i2c_core ehci_hcd ptp sg mfd_core dca rtc_cmos pps_core mperf button xhci_hcd sd_mod crc_t10dif usbcore usb_common scsi_dh_emc scsi_dh_hp_sw scsi_dh_alua scsi_dh_rdac scsi_dh gru(O) xvma(O) xfs crc32c libcrc32c thermal sata_nv processor piix mptsas mptscsih scsi_transport_sas mptbase megaraid_sas fan thermal_sys hwmon ext3 jbd ata_piix ahci libahci libata scsi_mod
         CPU: 4 PID: 5991 Comm: cat Tainted: G           O 3.11.0-rc5-rja-uv+ #10
         Hardware name: SGI UV2000/ROMLEY, BIOS SGI UV 2000/3000 series BIOS 01/15/2013
         task: ffff88081f034580 ti: ffff880820022000 task.ti: ffff880820022000
         RIP: 0010:[<ffffffff81117ed1>]  [<ffffffff81117ed1>] is_pageblock_removable_nolock+0x1/0x90
         RSP: 0018:ffff880820023df8  EFLAGS: 00010287
         RAX: 0000000000040000 RBX: ffffea00c3200000 RCX: 0000000000000004
         RDX: ffffea00c30b0000 RSI: 00000000001c0000 RDI: ffffea00c3200000
         RBP: ffff880820023e38 R08: 0000000000000000 R09: 0000000000000001
         R10: 0000000000000000 R11: 0000000000000001 R12: ffffea00c33c0000
         R13: 0000160000000000 R14: 6db6db6db6db6db7 R15: 0000000000000001
         FS:  00007ffff7fb2700(0000) GS:ffff88083fc80000(0000) knlGS:0000000000000000
         CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
         CR2: ffffea00c3200000 CR3: 000000081b954000 CR4: 00000000000407e0
         Call Trace:
           show_mem_removable+0x41/0x70
           dev_attr_show+0x2a/0x60
           sysfs_read_file+0xf7/0x1c0
           vfs_read+0xc8/0x130
           SyS_read+0x5d/0xa0
           system_call_fastpath+0x16/0x1b
      
      Signed-off-by: default avatarRuss Anderson <rja@sgi.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Reviewed-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      21ea9f5a
    • Svenning Sørensen's avatar
      IPC: bugfix for msgrcv with msgtyp < 0 · 368ae537
      Svenning Sørensen authored
      According to 'man msgrcv': "If msgtyp is less than 0, the first message of
      the lowest type that is less than or equal to the absolute value of msgtyp
      shall be received."
      
      Bug: The kernel only returns a message if its type is 1; other messages
      with type < abs(msgtype) will never get returned.
      
      Fix: After having traversed the list to find the first message with the
      lowest type, we need to actually return that message.
      
      This regression was introduced by commit daaf74cf
      
       ("ipc: refactor
      msg list search into separate function")
      
      Signed-off-by: default avatarSvenning Soerensen <sss@secomea.dk>
      Reviewed-by: default avatarPeter Hurley <peter@hurleysoftware.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      368ae537
    • Mike Frysinger's avatar
      Omnikey Cardman 4000: pull in ioctl.h in user header · aaaafb7f
      Mike Frysinger authored
      
      
      This file uses the ioctl helpers (_IOR/_IOW/etc...), so include ioctl.h
      for the definitions.
      
      Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
      Cc: Harald Welte <laforge@gnumonks.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      aaaafb7f