Commit Graph

28 Commits

Author SHA1 Message Date
Will Deacon 4295b898f5 ARM: 7448/1: perf: remove arm_perf_pmu_ids global enumeration
In order to provide PMU name strings compatible with the OProfile
user ABI, an enumeration of all PMUs is currently used by perf to
identify each PMU uniquely. Unfortunately, this does not scale well
in the presence of multiple PMUs and creates a single, global namespace
across all PMUs in the system.

This patch removes the enumeration and instead uses the name string
for the PMU to map onto the OProfile variant. perf_pmu_name is
implemented for CPU PMUs, which is all that OProfile cares about anyway.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-09 17:41:10 +01:00
Vladimir Zapolskiy 55205c916e oprofile, arm/sh: Fix oprofile_arch_exit() linkage issue
This change fixes a linking problem, which happens if oprofile
is selected to be compiled as built-in:

  `oprofile_arch_exit' referenced in section `.init.text' of
  arch/arm/oprofile/built-in.o: defined in discarded section
  `.exit.text' of arch/arm/oprofile/built-in.o

The problem is appeared after commit 87121ca504, which
introduced oprofile_arch_exit() calls from __init function. Note
that the aforementioned commit has been backported to stable
branches, and the problem is known to be reproduced at least
with 3.0.13 and 3.1.5 kernels.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@nokia.com>
Signed-off-by: Robert Richter <robert.richter@amd.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: oprofile-list <oprofile-list@lists.sourceforge.net>
Cc: <stable@kernel.org>
Link: http://lkml.kernel.org/r/20111222151540.GB16765@erda.amd.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-12-23 11:58:34 +01:00
Linus Torvalds 1cecd791f2 Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: Fix text_poke_smp_batch() deadlock
  perf tools: Fix thread_map event synthesizing in top and record
  watchdog, nmi: Lower the severity of error messages
  ARM: oprofile: Fix backtraces in timer mode
  oprofile: Fix usage of CONFIG_HW_PERF_EVENTS for oprofile_perf_init and friends
2011-02-15 10:18:48 -08:00
Rabin Vincent cb06199b1d ARM: 6654/1: perf/oprofile: fix off-by-one in stack check
Since tail is the previous fp - 1, we need to compare the new fp with tail + 1
to ensure that we don't end up passing in the same tail again, in order to
avoid a potential infinite loop in the perf interrupt handler (which has been
observed to occur).  A similar fix seems to be needed in the OProfile code.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-02-10 15:29:03 +00:00
Ari Kauppi d14dd7e20d ARM: oprofile: Fix backtraces in timer mode
Always allow backtraces when using oprofile on ARM, even if a PMU
isn't present. Restores functionality originally introduced in commit
1b7b56982f ("oprofile: Always allow
backtraces on ARM") by Richard Purdie.

It is not that obvious, but there is now only one oprofile_arch_init()
function. So the .backtrace callback is available also in timer mode.

Implemented by removing code and using stubs for oprofile_perf_{init,
exit} provided by <linux/oprofile.h>. This allows cleaning of other
architecture specific implementations too.

Cc: stable@kernel.org # 37.x
Signed-off-by: Ari Kauppi <kauppi@papupata.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Robert Richter <robert.richter@amd.com>
2011-01-26 19:21:28 +01:00
Matt Fleming 3d90a00763 oprofile: Abstract the perf-events backend
Move the perf-events backend from arch/arm/oprofile into
drivers/oprofile so that the code can be shared between architectures.

This allows each architecture to maintain only a single copy of the PMU
accessor functions instead of one for both perf and OProfile. It also
becomes possible for other architectures to delete much of their
OProfile code in favour of the common code now available in
drivers/oprofile/oprofile_perf.c.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Tested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Robert Richter <robert.richter@amd.com>
2010-10-11 17:46:16 +02:00
Matt Fleming 58850e210c ARM: oprofile: Move non-ARM code into separate init/exit
In preparation for moving the majority of this oprofile code into an
architecture-neutral place separate the architecture-independent code
into oprofile_perf_init() and oprofile_perf_exit().

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Tested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Robert Richter <robert.richter@amd.com>
2010-10-11 17:46:15 +02:00
Matt Fleming 80e96b11f6 ARM: oprofile: Rename op_arm to oprofile_perf
In preparation for moving the generic functions out of this file, give
the functions more general names (e.g. remove "arm" from the names).

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Tested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Robert Richter <robert.richter@amd.com>
2010-10-11 17:46:15 +02:00
Matt Fleming 56946331b2 oprofile: Make op_name_from_perf_id() global
Make op_name_from_perf_id() global so that we have a way for each
architecture to construct an oprofile name for op->cpu_type. We need to
remove the argument from the function prototype so that we can hide all
implementation details inside the function.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Robert Richter <robert.richter@amd.com>
2010-10-11 17:46:15 +02:00
Matt Fleming 3bf101ba42 perf: Add helper function to return number of counters
The number of counters for the registered pmu is needed in a few places
so provide a helper function that returns this number.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Tested-by: Will Deacon <will.deacon@arm.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Robert Richter <robert.richter@amd.com>
2010-10-11 10:38:13 +02:00
Robert Richter 4cbe75be5c oprofile, arm: initialize perf_event pointers with NULL
The pointers must be NULL'ed to avoid double-freeing the pointers in
rare cases during reinitialization.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2010-08-31 12:51:43 +02:00
Will Deacon c7fd239a64 ARM: oprofile: fix and simplify init/exit functions
Now that oprofile_arch_exit is only called when the OProfile module
is unloaded, it can assume that init completed successfully and not
have to worry about double frees or releasing NULL perf events.

This patch ensures that oprofile_arch_init fails gracefully on ARM
and simplifies the exit code based on the above.

Cc: Robert Richter <robert.richter@amd.com>
Cc: Matt Fleming <matt@console-pimps.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Robert Richter <robert.richter@amd.com>
2010-08-31 11:49:07 +02:00
Will Deacon d1e86d64bc ARM: 6074/1: oprofile: convert from sysdev to platform device
This is a reworking of an original patch posted by Aaro Koskinen:

oprofile does not work with PM, because sysdev_suspend() is done with
interrupts disabled and oprofile needs a mutex. Implementing oprofile
as a platform device solves this problem.

Cc: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-05-17 11:53:59 +01:00
Will Deacon 8c1fc96f6f ARM: 6072/1: oprofile: use perf-events framework as backend
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.

The only userspace-visible change is the lack of SCU counter support
for 11MPCore. This is currently unsupported by OProfile userspace tools anyway and therefore shouldn't cause any problems.

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>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-05-17 11:53:58 +01:00
Jean PIHET d7ac4e28cc [ARM] 5195/1: ARMv7 Oprofile support
Add Oprofile kernel support for ARMv7.
Tested on OMAP3430 and OMAP3530 chipsets (Cortex-A8).

Signed-off-by: Jean Pihet <jpihet@mvista.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-09-01 12:06:25 +01:00
Kay Sievers af5ca3f4ec Driver core: change sysdev classes to use dynamic kobject names
All kobjects require a dynamically allocated name now. We no longer
need to keep track if the name is statically assigned, we can just
unconditionally free() all kobject names on cleanup.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24 20:40:40 -08:00
Richard Purdie 1b7b56982f [ARM] 4237/2: oprofile: Always allow backtraces on ARM
Always allow backtrace when using oprofile on ARM, even if a PMU
isn't present.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-03-02 11:58:58 +00:00
Russell King 10c03f6968 [ARM] oprofile: add ARM11 SMP support
Add the glue for ARM11 SMP oprofile support, which also supports the
performance monitor in the coherency unit.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-02-06 16:46:45 +00:00
Russell King 2d9e1ae06d [ARM] oprofile: add ARM11 UP support
Add oprofile glue for ARM11 (ARMv6) oprofile support.  This
connects the ARM11 core profiling support to the oprofile code
for uniprocessor configurations.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-02-06 16:46:44 +00:00
Russell King 58e9ff5638 [ARM] Use kcalloc to allocate counter_config array rather than kmalloc
We need this to be zero initialised.  Since this is an array, use kcalloc
rather than kzalloc or kmalloc.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-03-21 23:30:02 +00:00
Russell King ae92dc9f7b [ARM] Oprofile: dynamically allocate counter_config
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-03-21 23:30:02 +00:00
Russell King 93ad79496c [ARM] Oprofile: Convert semaphore to mutex
op_arm_sem is being used as a mutex, so convert it to use
real mutexes.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-03-21 23:30:00 +00:00
Russ Dill 7610dfa372 [ARM] 3295/1: Fix oprofile init return value
Patch from Russ Dill

The oprofile init code was broken in commit c6b9da. The new logic will
always return -ENODEV. This fixes oprofile_arch_init to return 0 on
success, and return the return value of spec->init() if applicable.

Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-02-01 21:07:28 +00:00
Russell King c6b9dafce3 [ARM] 4/4 Combine oprofile common and init code
There is nothing special about having the init code separate from
the common code, so combine the two.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-10-28 14:56:04 +01:00
Russell King 55f052341f [ARM] 3/4 Rename common oprofile code
The common oprofile code assumes the name "PMU" (from Intel's
performance management unit).  This is misleading when we
start adding oprofile support for other machine types which
don't use the same terminology.  Call it op_arm_* instead of
pmu_*.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-10-28 14:54:21 +01:00
Russell King 7c5b3fc208 [ARM] 2/4 Fix oprofile suspend/resume
The oprofile suspend/resume was missing locking.  If we failed
to start oprofile on resume, we still reported that it was
enabled.  Instead, disable oprofile on error.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-10-28 14:52:30 +01:00
Russell King b5893c56ca [ARM] 1/4 Move oprofile driver model code
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-10-28 14:51:15 +01:00
Linus Torvalds 1da177e4c3 Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
2005-04-16 15:20:36 -07:00