All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/6] ARM: oprofile: use perf-events framework as backend
@ 2010-05-12  4:35 Deng-Cheng Zhu
  2010-05-12  9:32 ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Deng-Cheng Zhu @ 2010-05-12  4:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi, Will


This is a great idea.

Here's one comment on irq handling (Maybe you or somebody else has already
addressed in other threads - I'm new to this list):

In original Oprofile code, the irq handler mainly does 3 things - clearing
the flag, resetting the counter, and calling oprofile_add_sample(). By
using perf events as the backend of Oprofile, they are now scattered into
a relatively long code path in armpmu->handle_irq(). Could this be
something improvable?

In addition, the counterpart of resetting the counter in perf events is
the armpmu->write_counter() in armpmu_event_set_period(). How could you
make sure the value written into the counter is the same between the
original Oprofile and the "new" Oprofile?


Deng-Cheng


On 2010-04-19 16:42, Will Deacon wrote:
 > There are currently two hardware performance monitoring subsystems in the
 > kernel for ARM: OProfile and perf-events. This creates the following 
problems:
 >
 > 1.) Duplicate PMU accessor code. Inevitable code drift may lead to 
bugs in one
 > framework that are fixed in the other.
 >
 > 2.) Locking issues. OProfile doesn't reprogram hardware counters between
 > profiling runs if the events to be monitored have not been changed. 
This means
 > that other profiling frameworks cannot use the counters if OProfile 
is in use.
 >
 > 3.) Due to differences in the two frameworks, it may not be possible to
 > compare the results obtained by OProfile with those obtained by perf.
 >
 > This patch removes the OProfile PMU driver code and replaces it with 
calls
 > to perf, therefore solving the issues mentioned above.
 >

 > +/*
 > + * Overflow callback for oprofile.
 > + */
 > +static void op_overflow_handler(struct perf_event *event, int unused,
 > + struct perf_sample_data *data, struct pt_regs *regs)
 > +{
 > + int id;
 > + u32 cpu = smp_processor_id();
 > +
 > + for (id = 0; id < perf_num_counters; ++id)
 > + if (perf_events[cpu][id] == event)
 > + break;
 > +
 > + if (id != perf_num_counters)
 > + oprofile_add_sample(regs, id);
 > + else
 > + pr_warning("oprofile: ignoring spurious overflow "
 > + "on cpu %u\n", cpu);
 > +}

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH 0/6] ARM: oprofile: use perf-events framework as backend [v4]
@ 2010-04-19 16:42 Will Deacon
  2010-04-19 16:42 ` [PATCH 1/6] ARM: perf-events: use numeric ID to identify PMU Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2010-04-19 16:42 UTC (permalink / raw)
  To: linux-arm-kernel

This is version 4 [hopefully the final iteration!] of the patchset originally
posted here:

V1: http://lists.infradead.org/pipermail/linux-arm-kernel/2010-February/010476.html
V2: http://lists.infradead.org/pipermail/linux-arm-kernel/2010-March/011126.html
V3: http://lists.infradead.org/pipermail/linux-arm-kernel/2010-April/012871.html

The only change since V3 is that the previous changes to the generic
perf-events code have been moved into the ARM backend. This places the whole
patchset under arch/arm/.

I've not received any feedback for version 3, so unless I receive any objections
to this version, I'll submit it to the patch system this week.

Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Jamie Iles <jamie.iles@picochip.com>
Cc: Jean Pihet <jpihet@mvista.com>

Will Deacon (6):
  ARM: perf-events: use numeric ID to identify PMU
  ARM: perf-events: add support for xscale PMUs
  ARM: perf-events: allow modules to query the number of hardware
    counters
  ARM: oprofile: use perf-events framework as backend
  ARM: oprofile: remove old files and update KConfig
  ARM: oprofile: convert from sysdev to platform device

 arch/arm/Kconfig                        |   26 +-
 arch/arm/include/asm/perf_event.h       |   17 +
 arch/arm/kernel/perf_event.c            |  876 ++++++++++++++++++++++++++++++-
 arch/arm/oprofile/Makefile              |    7 +-
 arch/arm/oprofile/backtrace.c           |   83 ---
 arch/arm/oprofile/common.c              |  375 +++++++++++---
 arch/arm/oprofile/op_arm_model.h        |   35 --
 arch/arm/oprofile/op_counter.h          |   27 -
 arch/arm/oprofile/op_model_arm11_core.c |  162 ------
 arch/arm/oprofile/op_model_arm11_core.h |   45 --
 arch/arm/oprofile/op_model_mpcore.c     |  306 -----------
 arch/arm/oprofile/op_model_mpcore.h     |   61 ---
 arch/arm/oprofile/op_model_v6.c         |   78 ---
 arch/arm/oprofile/op_model_v7.c         |  415 ---------------
 arch/arm/oprofile/op_model_v7.h         |  103 ----
 arch/arm/oprofile/op_model_xscale.c     |  444 ----------------
 16 files changed, 1190 insertions(+), 1870 deletions(-)
 delete mode 100644 arch/arm/oprofile/backtrace.c
 delete mode 100644 arch/arm/oprofile/op_arm_model.h
 delete mode 100644 arch/arm/oprofile/op_counter.h
 delete mode 100644 arch/arm/oprofile/op_model_arm11_core.c
 delete mode 100644 arch/arm/oprofile/op_model_arm11_core.h
 delete mode 100644 arch/arm/oprofile/op_model_mpcore.c
 delete mode 100644 arch/arm/oprofile/op_model_mpcore.h
 delete mode 100644 arch/arm/oprofile/op_model_v6.c
 delete mode 100644 arch/arm/oprofile/op_model_v7.c
 delete mode 100644 arch/arm/oprofile/op_model_v7.h
 delete mode 100644 arch/arm/oprofile/op_model_xscale.c

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH 0/6] ARM: oprofile: use perf-events framework as backend [v3]
@ 2010-04-12 15:04 Will Deacon
  2010-04-12 15:04 ` [PATCH 1/6] ARM: perf-events: use numeric ID to identify PMU Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2010-04-12 15:04 UTC (permalink / raw)
  To: linux-arm-kernel

