Skip to content

Commit 932bfc5

Browse files
Thomas RichterVasily Gorbik
authored andcommitted
s390/cpumsf: Check for CPU Measurement sampling
s390 IBM z15 introduces a check if the CPU Mesurement Facility sampling is temporarily unavailable. If this is the case return -EBUSY and abort the setup of CPU Measuement facility sampling. Signed-off-by: Thomas Richter <[email protected]> Reviewed-by: Christian Borntraeger <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 8513458 commit 932bfc5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

arch/s390/include/asm/cpu_mf.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ asm(".include \"asm/cpu_mf-insn.h\"\n");
2828
CPU_MF_INT_SF_PRA|CPU_MF_INT_SF_SACA| \
2929
CPU_MF_INT_SF_LSDA)
3030

31+
#define CPU_MF_SF_RIBM_NOTAV 0x1 /* Sampling unavailable */
32+
3133
/* CPU measurement facility support */
3234
static inline int cpum_cf_avail(void)
3335
{
@@ -69,7 +71,8 @@ struct hws_qsi_info_block { /* Bit(s) */
6971
unsigned long max_sampl_rate; /* 16-23: maximum sampling interval*/
7072
unsigned long tear; /* 24-31: TEAR contents */
7173
unsigned long dear; /* 32-39: DEAR contents */
72-
unsigned int rsvrd0; /* 40-43: reserved */
74+
unsigned int rsvrd0:24; /* 40-42: reserved */
75+
unsigned int ribm:8; /* 43: Reserved by IBM */
7376
unsigned int cpu_speed; /* 44-47: CPU speed */
7477
unsigned long long rsvrd1; /* 48-55: reserved */
7578
unsigned long long rsvrd2; /* 56-63: reserved */

arch/s390/kernel/perf_cpum_sf.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,12 @@ static int __hw_perf_event_init(struct perf_event *event)
803803
goto out;
804804
}
805805

806+
if (si.ribm & CPU_MF_SF_RIBM_NOTAV) {
807+
pr_warn("CPU Measurement Facility sampling is temporarily not available\n");
808+
err = -EBUSY;
809+
goto out;
810+
}
811+
806812
/* Always enable basic sampling */
807813
SAMPL_FLAGS(hwc) = PERF_CPUM_SF_BASIC_MODE;
808814

0 commit comments

Comments
 (0)