On 05/27/2010 06:03 AM, Deng-Cheng Zhu wrote:
This patch is based on Will Deacon's work for ARM. The well-written
reasons and ideas can be found here:
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-April/013210.html
This effort makes the bug-fixes shared by different pmu users/clients
(for now, Oprofile& Perf-events), and make them coexist in the system
without lock issues, and make their results comparable.
So this patch moves Oprofile on top of Perf-events by replacing its
original interfaces with new ones calling Perf-events.
Oprofile uses raw events, so Perf-events (mipsxx in this patch) is
modified to support more mipsxx CPUs.
Signed-off-by: Deng-Cheng Zhu<dengcheng.zhu@gmail.com>
---
arch/mips/kernel/perf_event.c | 7 +-
arch/mips/kernel/perf_event_mipsxx.c | 125 ++++++++++++------
arch/mips/oprofile/common.c | 237 +++++++++++++++++++++++++---------
3 files changed, 266 insertions(+), 103 deletions(-)
[...]
static int __init
@@ -963,35 +960,77 @@ init_hw_perf_events(void)
switch (current_cpu_type()) {
case CPU_24K:
mipsxxcore_pmu.id = MIPS_PMU_ID_24K;
- mipsxxcore_pmu.num_counters = counters;
- mipspmu =&mipsxxcore_pmu;
+ mipsxxcore_pmu.general_event_map =&mipsxxcore_event_map;
+ mipsxxcore_pmu.cache_event_map =&mipsxxcore_cache_map;
break;
case CPU_34K:
mipsxxcore_pmu.id = MIPS_PMU_ID_34K;
- mipsxxcore_pmu.num_counters = counters;
- mipspmu =&mipsxxcore_pmu;
+ mipsxxcore_pmu.general_event_map =&mipsxxcore_event_map;
+ mipsxxcore_pmu.cache_event_map =&mipsxxcore_cache_map;
break;
The mips perf events system should already know what type of cpu it is
running on.
Can we have all this processor specific perf/counter stuff live in one
place and simplify all of this?
[...]
+/*
+ * Attributes are created as "pinned" events and so are permanently
+ * scheduled on the PMU.
+ */
+static void op_perf_setup(void)
+{
+ int i;
+ u32 size = sizeof(struct perf_event_attr);
+ struct perf_event_attr *attr;
+
+ for (i = 0; i< perf_num_counters; ++i) {
+ attr =&ctr[i].attr;
+ memset(attr, 0, size);
+ attr->type = PERF_TYPE_RAW;
+ attr->size = size;
+ attr->config = ctr[i].event + (i& 0x1 ? 128 : 0);
Too many magic numbers. Lets have symbolic names.
[...]
Thanks,
David Daney
|