1. 10 Mar, 2016 6 commits
    • Sukadev Bhattiprolu's avatar
      powerpc/perf/24x7: Eliminate domain suffix in event names · 8f69dc70
      Sukadev Bhattiprolu authored
      The Physical Core events of the 24x7 PMU can be monitored across various
      domains (physical core, vcpu home core, vcpu home node etc). For each of
      these core events, we currently create multiple events in sysfs, one for
      each domain the event can be monitored in. These events are distinguished
      by their suffixes like __PHYS_CORE, __VCPU_HOME_CORE etc.
      
      Rather than creating multiple such entries, we could let the user specify
      make 'domain' index a required parameter and let the user specify a value
      for it (like they currently specify the core index).
      
      	$ cat /sys/bus/event_source/devices/hv_24x7/events/HPM_CCYC
      	domain=?,offset=0x98,core=?,lpar=0x0
      
      	$ perf stat -C 0 -e hv_24x7/HPM_CCYC,domain=2,core=1/ true
      
      (the 'domain=?' and 'core=?' in sysfs tell perf tool to enforce them as
      required parameters).
      
      This simplifies the interface and allows users to identify events by the
      name specified in the catalog (User can determine the domain index by
      referring to '/sys/bus/event_source/devices/hv_24x7/interface/domains').
      
      Eliminating the event suffix eliminates several functions and simplifies
      code.
      
      Note that Physical Chip events can only be monitored in the chip domain
      so those events have the domain set to 1 (rather than =?) and users don't
      need to specify the domain index for the Chip events.
      
      	$ cat /sys/bus/event_source/devices/hv_24x7/events/PM_XLINK_CYCLES
      	domain=1,offset=0x230,chip=?,lpar=0x0
      
      	$ perf stat -C 0 -e hv_24x7/PM_XLINK_CYCLES,chip=1/ true
      Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      8f69dc70
    • Sukadev Bhattiprolu's avatar
      powerpc/perf/hv-24x7: Display domain indices in sysfs · d34171e8
      Sukadev Bhattiprolu authored
      To help users determine domains, display the domain indices used by the
      kernel in sysfs.
      
      	$ cat /sys/bus/event_source/devices/hv_24x7/interface/domains
      	1: Physical Chip
      	2: Physical Core
      	3: VCPU Home Core
      	4: VCPU Home Chip
      	5: VCPU Home Node
      	6: VCPU Remote Node
      Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      d34171e8
    • Sukadev Bhattiprolu's avatar
      powerpc/perf/hv-24x7: Display change in counter values · 2b206ee6
      Sukadev Bhattiprolu authored
      For 24x7 counters, perf displays the raw value of the 24x7 counter, which
      is a monotonically increasing value.
      
      	perf stat -C 0 -e \
      		'hv_24x7/HPM_0THRD_NON_IDLE_CCYC__PHYS_CORE,core=1/' \
      		sleep 1
      
       Performance counter stats for 'CPU(s) 0':
      
           9,105,403,170      hv_24x7/HPM_0THRD_NON_IDLE_CCYC__PHYS_CORE,core=1/
      
             0.000425751 seconds time elapsed
      
      In the typical usage of 'perf stat' this counter value is not as useful
      as the _change_ in the counter value over the duration of the application.
      
      Have h_24x7_event_init() set the event's prev_count to the raw value of
      the 24x7 counter at the time of initialization. When the application
      terminates, hv_24x7_event_read() will compute the change in value and
      report to the perf tool. Similarly, for the transaction interface, clear
      the event count to 0 at the beginning of the transaction.
      
      	perf stat -C 0 -e \
      		'hv_24x7/HPM_0THRD_NON_IDLE_CCYC__PHYS_CORE,core=1/' \
      		sleep 1
      
       Performance counter stats for 'CPU(s) 0':
      
                 245,758      hv_24x7/HPM_0THRD_NON_IDLE_CCYC__PHYS_CORE,core=1/
      
             1.006366383 seconds time elapsed
      Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      2b206ee6
    • Sukadev Bhattiprolu's avatar
      powerpc/perf/hv-24x7: Fix usage with chip events. · e5a5886d
      Sukadev Bhattiprolu authored
      24x7 counters can belong to different domains (core, chip, virtual CPU
      etc). For events in the 'chip' domain, sysfs entry currently looks like:
      
      	$ cd /sys/bus/event_source/devices/hv_24x7/events
      	$ cat PM_XLINK_CYCLES__PHYS_CHIP
      	domain=0x1,offset=0x230,core=?,lpar=0x0
      
      where the required parameter, 'core=?' is specified with perf as:
      
      	perf stat -C 0 -e hv_24x7/PM_XLINK_CYCLES__PHYS_CHIP,core=1/ \
      		/bin/true
      
      This is inconsistent in that 'core' is a required parameter for a chip
      event.  Instead, have the the sysfs entry display 'chip=?' for chip
      events:
      
      	$ cd /sys/bus/event_source/devices/hv_24x7/events
      	$ cat PM_XLINK_CYCLES__PHYS_CHIP
      	domain=0x1,offset=0x230,chip=?,lpar=0x0
      
      We also need to add a 'chip' entry in the sysfs format directory:
      
      	$ ls /sys/bus/event_source/devices/hv_24x7/format
      	chip  core  domain  lpar  offset  vcpu
      	^^^^
      	(new)
      
      so the perf tool can automatically check usage and format the chip
      parameter correctly:
      
      	$ perf stat -C 0 -v -e hv_24x7/PM_XLINK_CYCLES__PHYS_CHIP/ \
      		/bin/true
      	Required parameter 'chip' not specified
      	invalid or unsupported event: 'hv_24x7/PM_XLINK_CYCLES__PHYS_CHIP/'
      
      	$ perf stat -C 0 -v -e hv_24x7/PM_XLINK_CYCLES__PHYS_CHIP,chip=1/ \
      		/bin/true
      	hv_24x7/PM_XLINK_CYCLES__PHYS_CHIP,chip=1/: 0 6628908 6628908
      
      	 Performance counter stats for 'CPU(s) 0':
      
      	         0      hv_24x7/PM_XLINK_CYCLES__PHYS_CHIP,chip=1/
      
      	    0.006606970 seconds time elapsed
      Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      e5a5886d
    • Sukadev Bhattiprolu's avatar
      powerpc/perf: Export Power8 generic and cache events to sysfs · e0728b50
      Sukadev Bhattiprolu authored
      Power8 supports a large number of events in each susbystem so when a
      user runs:
      
      	perf stat -e branch-instructions sleep 1
      	perf stat -e L1-dcache-loads sleep 1
      
      it is not clear as to which PMU events were monitored.
      
      Export the generic hardware and cache perf events for Power8 to sysfs,
      so users can precisely determine the PMU event monitored by the generic
      event.
      
      Eg:
      	cat /sys/bus/event_source/devices/cpu/events/branch-instructions
      	event=0x10068
      
      	$ cat /sys/bus/event_source/devices/cpu/events/L1-dcache-loads
      	event=0x100ee
      Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      e0728b50
    • Sukadev Bhattiprolu's avatar
      powerpc/perf: Remove PME_ prefix for power7 events · d4969e24
      Sukadev Bhattiprolu authored
      We used the PME_ prefix earlier to avoid some macro/variable name
      collisions.  We have since changed the way we define/use the event
      macros so we no longer need the prefix.
      
      By dropping the prefix, we keep the the event macros consistent with
      their official names.
      Reported-by: default avatarMichael Ellerman <ellerman@au1.ibm.com>
      Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      d4969e24
  2. 09 Mar, 2016 22 commits
  3. 08 Mar, 2016 12 commits