1. 23 1月, 2011 6 次提交
    • T
      perf tools: Fix time function double declaration with glibc · 00e99a49
      Thomas Renninger 提交于
      It's enough to include the local "debug.h" file to trigger it.
      
      man time reveals this is already declared in glibc:
      
      time - get time in seconds
      -> rename the variable.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: arjan@infradead.org
      LPU-Reference: <1295620209-13859-2-git-send-email-trenn@suse.de>
      Signed-off-by: NThomas Renninger <trenn@suse.de>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      00e99a49
    • A
      perf tools: Fix build by checking if extra warnings are supported · 065bef5a
      Arnaldo Carvalho de Melo 提交于
      The -Wstack-protector and -Wvolatile-register-var warnings, for
      instance, are not supported by gcc 3.4.6.
      
      So fix by doing the same check we already do for -fstack-protector-all.
      
      With this and the other patches in this series, perf builds unmodified
      on, for instance, RHEL4.
      
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      065bef5a
    • A
      perf tools: Fix build when using gcc 3.4.6 · 5c7a6682
      Arnaldo Carvalho de Melo 提交于
      [acme@localhost linux]$ make O=~acme/git/build/perf -C tools/perf
      make: Entering directory `/home/acme/git/linux/tools/perf'
      Makefile:526: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
      Makefile:582: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
          CC /home/acme/git/build/perf/builtin-annotate.o
      In file included from builtin-annotate.c:23:
      util/parse-events.h:26: warning: declaration of 'evsel_list' shadows a global declaration
      util/parse-events.h:12: warning: shadowed declaration is here
      make: *** [/home/acme/git/build/perf/builtin-annotate.o] Error 1
      make: Leaving directory `/home/acme/git/linux/tools/perf'
      [acme@localhost linux]$ gcc --version | head -1
      gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-11)
      [acme@localhost linux]$
      
      Fix it by renaming the parameter to evlist.
      
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5c7a6682
    • A
      perf tools: Add missing header, fixes build · a860a608
      Arnaldo Carvalho de Melo 提交于
      We need the definiton for __always_inline in bitops.h to fix the build
      on distros where it isn't available or compiler.h doesn't get included
      indirectly.
      
      One of the fixes needed to build perf on RHEL4 systems, for instance.
      
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a860a608
    • A
      perf tools: Fix 64 bit integer format strings · 9486aa38
      Arnaldo Carvalho de Melo 提交于
      Using %L[uxd] has issues in some architectures, like on ppc64.  Fix it
      by making our 64 bit integers typedefs of stdint.h types and using
      PRI[ux]64 like, for instance, git does.
      
      Reported by Denis Kirjanov that provided a patch for one case, I went
      and changed all cases.
      Reported-by: NDenis Kirjanov <dkirjanov@kernel.org>
      Tested-by: NDenis Kirjanov <dkirjanov@kernel.org>
      LKML-Reference: <20110120093246.GA8031@hera.kernel.org>
      Cc: Denis Kirjanov <dkirjanov@kernel.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Pingtian Han <phan@redhat.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9486aa38
    • A
      perf test: Fix build on older glibcs · 57b84e53
      Arnaldo Carvalho de Melo 提交于
      Where we don't have CPU_ALLOC & friends. As the tools are being used in older
      distros where the only allowed change are to replace the kernel, like RHEL4 and
      5.
      Reported-by: NEric Dumazet <eric.dumazet@gmail.com>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      57b84e53
  2. 22 1月, 2011 2 次提交
    • H
      perf test: Use cpu_map->[cpu] when setting affinity · ffb5e0fb
      Han Pingtian 提交于
      When some of CPUs are offline:
      
       # cat /sys/devices/system/cpu/online
       0,6-31
      
      perf test will fail on #3 testcase:
      
         3: detect open syscall event on all cpus:
         --- start ---
         perf_evsel__read_on_cpu: expected to intercept 111 calls on cpu 0, got 681
         perf_evsel__read_on_cpu: expected to intercept 112 calls on cpu 1, got 117
         perf_evsel__read_on_cpu: expected to intercept 113 calls on cpu 2, got 118
         perf_evsel__read_on_cpu: expected to intercept 114 calls on cpu 3, got 119
         perf_evsel__read_on_cpu: expected to intercept 115 calls on cpu 4, got 120
         perf_evsel__read_on_cpu: expected to intercept 116 calls on cpu 5, got 121
         perf_evsel__read_on_cpu: expected to intercept 117 calls on cpu 6, got 122
         perf_evsel__read_on_cpu: expected to intercept 118 calls on cpu 7, got 123
         perf_evsel__read_on_cpu: expected to intercept 119 calls on cpu 8, got 124
         perf_evsel__read_on_cpu: expected to intercept 120 calls on cpu 9, got 125
         perf_evsel__read_on_cpu: expected to intercept 121 calls on cpu 10, got 126
         ....
      
      This patch try to use 'cpus->map[cpu]' when setting cpu affinity, and
      will check the return code of sched_setaffinity()
      
      LKML-Reference: <20110120114707.GA11781@hpt.nay.redhat.com>
      Signed-off-by: NHan Pingtian <phan@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ffb5e0fb
    • D
      perf symbols: Fix annotation of thumb code · b2f8fb23
      Dr. David Alan Gilbert 提交于
      In ARM's Thumb mode the bottom bit of the symbol address is set to mark
      the function as Thumb; the instructions are in reality 2 or 4 byte on 2
      byte alignments, and when the +1 address is used in annotate it causes
      objdump to disassemble invalid instructions.
      
      The patch removes that bottom bit during symbol loading.
      
      Many thinks to Dave Martin for comments on an initial version of the
      patch.
      
      (For reference this corresponds to this bug
      https://bugs.launchpad.net/linux-linaro/+bug/677547 )
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Dave Martin <dave.martin@linaro.org>
      LKML-Reference: <20110121163922.GA31398@davesworkthinkpad>
      Signed-off-by: NDr. David Alan Gilbert <david.gilbert@linaro.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b2f8fb23
  3. 18 1月, 2011 2 次提交
    • A
      perf tools: Fix tracepoint id to string perf.data header table · ad7f4e3f
      Arnaldo Carvalho de Melo 提交于
      It was broken by f006d25a that passed just the event name, not the complete
      sys:event that it expected to open the /sys/.../sys/sys:event/id file to get
      the id.
      
      Fix it by moving it to after parse_events in cmd_record, as at that point
      we can just traverse the evsel_list and use evsel->attr.config +
      event_name(evsel) instead of re-opening the /id file.
      Reported-by: NFranck Bui-Huu <vagabon.xyz@gmail.com>
      Cc: Franck Bui-Huu <vagabon.xyz@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Han Pingtian <phan@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <20110117202801.GG2085@ghostprotocols.net>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ad7f4e3f
    • A
      perf tools: Fix handling of wildcards in tracepoint event selectors · dd9a9ad5
      Arnaldo Carvalho de Melo 提交于
      It wasn't accounting the ':' when consuming bytes in the the event
      selector string, so parse_events() would fail in this test:
      
                      if (!(*str == 0 || *str == ',' || isspace(*str)))
                              return -1;
      
      as *str would be pointing to '*', the last character in the '-e' arg in:
      
      $ perf record -q -a -D -e sched:sched_* | perf script -i - -s perf-script.py
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dd9a9ad5
  4. 13 1月, 2011 2 次提交
    • K
      perf record: Add "nodelay" mode, disabled by default · acac03fa
      Kirill Smelkov 提交于
      Sometimes there is a need to use perf in "live-log" mode. The problem
      is, for seldom events, actual info output is largely delayed because
      perf-record reads sample data in whole pages.
      
      So for such scenarious, add flag for perf-record to go in "nodelay"
      mode. To track e.g. what's going on in icmp_rcv while ping is running
      Use it with something like this:
      
      (1) $ perf probe -L icmp_rcv | grep -U8 '^ *43\>'
                                          goto error;
                          }
               38         if (!pskb_pull(skb, sizeof(*icmph)))
                                  goto error;
                          icmph = icmp_hdr(skb);
      
               43         ICMPMSGIN_INC_STATS_BH(net, icmph->type);
                          /*
                           *      18 is the highest 'known' ICMP type. Anything else is a mystery
                           *
                           *      RFC 1122: 3.2.2  Unknown ICMP messages types MUST be silently
                           *                discarded.
                           */
               50         if (icmph->type > NR_ICMP_TYPES)
                                  goto error;
      
          $ perf probe icmp_rcv:43 'type=icmph->type'
      
      (2) $ cat trace-icmp.py
          [...]
          def trace_begin():
                  print "in trace_begin"
      
          def trace_end():
                  print "in trace_end"
      
          def probe__icmp_rcv(event_name, context, common_cpu,
                  common_secs, common_nsecs, common_pid, common_comm,
                  __probe_ip, type):
                          print_header(event_name, common_cpu, common_secs, common_nsecs,
                                  common_pid, common_comm)
      
                          print "__probe_ip=%u, type=%u\n" % \
                          (__probe_ip, type),
          [...]
      
      (3) $ perf record -a -D -e probe:icmp_rcv -o - | \
            perf script -i - -s trace-icmp.py
      
      Thanks to Peter Zijlstra for pointing how to do it.
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>, Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <20110112140613.GA11698@tugrik.mns.mnsspb.ru>
      Signed-off-by: NKirill Smelkov <kirr@mns.spb.ru>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      acac03fa
    • S
      perf sched: Fix list of events, dropping unsupported ':r' modifier · 9710118b
      Stephane Eranian 提交于
      Looks to me like the :r modifier is not supported anymore, so remove it from
      the list of events.
      
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <robert.richter@amd.com>
      LKML-Reference: <AANLkTim=jawJyBj0iFd0r4-LCKzvjFW+NddzJMD5GUB9@mail.gmail.com>
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9710118b
  5. 12 1月, 2011 4 次提交
    • L
      tools: create power/x86/x86_energy_perf_policy · d5532ee7
      Len Brown 提交于
      MSR_IA32_ENERGY_PERF_BIAS first became available on Westmere Xeon.
      It is implemented in all Sandy Bridge processors -- mobile, desktop and server.
      It is expected to become increasingly important in subsequent generations.
      
      x86_energy_perf_policy is a user-space utility to set the
      hardware energy vs performance policy hint in the processor.
      Most systems would benefit from "x86_energy_perf_policy normal"
      at system startup, as the hardware default is maximum performance
      at the expense of energy efficiency.
      
      See x86_energy_perf_policy.8 man page for more information.
      
      Background:
      
      Linux-2.6.36 added "epb" to /proc/cpuinfo to indicate
      if an x86 processor supports MSR_IA32_ENERGY_PERF_BIAS,
      without actually modifying the MSR.
      
      In March, 2010, Venkatesh Pallipadi proposed a small driver
      that programmed MSR_IA32_ENERGY_PERF_BIAS, based on
      the cpufreq governor in use.  It also offered
      a boot-time cmdline option to override.
      http://lkml.org/lkml/2010/3/4/457
      But hiding the hardware policy behind the
      governor choice was deemed "kinda icky".
      
      In June, 2010, I proposed a generic user/kernel API to
      generalize the power/performance policy trade-off.
      "RFC: /sys/power/policy_preference"
      http://lkml.org/lkml/2010/6/16/399
      That is my preference for implementing this capability,
      but I received no support on the list.
      
      So in September, 2010, I sent x86_energy_perf_policy.c to LKML,
      a user-space utility that scribbles directly to the MSR.
      http://lkml.org/lkml/2010/9/28/246
      
      Here is that same utility, after responding to some review feedback,
      to live in tools/power/, where it is easily found.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      d5532ee7
    • L
      tools: create power/x86/turbostat · 103a8fea
      Len Brown 提交于
      turbostat is a Linux tool to observe proper operation
      of Intel(R) Turbo Boost Technology.
      
      turbostat displays the actual processor frequency
      on x86 processors that include APERF and MPERF MSRs.
      
      Note that turbostat is of limited utility on Linux
      kernels 2.6.29 and older, as acpi_cpufreq cleared
      APERF/MPERF up through that release.
      
      On Intel Core i3/i5/i7 (Nehalem) and newer processors,
      turbostat also displays residency in idle power saving states,
      which are necessary for diagnosing any cpuidle issues
      that may have an effect on turbo-mode.
      
      See the turbostat.8 man page for example usage.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      103a8fea
    • A
      Revert "perf tools: Emit clearer message for sys_perf_event_open ENOENT return" · 4ad9f594
      Arnaldo Carvalho de Melo 提交于
      This reverts commit aa7bc7ef.
      
      It removed the fallback from hardware profiling to software profiling.
      .e.g., in a VM with no PMU.
      Reported-by: NDavid Ahern <daahern@cisco.com>
      Cc: David Ahern <daahern@cisco.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4ad9f594
    • A
      perf top: Fix annotate segv · cc841580
      Arnaldo Carvalho de Melo 提交于
      Before we had sym_counter, it was initialized to zero and we used that
      as an index in the global attrs variable, now we have a list of evsel
      entries, and sym_counter became sym_evsel, that remained initialized to
      zero (NULL): b00m.
      
      Fix it by initializing it to the first entry in the evsel list.
      
      Bug-introduced: 69aad6f1Reported-by: NKirill Smelkov <kirr@mns.spb.ru>
      Tested-by: NKirill Smelkov <kirr@mns.spb.ru>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Kirill Smelkov <kirr@mns.spb.ru>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cc841580
  6. 11 1月, 2011 4 次提交
    • A
      perf evsel: Fix order of event list deletion · bd3bfe9e
      Arnaldo Carvalho de Melo 提交于
      We need to defer calling perf_evsel_list__delete() till after atexit
      registered routines, because we need to traverse the events being
      recorded at that time at least on 'perf record'.
      
      This fixes the problem reported by Thomas Renninger where cmd_record
      called by cmd_timechart would not write the tracing data to the perf.data
      file header because the evsel_list at atexit (control+C on 'perf timechart
      record') time would be empty, being already deleted by run_builtin(),
      and thus 'perf timechart' when trying to process such perf.data file would
      die with:
      
      "no trace data in the file"
      
      Problem introduced in 70d544d0.
      Reported-by: NThomas Renninger <trenn@suse.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Renninger <trenn@suse.de>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bd3bfe9e
    • A
      perf session: Fix infinite loop in __perf_session__process_events · 3d03e2ea
      Arnaldo Carvalho de Melo 提交于
      In this if statement:
      
              if (head + event->header.size >= mmap_size) {
                      if (mmaps[map_idx]) {
                              munmap(mmaps[map_idx], mmap_size);
                              mmaps[map_idx] = NULL;
                      }
      
                      page_offset = page_size * (head / page_size);
                      file_offset += page_offset;
                      head -= page_offset;
                      goto remap;
              }
      
      With, for instance, these values:
      
      head=2992
      event->header.size=48
      mmap_size=3040
      
      We end up endlessly looping back to remap. Off by one.
      
      Problem introduced in 55b44629.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Reported-by: NIngo Molnar <mingo@elte.hu>
      Reported-by: NDavid Ahern <daahern@cisco.com>
      Bisected-by: NDavid Ahern <daahern@cisco.com>
      Tested-by: NDavid Ahern <daahern@cisco.com>
      Cc: David Ahern <daahern@cisco.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3d03e2ea
    • A
      perf evsel: Support perf_evsel__open(cpus > 1 && threads > 1) · 0252208e
      Arnaldo Carvalho de Melo 提交于
      And a test for it:
      
      [acme@felicio linux]$ perf test
       1: vmlinux symtab matches kallsyms: Ok
       2: detect open syscall event: Ok
       3: detect open syscall event on all cpus: Ok
      [acme@felicio linux]$
      
      Translating C the test does:
      
      1. generates different number of open syscalls on each CPU
         by using sched_setaffinity
      2. Verifies that the expected number of events is generated
         on each CPU
      
      It works as expected.
      
      LKML-Reference: <new-submission>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0252208e
    • J
      perf sched: Use PTHREAD_STACK_MIN to avoid pthread_attr_setstacksize() fail · 12f7e036
      Jiri Pirko 提交于
      on ppc64:
      /usr/include/bits/local_lim.h:#define PTHREAD_STACK_MIN	131072
      
      therefore following set of commands:
      
      gives:
      perf.2.6.37test: builtin-sched.c:493: create_tasks: Assertion `!(err)' failed.
      
      So make sure we do not set stack size lower than PTHREAD_STACK_MIN.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <20110110160417.GB2685@psychotron.brq.redhat.com>
      Signed-off-by: NJiri Pirko <jpirko@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      12f7e036
  7. 10 1月, 2011 3 次提交
    • A
      perf tools: Emit clearer message for sys_perf_event_open ENOENT return · aa7bc7ef
      Arnaldo Carvalho de Melo 提交于
      Improve sys_perf_event_open ENOENT return handling in top and record, just
      like 5a3446bc does for stat.
      
      Cc: David Ahern <daahern@cisco.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      aa7bc7ef
    • D
      perf stat: better error message for unsupported events · 5a3446bc
      David Ahern 提交于
      For unsupported events (e.g., H/W events when running in a VM)
      perf stat currently fails with the error message:
      
            Error: open_counter returned with 2 (No such file or directory).
          /bin/dmesg may provide additional information.
      
            Fatal: Not all events could be opened.
      
      dmesg is of no help and it is not clear as to why it fails to
      open the counter. This patch changes the error message to
      
            Error: cache-misses event is not supported.
            Fatal: Not all events could be opened.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: a.p.zijlstra@chello.nl
      LPU-Reference: <1294597272-17335-1-git-send-email-daahern@cisco.com>
      Signed-off-by: NDavid Ahern <daahern@cisco.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5a3446bc
    • A
      perf sched: Fix allocation result check · e462dc55
      Arnaldo Carvalho de Melo 提交于
      Bug introduced in ce47dc56.
      Reported-by: NMike Galbraith <efault@gmx.de>
      Cc: Chris Samuel <chris@csamuel.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e462dc55
  8. 07 1月, 2011 3 次提交
    • L
      perf tools: Pass whole attr to event selectors · 23a2f3ab
      Lin Ming 提交于
      Since commit 69aad6f1(perf tools: Introduce event selectors), only
      perf_event_attr::type and ::config are passed to event selector, which
      makes perf tool not work correctly.
      
      For example, PEBS does not work because perf_event_attr::precise_ip is
      not passed to the syscall.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <1294369869.20563.19.camel@minggr.sh.intel.com>
      Signed-off-by: NLin Ming <ming.m.lin@intel.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      23a2f3ab
    • F
      perf tools: Build with frame pointer · 6b01f2c4
      Frederic Weisbecker 提交于
      It seems that some gcc versions build by default with frame pointers
      and some others omit them.
      
      Just build the tools with frame pointers as the callchains can be an
      important part of the perf workflow.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <1294325513-14276-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6b01f2c4
    • H
      perf tools: Fix buffer overflow error when specifying all tracepoints · f006d25a
      Han Pingtian 提交于
      I found when specifying all tracepoints with -e to one of subcommand,
      such as 'stat', the program will trigger a buffer overflow error, like
      this:
      
      *** buffer overflow detected ***: ./perf terminated
      ======= Backtrace: =========
      /lib64/libc.so.6(__fortify_fail+0x37)[0x382cefb2c7]
      ....
      
      The tracepoints are separated by comma, something like this:
      
      $ perf stat -a -e `perf list |grep Tracepoint|awk -F'[' '{gsub(/[[:space:]]+/,"",$1);array[FNR]=$1}END{outputs=array[1];for (i=2;i<=FNR;i++){ outputs=outputs "," array[i];};print outputs}'`
      
      The root reason of this problem is that store_event_type() is called for all
      events, and will overflow the 'filename' at:
      
          strncat(filename, orgname, strlen(orgname));
      
      This patch fixes it by calling store_event_type() only when the event name has
      been found.
      
      LKML-Reference: <20110106093922.GB6713@hpt.nay.redhat.com>
      Signed-off-by: NHan Pingtian <phan@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f006d25a
  9. 06 1月, 2011 5 次提交
    • A
      perf script: Make some lists static · eccdfe2d
      Arnaldo Carvalho de Melo 提交于
      Not accessed outside builtin-script, so make them static.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      eccdfe2d
    • A
      perf script: Use the default lost event handler · 6d8afb56
      Arnaldo Carvalho de Melo 提交于
      That already does what was being done here. The warning is now unconditionally
      given by __perf_session__process_pipe_events, just like for non pipe processing.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6d8afb56
    • A
      perf session: Warn about errors when processing pipe events too · 11095994
      Arnaldo Carvalho de Melo 提交于
      Just like we do at __perf_session__process_events
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      11095994
    • S
      perf tools: Fix perf_event.h header usage · d030260a
      Stephane Eranian 提交于
      This patch fixes the usage of the perf_event.h header file
      between command modules and the supporting code in util.
      
      It is necessary to ensure that ALL files use the SAME
      perf_event.h header from the kernel source tree.
      
      There were a couple of #include <linux/perf_event.h> mixed
      with #include "../../perf_event.h".
      
      This caused issues on some distros because of mismatch
      in the layout of struct perf_event_attr. That eventually
      led perf stat to segfault.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@gmail.com>
      LKML-Reference: <4d233cf0.2308e30a.7b00.ffffc187@mx.google.com>
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d030260a
    • A
      perf test: Clarify some error reports in the open syscall test · 454a3bbe
      Arnaldo Carvalho de Melo 提交于
      Rebooted my devel machine, first thing I ran was perf test, that expects
      debugfs to be mounted, test fails. Be more clear about it.
      
      Also add missing newlines and add more informative message when
      sys_perf_event_open fails.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      454a3bbe
  10. 05 1月, 2011 1 次提交
  11. 04 1月, 2011 8 次提交
    • T
      perf timechart: Adjust perf timechart to the new power events · 20c457b8
      Thomas Renninger 提交于
      builtin-timechart must only pass -e power:xy events if they are supported by
      the running kernel, otherwise try to fetch the old power:power{start,end}
      events.
      
      For this I added the tiny helper function:
      
         int is_valid_tracepoint(const char *event_string)
      
      to parse-events.[hc], which could be more generic as an interface and support
      hardware/software/... events, not only tracepoints, but someone else could
      extend that if needed...
      Signed-off-by: NThomas Renninger <trenn@suse.de>
      Acked-by: NArjan van de Ven <arjan@linux.intel.com>
      Acked-by: NJean Pihet <j-pihet@ti.com>
      LKML-Reference: <1294073445-14812-4-git-send-email-trenn@suse.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      20c457b8
    • A
      perf test: Add test for counting open syscalls · d854861c
      Arnaldo Carvalho de Melo 提交于
      To test the use of the perf_evsel class on something other than
      the tools from where we refactored code to create it.
      
      It calls open() N times and then checks if the event created to
      monitor it returns N events.
      
      [acme@felicio linux]$ perf test
       1: vmlinux symtab matches kallsyms: Ok
       2: detect open syscall event: Ok
      [acme@felicio linux]$
      
      It does.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Han Pingtian <phan@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d854861c
    • A
      perf evsel: Auto allocate resources needed for some methods · 4eed11d5
      Arnaldo Carvalho de Melo 提交于
      While writing the first user of the routines created from the ad-hoc
      routines in the existing builtins I noticed that the resulting set of
      calls was too long, reduce it by doing some best effort allocations.
      
      Tools that need to operate on multiple threads and cpus should pre-allocate
      enough resources by explicitely calling the perf_evsel__alloc_{fd,counters}
      methods.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4eed11d5
    • A
      perf evsel: Use {cpu,thread}_map to shorten list of parameters · 86bd5e86
      Arnaldo Carvalho de Melo 提交于
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      86bd5e86
    • A
      perf tools: Refactor all_tids to hold nr and the map · 5c98d466
      Arnaldo Carvalho de Melo 提交于
      So that later, we can pass the thread_map instance instead of
      (thread_num, thread_map) for things like perf_evsel__open and friends,
      just like was done with cpu_map.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5c98d466
    • A
      perf tools: Refactor cpumap to hold nr and the map · 60d567e2
      Arnaldo Carvalho de Melo 提交于
      So that later, we can pass the cpu_map instance instead of (nr_cpus, cpu_map)
      for things like perf_evsel__open and friends.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      60d567e2
    • A
      perf evsel: Introduce per cpu and per thread open helpers · 48290609
      Arnaldo Carvalho de Melo 提交于
      Abstracting away the loops needed to create the various event fd handlers.
      
      The users have to pass a confiruged perf->evsel.attr field, which is already
      usable after perf_evsel__new (constructor) time, using defaults.
      
      Comes out of the ad-hoc routines in builtin-stat, that now uses it.
      
      Fixed a small silly bug where we were die()ing before killing our
      children, dysfunctional family this one 8-)
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      48290609
    • A
      perf evsel: Steal the counter reading routines from stat · c52b12ed
      Arnaldo Carvalho de Melo 提交于
      Making them hopefully generic enough to be used in 'perf test',
      well see.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c52b12ed