This is version 3 of the patchset originally posted here:

V1: http://lists.infradead.org/pipermail/linux-arm-kernel/2010-February/010476.html
V2: http://lists.infradead.org/pipermail/linux-arm-kernel/2010-March/011126.html

Changes since V2:
	- Rebased onto 2.6.34-rc3
	- No longer export perf_event_{enable,disable} functions as this
	  stopped working with 2.6.34-rc1. Instead create/destroy counters
	  between profiling runs. This also prevents OProfile from hogging
	  the PMU lock.
	- Merged in patch from Aaro Koskinen to use platform_device
	  instead of sys_device for OProfile suspend.
	- Fixed XScale PMU interrupt handlers to call perf_sample_data_init.

I've tested this on a quad-core Realview PB11MPCore board and compared the
OProfile results with perf-events. The only scope for confusion is that, by
default, OProfile organises samples by symbol name and so counts may appear
significantly less then those reported by perf stat [which combines the
per-symbol counts into a single overall count].

This patch is intended to be applied on top of 604{4-9}/1 in RMK's incoming
patch queue.

Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Jamie Iles <jamie.iles@picochip.com>
Cc: Jean Pihet <jpihet@mvista.com>

Will Deacon (6):
  ARM: perf-events: use numeric ID to identify PMU
  ARM: perf-events: add support for xscale PMUs
  perf-events: allow modules to query the maximum number of perf events
  ARM: oprofile: use perf-events framework as backend
  ARM: oprofile: remove old files and update KConfig
  ARM: oprofile: convert from sysdev to platform device

 arch/arm/Kconfig                        |   26 +-
 arch/arm/include/asm/perf_event.h       |   14 +
 arch/arm/kernel/perf_event.c            |  864 ++++++++++++++++++++++++++++++-
 arch/arm/oprofile/Makefile              |    7 +-
 arch/arm/oprofile/backtrace.c           |   83 ---
 arch/arm/oprofile/common.c              |  375 +++++++++++---
 arch/arm/oprofile/op_arm_model.h        |   35 --
 arch/arm/oprofile/op_counter.h          |   27 -
 arch/arm/oprofile/op_model_arm11_core.c |  162 ------
 arch/arm/oprofile/op_model_arm11_core.h |   45 --
 arch/arm/oprofile/op_model_mpcore.c     |  306 -----------
 arch/arm/oprofile/op_model_mpcore.h     |   61 ---
 arch/arm/oprofile/op_model_v6.c         |   78 ---
 arch/arm/oprofile/op_model_v7.c         |  415 ---------------
 arch/arm/oprofile/op_model_v7.h         |  103 ----
 arch/arm/oprofile/op_model_xscale.c     |  444 ----------------
 include/linux/perf_event.h              |    1 +
 kernel/perf_event.c                     |    6 +
 18 files changed, 1182 insertions(+), 1870 deletions(-)
 delete mode 100644 arch/arm/oprofile/backtrace.c
 delete mode 100644 arch/arm/oprofile/op_arm_model.h
 delete mode 100644 arch/arm/oprofile/op_counter.h
 delete mode 100644 arch/arm/oprofile/op_model_arm11_core.c
 delete mode 100644 arch/arm/oprofile/op_model_arm11_core.h
 delete mode 100644 arch/arm/oprofile/op_model_mpcore.c
 delete mode 100644 arch/arm/oprofile/op_model_mpcore.h
 delete mode 100644 arch/arm/oprofile/op_model_v6.c
 delete mode 100644 arch/arm/oprofile/op_model_v7.c
 delete mode 100644 arch/arm/oprofile/op_model_v7.h
 delete mode 100644 arch/arm/oprofile/op_model_xscale.c

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-12  9:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12  4:35 [PATCH 4/6] ARM: oprofile: use perf-events framework as backend Deng-Cheng Zhu
2010-05-12  9:32 ` Will Deacon
  -- strict thread matches above, loose matches on Subject: below --
2010-04-19 16:42 [PATCH 0/6] ARM: oprofile: use perf-events framework as backend [v4] Will Deacon
2010-04-19 16:42 ` [PATCH 1/6] ARM: perf-events: use numeric ID to identify PMU Will Deacon
2010-04-19 16:42   ` [PATCH 2/6] ARM: perf-events: add support for xscale PMUs Will Deacon
2010-04-19 16:42     ` [PATCH 3/6] ARM: perf-events: allow modules to query the number of hardware counters Will Deacon
2010-04-19 16:42       ` [PATCH 4/6] ARM: oprofile: use perf-events framework as backend Will Deacon
2010-04-12 15:04 [PATCH 0/6] ARM: oprofile: use perf-events framework as backend [v3] Will Deacon
2010-04-12 15:04 ` [PATCH 1/6] ARM: perf-events: use numeric ID to identify PMU Will Deacon
2010-04-12 15:04   ` [PATCH 2/6] ARM: perf-events: add support for xscale PMUs Will Deacon
2010-04-12 15:04     ` [PATCH 3/6] perf-events: allow modules to query the maximum number of perf events Will Deacon
2010-04-12 15:04       ` [PATCH 4/6] ARM: oprofile: use perf-events framework as backend Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.