perf report: Add s390 raw data interpretation for PAI counters
authorThomas Richter <tmricht@linux.ibm.com>
Fri, 10 Nov 2023 11:09:08 +0000 (12:09 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 15 Nov 2023 17:51:53 +0000 (12:51 -0500)
commitb539deafbadb2fc6ba79307a797196454b14f501
treec927e7b978e20bfb8a5a76b1d3332ae4f5e6578e
parentc06547d02094e7eb81389e9485a45d91cc21914c
perf report: Add s390 raw data interpretation for PAI counters

Commit 39d62336f5c126ad ("s390/pai: add support for cryptography
counters") added support for Processor Activity Instrumentation Facility
(PAI) counters.  These counters values are added as raw data with the
perf sample during 'perf record'.

Now add support to display these counters in the 'perf report' command.

The counter number, its assigned name and value is now printed in
addition to the hexadecimal output.

Output before:

  # perf report -D

  6 514766399626050 0x7b058 [0x48]: PERF_RECORD_SAMPLE(IP, 0x1):
  303977/303977: 0 period: 1 addr: 0
  ... thread: paitest:303977
  ...... dso: <not found>

  0x7b0a0@/root/perf.data.paicrypto [0x48]: event: 9
  .
  . ... raw event: size 72 bytes
  . 0000:  00 00 00 09 00 01 00 48 00 00 00 00 00 00 00 00  .......H........
  . 0010:  00 04 a3 69 00 04 a3 69 00 01 d4 2d 76 de a0 bb  ...i...i...-v...
  . 0020:  00 00 00 00 00 01 5c 53 00 00 00 06 00 00 00 00  ......\S........
  . 0030:  00 00 00 00 00 00 00 01 00 00 00 0c 00 07 00 00  ................
  . 0040:  00 00 00 53 96 af 00 00                          ...S....

Output after:

  # perf report -D

  6 514766399626050 0x7b058 [0x48]: PERF_RECORD_SAMPLE(IP, 0x1):
  303977/303977: 0 period: 1 addr: 0
  ... thread: paitest:303977
  ...... dso: <not found>

  0x7b0a0@/root/perf.data.paicrypto [0x48]: event: 9
  .
  . ... raw event: size 72 bytes
  . 0000:  00 00 00 09 00 01 00 48 00 00 00 00 00 00 00 00  .......H........
  . 0010:  00 04 a3 69 00 04 a3 69 00 01 d4 2d 76 de a0 bb  ...i...i...-v...
  . 0020:  00 00 00 00 00 01 5c 53 00 00 00 06 00 00 00 00  ......\S........
  . 0030:  00 00 00 00 00 00 00 01 00 00 00 0c 00 07 00 00  ................
  . 0040:  00 00 00 53 96 af 00 00                          ...S....

        Counter:007 km_aes_128 Value:0x00000000005396af     <--- new

Committer notes:

Had to add ignore pragmas for that __packed function:

  +#pragma GCC diagnostic ignored "-Wpacked"
  +#pragma GCC diagnostic ignored "-Wattributes"

Otherwise this doesn't build in things like debian experimentao cross
building to mips64, etc.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Tested-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: https://lore.kernel.org/r/20231110110908.2312308-1-tmricht@linux.ibm.com
[ Corrected non-existent commit referred to the right one: 39d62336f5c126ad ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/s390-cpumcf-kernel.h
tools/perf/util/s390-sample-raw.c