1. 24 10月, 2012 1 次提交
    • J
      perf/x86: Make hardware event translations available in sysfs · a4747393
      Jiri Olsa 提交于
      Add support to display hardware events translations available
      through the sysfs. Add 'events' group attribute under the sysfs
      x86 PMU record with attribute/file for each hardware event.
      
      This patch adds only backbone for PMUs to display config under
      'events' directory. The specific PMU support itself will come
      in next patches, however this is how the sysfs group will look
      like:
      
        # ls  /sys/devices/cpu/events/
        branch-instructions
        branch-misses
        bus-cycles
        cache-misses
        cache-references
        cpu-cycles
        instructions
        ref-cycles
        stalled-cycles-backend
        stalled-cycles-frontend
      
      The file - hw event ID mapping is:
      
        file                      hw event ID
        ---------------------------------------------------------------
        cpu-cycles                PERF_COUNT_HW_CPU_CYCLES
        instructions              PERF_COUNT_HW_INSTRUCTIONS
        cache-references          PERF_COUNT_HW_CACHE_REFERENCES
        cache-misses              PERF_COUNT_HW_CACHE_MISSES
        branch-instructions       PERF_COUNT_HW_BRANCH_INSTRUCTIONS
        branch-misses             PERF_COUNT_HW_BRANCH_MISSES
        bus-cycles                PERF_COUNT_HW_BUS_CYCLES
        stalled-cycles-frontend   PERF_COUNT_HW_STALLED_CYCLES_FRONTEND
        stalled-cycles-backend    PERF_COUNT_HW_STALLED_CYCLES_BACKEND
        ref-cycles                PERF_COUNT_HW_REF_CPU_CYCLES
      
      Each file in the 'events' directory contains the term translation
      for the symbolic hw event for the currently running cpu model.
      
        # cat /sys/devices/cpu/events/stalled-cycles-backend
        event=0xb1,umask=0x01,inv,cmask=0x01
      Suggested-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1349873598-12583-2-git-send-email-jolsa@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      a4747393
  2. 04 10月, 2012 1 次提交
  3. 19 9月, 2012 1 次提交
  4. 31 7月, 2012 1 次提交
    • P
      perf/x86: Fix USER/KERNEL tagging of samples properly · d07bdfd3
      Peter Zijlstra 提交于
      Some PMUs don't provide a full register set for their sample,
      specifically 'advanced' PMUs like AMD IBS and Intel PEBS which provide
      'better' than regular interrupt accuracy.
      
      In this case we use the interrupt regs as basis and over-write some
      fields (typically IP) with different information.
      
      The perf core however uses user_mode() to distinguish user/kernel
      samples, user_mode() relies on regs->cs. If the interrupt skid pushed
      us over a boundary the new IP might not be in the same domain as the
      interrupt.
      
      Commit ce5c1fe9 ("perf/x86: Fix USER/KERNEL tagging of samples")
      tried to fix this by making the perf core use kernel_ip(). This
      however is wrong (TM), as pointed out by Linus, since it doesn't allow
      for VM86 and non-zero based segments in IA32 mode.
      
      Therefore, provide a new helper to set the regs->ip field,
      set_linear_ip(), which massages the regs into a suitable state
      assuming the provided IP is in fact a linear address.
      
      Also modify perf_instruction_pointer() and perf_callchain_user() to
      deal with segments base offsets.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1341910954.3462.102.camel@twinsSigned-off-by: NIngo Molnar <mingo@kernel.org>
      d07bdfd3
  5. 26 7月, 2012 1 次提交
  6. 06 7月, 2012 2 次提交
  7. 18 6月, 2012 1 次提交
  8. 06 6月, 2012 6 次提交
  9. 17 3月, 2012 1 次提交
  10. 13 3月, 2012 1 次提交
  11. 05 3月, 2012 5 次提交
  12. 02 3月, 2012 1 次提交
  13. 21 12月, 2011 1 次提交
  14. 07 12月, 2011 2 次提交
  15. 06 12月, 2011 1 次提交
    • R
      perf, x86: Fix event scheduler for constraints with overlapping counters · bc1738f6
      Robert Richter 提交于
      The current x86 event scheduler fails to resolve scheduling problems
      of certain combinations of events and constraints. This happens if the
      counter mask of such an event is not a subset of any other counter
      mask of a constraint with an equal or higher weight, e.g. constraints
      of the AMD family 15h pmu:
      
                              counter mask    weight
      
       amd_f15_PMC30          0x09            2  <--- overlapping counters
       amd_f15_PMC20          0x07            3
       amd_f15_PMC53          0x38            3
      
      The scheduler does not find then an existing solution. Here is an
      example:
      
       event code     counter         failure         possible solution
      
       0x02E          PMC[3,0]        0               3
       0x043          PMC[2:0]        1               0
       0x045          PMC[2:0]        2               1
       0x046          PMC[2:0]        FAIL            2
      
      The event scheduler may not select the correct counter in the first
      cycle because it needs to know which subsequent events will be
      scheduled. It may fail to schedule the events then.
      
      To solve this, we now save the scheduler state of events with
      overlapping counter counstraints.  If we fail to schedule the events
      we rollback to those states and try to use another free counter.
      
      Constraints with overlapping counters are marked with a new introduced
      overlap flag. We set the overlap flag for such constraints to give the
      scheduler a hint which events to select for counter rescheduling. The
      EVENT_CONSTRAINT_OVERLAP() macro can be used for this.
      
      Care must be taken as the rescheduling algorithm is O(n!) which will
      increase scheduling cycles for an over-commited system dramatically.
      The number of such EVENT_CONSTRAINT_OVERLAP() macros and its counter
      masks must be kept at a minimum. Thus, the current stack is limited to
      2 states to limit the number of loops the algorithm takes in the worst
      case.
      
      On systems with no overlapping-counter constraints, this
      implementation does not increase the loop count compared to the
      previous algorithm.
      
      V2:
      * Renamed redo -> overlap.
      * Reimplementation using perf scheduling helper functions.
      
      V3:
      * Added WARN_ON_ONCE() if out of save states.
      * Changed function interface of perf_sched_restore_state() to use bool
        as return value.
      Signed-off-by: NRobert Richter <robert.richter@amd.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1321616122-1533-3-git-send-email-robert.richter@amd.comSigned-off-by: NIngo Molnar <mingo@elte.hu>
      bc1738f6
  16. 10 10月, 2011 1 次提交
  17. 26 9月, 2011 1 次提交