From: gdavis@mvista•com (George G. Davis)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 2/5] arm/oprofile: reserve the PMU when starting
Date: Fri, 5 Feb 2010 01:01:54 -0500 [thread overview]
Message-ID: <20100205060153.GA21979@mvista.com> (raw)
In-Reply-To: <1263471256-3739-3-git-send-email-jamie.iles@picochip.com>
Hi,
On Thu, Jan 14, 2010 at 12:14:13PM +0000, Jamie Iles wrote:
> Make sure that we have access to the performance counters and
> that they aren't being used by perf events or anything else.
>
> Cc: Will Deacon <will.deacon@arm•com>
> Cc: Jean Pihet <jpihet@mvista•com>
> Signed-off-by: Jamie Iles <jamie.iles@picochip•com>
> ---
> arch/arm/oprofile/op_model_arm11_core.c | 4 +-
> arch/arm/oprofile/op_model_arm11_core.h | 4 +-
> arch/arm/oprofile/op_model_mpcore.c | 42 ++++++++++++++++--------------
> arch/arm/oprofile/op_model_v6.c | 30 ++++++++++++++--------
> arch/arm/oprofile/op_model_v7.c | 30 ++++++++++++++--------
> arch/arm/oprofile/op_model_v7.h | 4 +-
> arch/arm/oprofile/op_model_xscale.c | 35 ++++++++++++++-----------
> 7 files changed, 85 insertions(+), 64 deletions(-)
// CUT
> diff --git a/arch/arm/oprofile/op_model_mpcore.c b/arch/arm/oprofile/op_model_mpcore.c
> index 4ce0f98..f73ce87 100644
> --- a/arch/arm/oprofile/op_model_mpcore.c
> +++ b/arch/arm/oprofile/op_model_mpcore.c
> @@ -32,6 +32,7 @@
> /* #define DEBUG */
> #include <linux/types.h>
> #include <linux/errno.h>
> +#include <linux/err.h>
> #include <linux/sched.h>
> #include <linux/oprofile.h>
> #include <linux/interrupt.h>
> @@ -43,6 +44,7 @@
> #include <mach/hardware.h>
> #include <mach/board-eb.h>
> #include <asm/system.h>
> +#include <asm/pmu.h>
>
> #include "op_counter.h"
> #include "op_arm_model.h"
> @@ -58,6 +60,7 @@
> * Bitmask of used SCU counters
> */
> static unsigned int scu_em_used;
> +static const struct pmu_irqs *pmu_irqs;
>
> /*
> * 2 helper fns take a counter number from 0-7 (not the userspace-visible counter number)
> @@ -225,33 +228,40 @@ static int em_setup_ctrs(void)
> return 0;
> }
>
> -static int arm11_irqs[] = {
> - [0] = IRQ_EB11MP_PMU_CPU0,
> - [1] = IRQ_EB11MP_PMU_CPU1,
> - [2] = IRQ_EB11MP_PMU_CPU2,
> - [3] = IRQ_EB11MP_PMU_CPU3
> -};
> -
> static int em_start(void)
> {
> int ret;
>
> - ret = arm11_request_interrupts(arm11_irqs, ARRAY_SIZE(arm11_irqs));
> + pmu_irqs = reserve_pmu();
> + if (IS_ERR(pmu_irqs)) {
> + ret = PTR_ERR(pmu_irqs);
> + goto out;
> + }
> +
> + ret = arm11_request_interrupts(pmu_irqs->irqs, pmu_irqs->num_irqs);
> if (ret == 0) {
> em_call_function(arm11_start_pmu);
>
> ret = scu_start();
> - if (ret)
> - arm11_release_interrupts(arm11_irqs, ARRAY_SIZE(arm11_irqs));
> + if (ret) {
> + arm11_release_interrupts(pmu_irqs->irqs,
> + pmu_irqs->num_irqs);
> + } else {
> + release_pmu(pmu_irqs);
> + pmu_irqs = NULL;
> + }
> }
> +
> +out:
> return ret;
> }
The "} else {" clause above broke OProfile on ARM11 MPCore. Here's a
trivial fix tested on ARM Ltd. RealView EB ARM11 MPCore:
next prev parent reply other threads:[~2010-02-05 6:01 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-14 12:14 ARM perf events support v5 Jamie Iles
2010-01-14 12:14 ` [PATCH 1/5] arm: provide a mechanism to reserve performance counters Jamie Iles
2010-01-14 12:14 ` [PATCH 2/5] arm/oprofile: reserve the PMU when starting Jamie Iles
2010-01-14 12:14 ` [PATCH 3/5] arm: use the spinlocked, generic atomic64 support Jamie Iles
2010-01-14 12:14 ` [PATCH 4/5] arm: enable support for software perf events Jamie Iles
2010-01-14 12:14 ` [PATCH 5/5] arm/perfevents: implement perf event support for ARMv6 Jamie Iles
2010-01-21 9:39 ` Jamie Iles
2010-01-21 10:28 ` Will Deacon
2010-01-21 10:37 ` Jamie Iles
2010-01-21 10:38 ` Russell King - ARM Linux
2010-01-21 10:56 ` Will Deacon
2010-01-21 12:21 ` Jean Pihet
2010-01-21 12:27 ` Jamie Iles
2010-01-21 12:32 ` Jean Pihet
2010-01-21 14:04 ` Jamie Iles
2010-01-21 12:34 ` Will Deacon
2010-01-21 12:42 ` Jean Pihet
2010-01-22 15:25 ` Will Deacon
2010-01-21 12:45 ` Russell King - ARM Linux
2010-01-26 16:03 ` Tomasz Fujak
2010-01-26 16:09 ` Jamie Iles
2010-01-26 16:11 ` Jean Pihet
2010-01-26 17:47 ` Jean Pihet
2010-01-27 17:26 ` Will Deacon
2010-01-27 17:40 ` Jean Pihet
2010-01-27 17:57 ` Will Deacon
2010-01-28 11:26 ` Jamie Iles
2010-01-30 16:15 ` Russell King - ARM Linux
2010-02-02 17:14 ` Russell King - ARM Linux
2010-02-02 17:28 ` Jamie Iles
2010-02-02 17:40 ` [PATCH 4/5] arm: enable support for software perf events Russell King - ARM Linux
2010-02-02 18:19 ` Will Deacon
2010-02-02 18:48 ` Jamie Iles
2010-02-02 19:07 ` Russell King - ARM Linux
2010-02-02 19:28 ` Jamie Iles
2010-02-05 6:01 ` George G. Davis [this message]
2010-02-05 9:13 ` [PATCH 2/5] arm/oprofile: reserve the PMU when starting Jamie Iles
2010-01-21 9:30 ` [PATCH 1/5] arm: provide a mechanism to reserve performance counters Jamie Iles
-- strict thread matches above, loose matches on Subject: below --
2010-01-04 10:48 ARM perf events support v4 Jamie Iles
2010-01-04 10:48 ` [PATCH 1/5] arm: provide a mechanism to reserve performance counters Jamie Iles
2010-01-04 10:48 ` [PATCH 2/5] arm/oprofile: reserve the PMU when starting Jamie Iles
2009-12-15 11:15 ARMv6 performance counters v3 Jamie Iles
2009-12-15 11:15 ` [PATCH 1/5] arm: provide a mechanism to reserve performance counters Jamie Iles
2009-12-15 11:15 ` [PATCH 2/5] arm/oprofile: reserve the PMU when starting Jamie Iles
2009-12-14 14:04 ARMv6 performance counters v2 Jamie Iles
2009-12-14 14:04 ` [PATCH 1/5] arm: provide a mechanism to reserve performance counters Jamie Iles
2009-12-14 14:04 ` [PATCH 2/5] arm/oprofile: reserve the PMU when starting Jamie Iles
2009-12-14 16:01 ` Jean Pihet
2009-12-14 16:04 ` Will Deacon
2009-12-14 16:10 ` Jamie Iles
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100205060153.GA21979@mvista.com \
--to=gdavis@mvista$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox