Skip to content

Commit 5aa9887

Browse files
Thomas Richterheicarst
authored andcommitted
s390/cpum_sf: prohibit callchain data collection
CPU Measurement sampling facility on s390 does not support perf tool collection of callchain data using --call-graph option. The sampling facility collects samples in a ring buffer which includes only the instruction address the samples were taken. When the ring buffer hits a watermark, a measurement alert interrupt is triggered and handled by the performance measurement unit (PMU) device driver. It collects the samples and feeds each sample to the perf ring buffer in the common code via functions perf_prepare_sample()/perf_output_sample(). When function perf_prepare_sample() is called to collect sample data's callchain, user register values or stack area, invalid data is picked, because the context of the collected information does not match the context when the sample was taken. There is currently no way to provide the callchain and other information, because the hardware sampler does not collect this information. Therefore prohibit sampling when the user requests a callchain graph from the hardware sampler. Return -EOPNOTSUPP to the user in this case. If call chains are really wanted, users need to specify software event cpu-clock to get the callchain information from a software event. Signed-off-by: Thomas Richter <[email protected]> Reviewed-by: Sumanth Korikkar <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 95e61b1 commit 5aa9887

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

arch/s390/kernel/perf_cpum_sf.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,12 +881,21 @@ static int __hw_perf_event_init(struct perf_event *event)
881881
return err;
882882
}
883883

884+
static bool is_callchain_event(struct perf_event *event)
885+
{
886+
u64 sample_type = event->attr.sample_type;
887+
888+
return sample_type & (PERF_SAMPLE_CALLCHAIN | PERF_SAMPLE_REGS_USER |
889+
PERF_SAMPLE_STACK_USER);
890+
}
891+
884892
static int cpumsf_pmu_event_init(struct perf_event *event)
885893
{
886894
int err;
887895

888896
/* No support for taken branch sampling */
889-
if (has_branch_stack(event))
897+
/* No support for callchain, stacks and registers */
898+
if (has_branch_stack(event) || is_callchain_event(event))
890899
return -EOPNOTSUPP;
891900

892901
switch (event->attr.type) {

0 commit comments

Comments
 (0)