mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 19:40:12 +07:00
93115d32e8
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 <tmricht@linux.ibm.com> Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com> Link: https://lkml.kernel.org/r/9c856ac0-ef23-72b5-901d-a1f815508976@linux.ibm.com Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Link: https://lkml.kernel.org/n/tip-s3jhif06et9ug78qhclw41z1@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
63 lines
2.0 KiB
C
63 lines
2.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Support for s390 CPU measurement counter set diagnostic facility
|
|
*
|
|
* Copyright IBM Corp. 2019
|
|
Author(s): Hendrik Brueckner <brueckner@linux.ibm.com>
|
|
* Thomas Richter <tmricht@linux.ibm.com>
|
|
*/
|
|
#ifndef S390_CPUMCF_KERNEL_H
|
|
#define S390_CPUMCF_KERNEL_H
|
|
|
|
#define S390_CPUMCF_DIAG_DEF 0xfeef /* Counter diagnostic entry ID */
|
|
#define PERF_EVENT_CPUM_CF_DIAG 0xBC000 /* Event: Counter sets */
|
|
|
|
struct cf_ctrset_entry { /* CPU-M CF counter set entry (8 byte) */
|
|
unsigned int def:16; /* 0-15 Data Entry Format */
|
|
unsigned int set:16; /* 16-23 Counter set identifier */
|
|
unsigned int ctr:16; /* 24-39 Number of stored counters */
|
|
unsigned int res1:16; /* 40-63 Reserved */
|
|
};
|
|
|
|
struct cf_trailer_entry { /* CPU-M CF trailer for raw traces (64 byte) */
|
|
/* 0 - 7 */
|
|
union {
|
|
struct {
|
|
unsigned int clock_base:1; /* TOD clock base */
|
|
unsigned int speed:1; /* CPU speed */
|
|
/* Measurement alerts */
|
|
unsigned int mtda:1; /* Loss of MT ctr. data alert */
|
|
unsigned int caca:1; /* Counter auth. change alert */
|
|
unsigned int lcda:1; /* Loss of counter data alert */
|
|
};
|
|
unsigned long flags; /* 0-63 All indicators */
|
|
};
|
|
/* 8 - 15 */
|
|
unsigned int cfvn:16; /* 64-79 Ctr First Version */
|
|
unsigned int csvn:16; /* 80-95 Ctr Second Version */
|
|
unsigned int cpu_speed:32; /* 96-127 CPU speed */
|
|
/* 16 - 23 */
|
|
unsigned long timestamp; /* 128-191 Timestamp (TOD) */
|
|
/* 24 - 55 */
|
|
union {
|
|
struct {
|
|
unsigned long progusage1;
|
|
unsigned long progusage2;
|
|
unsigned long progusage3;
|
|
unsigned long tod_base;
|
|
};
|
|
unsigned long progusage[4];
|
|
};
|
|
/* 56 - 63 */
|
|
unsigned int mach_type:16; /* Machine type */
|
|
unsigned int res1:16; /* Reserved */
|
|
unsigned int res2:32; /* Reserved */
|
|
};
|
|
|
|
#define CPUMF_CTR_SET_BASIC 0 /* Basic Counter Set */
|
|
#define CPUMF_CTR_SET_USER 1 /* Problem-State Counter Set */
|
|
#define CPUMF_CTR_SET_CRYPTO 2 /* Crypto-Activity Counter Set */
|
|
#define CPUMF_CTR_SET_EXT 3 /* Extended Counter Set */
|
|
#define CPUMF_CTR_SET_MT_DIAG 4 /* MT-diagnostic Counter Set */
|
|
#endif
|