Messages in this thread Patch in this message | | | Date | Mon, 13 Jan 2014 23:42:13 -0500 (EST) | From | Vince Weaver <> | Subject | Re: [patch/rfc] perf on raspberry-pi without overflow interrupt |
| |
On Fri, 10 Jan 2014, Will Deacon wrote:
> In the absence of a core change, I think I'd rather have something like your > second patch, but without the extra no_overflow_irq field (you can check the > platform device, as I mentioned previously).
Something like the following? It works on my rasp-pi, still waiting for the compile to finish on the pandaboard so I haven't verified that the has-working-interrupt case still works.
---
Allow hardware perf_events to be enabled even if no overflow interrupt is available. Return EOPNOTSUPP if a sampling event is attempted and the interrupt is not available.
This is necessary for access to hardware perf_events on the Raspberry-Pi (bcm2835).
Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index bc3f2ef..e2c4aa2 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c @@ -397,7 +397,7 @@ __hw_perf_event_init(struct perf_event *event) */ hwc->config_base |= (unsigned long)mapping; - if (!hwc->sample_period) { + if (!is_sampling_event(event)) { /* * For non-sampling runs, limit the sample_period to half * of the counter width. That way, the new counter value @@ -407,6 +407,14 @@ __hw_perf_event_init(struct perf_event *event) hwc->sample_period = armpmu->max_period >> 1; hwc->last_period = hwc->sample_period; local64_set(&hwc->period_left, hwc->sample_period); + } else { + + /* + * If we have no PMU interrupt we cannot sample. + */ + if (platform_get_irq(armpmu->plat_device, 0) < 0) + return -EOPNOTSUPP; + } if (event->group_leader != event) { diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c index d85055c..7a84738 100644 --- a/arch/arm/kernel/perf_event_cpu.c +++ b/arch/arm/kernel/perf_event_cpu.c @@ -97,8 +97,8 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler) irqs = min(pmu_device->num_resources, num_possible_cpus()); if (irqs < 1) { - pr_err("no irqs for PMUs defined\n"); - return -ENODEV; + printk_once("no irqs for PMUs defined, sampled events not supported\n"); + return 0; } for (i = 0; i < irqs; ++i) {
| |