Skip to content
/ linux Public

Commit 84a17b7

Browse files
Thomas RichterSasha Levin
authored andcommitted
s390/perf: Disable register readout on sampling events
[ Upstream commit b2c04fc ] Running commands # ./perf record -IR0,R1 -a sleep 1 extracts and displays register value of general purpose register r1 and r0. However the value displayed of any register is random and does not reflect the register value recorded at the time of the sample interrupt. The sampling device driver on s390 creates a very large buffer for the hardware to store the samples. Only when that large buffer gets full an interrupt is generated and many hundreds of sample entries are processed and copied to the kernel ring buffer and eventually get copied to the perf tool. It is during the copy to the kernel ring buffer that each sample is processed (on s390) and at that time the register values are extracted. This is not the original goal, the register values should be read when the samples are created not when the samples are copied to the kernel ring buffer. Prevent this event from being installed in the first place and return -EOPNOTSUPP. This is already the case for PERF_SAMPLE_REGS_USER. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Reviewed-by: Jan Polensky <japo@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent bafd4aa commit 84a17b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/s390/kernel/perf_cpum_sf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ static bool is_callchain_event(struct perf_event *event)
925925
u64 sample_type = event->attr.sample_type;
926926

927927
return sample_type & (PERF_SAMPLE_CALLCHAIN | PERF_SAMPLE_REGS_USER |
928-
PERF_SAMPLE_STACK_USER);
928+
PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_STACK_USER);
929929
}
930930

931931
static int cpumsf_pmu_event_init(struct perf_event *event)

0 commit comments

Comments
 (0)