22 Jan, 2019

2 commits

  • On s390 the CPU Measurement Facility diagnostic counter sets are
    displayed by counter number and value. Add the logical counter name in
    the output (if it is available). Otherwise "unknown" is shown.

    Output before:

    [root@s35lp76 perf]# ./perf report -D --stdio
    [00000000] Counterset:0 Counters:6
    Counter:000 Value:0x000000000085ec36 Counter:001 Value:0x0000000000796c94
    Counter:002 Value:0x0000000000005ada Counter:003 Value:0x0000000000092460
    Counter:004 Value:0x0000000000006073 Counter:005 Value:0x00000000001a9a73
    [0x000038] Counterset:1 Counters:2
    Counter:000 Value:0x000000000007c59f Counter:001 Value:0x000000000002fad6
    [0x000050] Counterset:2 Counters:16
    Counter:000 Value:000000000000000000 Counter:001 Value:000000000000000000

    Output after:

    [root@s35lp76 perf]# ./perf report -D --stdio

    [00000000] Counterset:0 Counters:6
    Counter:000 cpu_cycles Value:0x000000000085ec36
    Counter:001 instructions Value:0x0000000000796c94
    Counter:002 l1i_dir_writes Value:0x0000000000005ada
    Counter:003 l1i_penalty_cycles Value:0x0000000000092460
    Counter:004 l1d_dir_writes Value:0x0000000000006073
    Counter:005 l1d_penalty_cycles Value:0x00000000001a9a73
    [0x000038] Counterset:1 Counters:2
    Counter:000 problem_state_cpu_cycles Value:0x000000000007c59f
    Counter:001 problem_state_instructions Value:0x000000000002fad6
    [0x000050] Counterset:2 Counters:16
    Counter:000 prng_functions Value:000000000000000000

    Signed-off-by: Thomas Richter
    Reviewed-by: Hendrik Brueckner
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Link: http://lkml.kernel.org/r/20190117093003.96287-3-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Thomas Richter
     
  • On s390 the event bc000 (also named CF_DIAG) extracts the CPU
    Measurement Facility diagnostic counter sets and displays them as
    counter number and counter value pairs sorted by counter set number.

    Output:
    [root@s35lp76 perf]# ./perf report -D --stdio

    [00000000] Counterset:0 Counters:6
    Counter:000 Value:0x000000000085ec36 Counter:001 Value:0x0000000000796c94
    Counter:002 Value:0x0000000000005ada Counter:003 Value:0x0000000000092460
    Counter:004 Value:0x0000000000006073 Counter:005 Value:0x00000000001a9a73
    [0x000038] Counterset:1 Counters:2
    Counter:000 Value:0x000000000007c59f Counter:001 Value:0x000000000002fad6
    [0x000050] Counterset:2 Counters:16
    Counter:000 Value:000000000000000000 Counter:001 Value:000000000000000000
    Counter:002 Value:000000000000000000 Counter:003 Value:000000000000000000
    Counter:004 Value:000000000000000000 Counter:005 Value:000000000000000000
    Counter:006 Value:000000000000000000 Counter:007 Value:000000000000000000
    Counter:008 Value:000000000000000000 Counter:009 Value:000000000000000000
    Counter:010 Value:000000000000000000 Counter:011 Value:000000000000000000
    Counter:012 Value:000000000000000000 Counter:013 Value:000000000000000000
    Counter:014 Value:000000000000000000 Counter:015 Value:000000000000000000
    [0x0000d8] Counterset:3 Counters:128
    Counter:000 Value:0x000000000000020f Counter:001 Value:0x00000000000001d8
    Counter:002 Value:0x000000000000d7fa Counter:003 Value:0x000000000000008b
    ...

    The number in brackets is the offset into the raw data field of the
    sample.

    New functions trace_event_sample_raw__init() and s390_sample_raw() are
    introduced in the code path to enable interpretation on non s390
    platforms. This event bc000 attached raw data is generated only on s390
    platform. Correct display on other platforms requires correct endianness
    handling.

    Committer notes:

    Added a init function that sets up a evlist function pointer to avoid
    repeated tests on evlist->env and calls to perf_env__name() that
    involves normalizing, etc, for each PERF_RECORD_SAMPLE.

    Removed needless __maybe_unused from the trace_event_raw()
    prototype in session.h, move it to be an static function in evlist.

    The 'offset' variable is a size_t, not an u64, fix it to avoid this on
    some arches:

    CC /tmp/build/perf/util/s390-sample-raw.o
    util/s390-sample-raw.c: In function 's390_cpumcfdg_testctr':
    util/s390-sample-raw.c:77:4: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'size_t' [-Werror=format=]
    pr_err("Invalid counter set entry at %#" PRIx64 "\n",
    ^
    cc1: all warnings being treated as errors

    Signed-off-by: Thomas Richter
    Reviewed-by: Hendrik Brueckner
    Link: https://lkml.kernel.org/r/9c856ac0-ef23-72b5-901d-a1f815508976@linux.ibm.com
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Link: https://lkml.kernel.org/n/tip-s3jhif06et9ug78qhclw41z1@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Thomas Richter