• Thomas Richter's avatar
    s390/pai: Add support for PAI Extension 1 NNPA counters · c432fefe
    Thomas Richter authored
    PMU device driver perf_paiext supports Processor Activity
    Instrumentation Extension (PAIE1), available with IBM z16:
    - maps a 512 byte block to lowcore address 0x1508 called PAIE1 control
      block.
    - maps a 1024 byte block at PAIE1 control block entry with index 2.
    - uses control register bit 14 to enable PAIE1 control block lookup.
    - turn PAIE1 nnpa counting on and off by setting bit 63 in
      PAIE1 control block entry with index 2.
    - creates a sample with raw data on each context switch out when
      at context switch some mapped counters have a value of nonzero.
    This device driver only supports CPU wide context, no task context
    is allowed.
    
    Support for counting:
    - one or more counters can be specified using
      perf stat -e pai_ext/xxx/
      where xxx stands for the counter event name. Multiple invocation
      of this command is possible. The counter names are listed in
      /sys/devices/pai_ext/events directory.
    - one special counters can be specified using
      perf stat -e pai_ext/NNPA_ALL/
      which returns the sum of all incremented nnpa counters.
    - multiple counting events can run in parallel.
    
    Support for Sampling:
    - one event pai_ext/NNPA_ALL/ is reserved for sampling.
      The event collects data at context switch out and saves them in
      the ring buffer.
    - no multiple invocations are possible.
    
    The PAIE1 nnpa counter events are system wide. No task context is
    supported.  Therefore some restrictions documented in function
    paiext_busy() apply.
    
    Extend qpaci assembly instruction to query supported memory mapped nnpa
    counters. It returns the number of counters (no holes allowed in that
    range).
    
    PAIE1 nnpa counter events can not be created when a CPU hot plug
    add is processed. This means a CPU hot plug add does not get
    the necessary PAIE1 event to record PAIE1 nnpa counter increments
    on the newly added CPU. CPU hot plug remove removes the event and
    terminates the counting of PAIE1 counters immediately.
    Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
    Reviewed-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
    Reviewed-by: default avatarSven Schnelle <svens@linux.ibm.com>
    Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
    c432fefe
perf_pai_ext.c 18.6 KB