aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>2013-12-12 10:47:00 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-12-16 08:37:52 -0500
commit55baa2f831ae4a41da9617ab9e7cef5ebc991ec9 (patch)
tree700ba9a81a60e1c4eaff56f57d38fd818f6de6a8 /arch/s390
parent8c069ff4bd6063a3f15e606c882e03f75c7e7711 (diff)
s390/perf: Improve PMU selection for PERF_COUNT_HW_CPU_CYCLES events
The cpum_cf (counter facility) PMU does not support sampling events. With cpum_sf (sampling facility), a PMU for sampling CPU cycles is available. Make cpum_sf the "default" PMU for PERF_COUNT_HW_CPU_CYCLES sampling events but use the more precise cpum_cf PMU for non-sampling events. Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kernel/perf_cpum_sf.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index 141eca0917f4..52bf36ee91aa 100644
--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -468,11 +468,29 @@ static int cpumsf_pmu_event_init(struct perf_event *event)
468{ 468{
469 int err; 469 int err;
470 470
471 if (event->attr.type != PERF_TYPE_RAW) 471 /* No support for taken branch sampling */
472 return -ENOENT; 472 if (has_branch_stack(event))
473 473 return -EOPNOTSUPP;
474 if (event->attr.config != PERF_EVENT_CPUM_SF) 474
475 switch (event->attr.type) {
476 case PERF_TYPE_RAW:
477 if (event->attr.config != PERF_EVENT_CPUM_SF)
478 return -ENOENT;
479 break;
480 case PERF_TYPE_HARDWARE:
481 /* Support sampling of CPU cycles in addition to the
482 * counter facility. However, the counter facility
483 * is more precise and, hence, restrict this PMU to
484 * sampling events only.
485 */
486 if (event->attr.config != PERF_COUNT_HW_CPU_CYCLES)
487 return -ENOENT;
488 if (!is_sampling_event(event))
489 return -ENOENT;
490 break;
491 default:
475 return -ENOENT; 492 return -ENOENT;
493 }
476 494
477 if (event->cpu >= nr_cpumask_bits || 495 if (event->cpu >= nr_cpumask_bits ||
478 (event->cpu >= 0 && !cpu_online(event->cpu))) 496 (event->cpu >= 0 && !cpu_online(event->cpu)))