[RFC][PATCH 4/5] sh: Add support for sampling counters

From: Matt Fleming
Date: Mon Aug 30 2010 - 08:14:36 EST


SH performance counters cannot generate any form of interrupt and so
require hrtimer assistance for sampling counter values. Event groups
periodically sample counters when a hrtimer fires which allows the use
of sampling counters on SH.

Signed-off-by: Matt Fleming <matt@xxxxxxxxxxxxxxxxx>
---
arch/sh/kernel/perf_event.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 7a3dc35..1f77de6 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -114,7 +114,8 @@ static int __hw_perf_event_init(struct perf_event *event)
* no interrupts, and are therefore unable to do sampling without
* further work and timer assistance.
*/
- if (hwc->sample_period)
+ if (!(attr->read_format & PERF_FORMAT_GROUP) &&
+ hwc->sample_period && event->group_leader == event)
return -EINVAL;

/*
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/