linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] arm/perfevents: implement perf event support for ARMv6
Date: Tue, 15 Dec 2009 14:29:21 -0000	[thread overview]
Message-ID: <000101ca7d92$fe903000$fbb09000$@deacon@arm.com> (raw)
In-Reply-To: <1260875712-29712-6-git-send-email-jamie.iles@picochip.com>

Hi Jamie,

I've not looked at the entire patch in depth, but I did spot a couple
of things:

> This patch implements support for ARMv6 performance counters in the
> Linux performance events subsystem. ARMv6 architectures that have the
> performance counters should enable HW_PERF_EVENTS and define the
> interrupts for the counters in arch/arm/kernel/perf_event.c
> 
> This implementation also provides an ARM PMU abstraction layer to allow
> ARMv7 and others to be supported in the future by adding new a
> 'struct arm_pmu'.

<snip>

> +static struct arm_pmu armv6pmu = {
> +	.name			= "v6",
> +	.handle_irq		= armv6pmu_handle_irq,
> +	.enable			= armv6pmu_enable_event,
> +	.disable		= armv6pmu_disable_event,
> +	.event_map		= armv6pmu_event_map,
> +	.raw_event		= armv6pmu_raw_event,
> +        .read_counter           = armv6pmu_read_counter,
> +        .write_counter          = armv6pmu_write_counter,
> +	.get_event_idx		= armv6pmu_get_event_idx,
> +        .start                  = armv6pmu_start,
> +	.stop		        = armv6pmu_stop,
> +	.num_events		= 3,
> +	.max_period		= (1LLU << 32) - 1,
> +};

Your indentation seems to have gone awry here, I think I saw it somewhere
else in the file too.

> +static int __init
> +init_hw_perf_events(void)
> +{
> +#define CPUID_V6_MASK   0x7F000
> +#define CPUID_V6_BITS   0x7B000
> +        unsigned long cpuid = read_cpuid_id();
> +
> +        if (CPUID_V6_BITS == (cpuid & CPUID_V6_MASK)) {
> +                armpmu = &armv6pmu;
> +                memcpy(armpmu_perf_cache_map, armv6_perf_cache_map,
> +                       sizeof(armv6_perf_cache_map));
> +                perf_max_events	= armv6pmu.num_events;
> +        } else {
> +                pr_info("no hardware support available\n");
> +                perf_max_events = -1;
> +        }
> +
> +        if (armpmu)
> +                pr_info("enabled with %s PMU driver\n",
> +                        armpmu->name);
> +
> +        return 0;
> +}
> +arch_initcall(init_hw_perf_events);

Watch out for the 11MPCore CPU. The event numbers are defined *slightly*
differently (1136,1156 and 1176 don't have any conflicts with each other,
but the 11MPCore does). If you look at the TRM the first 6 events are the
same as for other v6 cores, but then event 0x06 becomes a new event: `branch
not predicted' which offsets the others by one. Other than that, the PMUs
are accessed the same way on each core, so you just need to make sure you
select the correct event mappings.

Cheers,

Will

  reply	other threads:[~2009-12-15 14:29 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-15 11:15     ` [PATCH 3/5] arm: use the spinlocked, generic atomic64 support Jamie Iles
2009-12-15 11:15       ` [PATCH 4/5] arm: enable support for software perf events Jamie Iles
2009-12-15 11:15         ` [PATCH 5/5] arm/perfevents: implement perf event support for ARMv6 Jamie Iles
2009-12-15 14:29           ` Will Deacon [this message]
2009-12-15 15:02             ` Jamie Iles
2009-12-15 15:05               ` Will Deacon
2009-12-15 15:19                 ` Jamie Iles
2009-12-15 15:30                   ` Peter Zijlstra
2009-12-15 15:36                     ` Jamie Iles
2009-12-16 10:54                       ` Jamie Iles
2009-12-16 11:04                         ` Will Deacon
2009-12-16 11:19                           ` Jamie Iles
2009-12-18 17:05           ` Perf Event support for ARMv7 (was: Re: [PATCH 5/5] arm/perfevents: implement perf event support for ARMv6) Jean Pihet
2009-12-19 10:29             ` Jamie Iles
2009-12-19 10:53               ` Ingo Molnar
2009-12-21 11:32                 ` Jean Pihet
2009-12-21 11:29               ` Jean Pihet
2009-12-21 11:04             ` Will Deacon
2009-12-21 11:43               ` Jean Pihet
2009-12-21 12:10                 ` Will Deacon
2009-12-21 12:43                   ` Jamie Iles
2009-12-21 13:35                     ` Jean Pihet
2009-12-22 16:51                       ` Jean Pihet
2009-12-28  7:57                         ` Ingo Molnar
2009-12-29 13:52                           ` Jean Pihet
2009-12-29 16:32                             ` Jamie Iles
2010-01-06 15:16                               ` Michał Nazarewicz
2010-01-06 15:30                                 ` Jamie Iles
2010-01-07 17:02                                   ` Michał Nazarewicz
2009-12-29 13:58                         ` Jean Pihet
2010-01-04 16:52                           ` Will Deacon
2010-01-15 15:30                             ` Jean Pihet
2010-01-15 15:39                               ` Jamie Iles
2010-01-15 15:43                                 ` Jean Pihet
2010-01-15 15:49                                   ` Jamie Iles
2010-01-20 13:40                               ` Will Deacon
2010-01-08 22:17                         ` Woodruff, Richard
2010-01-15 15:34                           ` Jean Pihet
2009-12-15 14:13   ` [PATCH 1/5] arm: provide a mechanism to reserve performance counters Will Deacon
2009-12-15 14:36     ` Jamie Iles
2009-12-15 17:06       ` Will Deacon
2009-12-17 16:14   ` Will Deacon
2009-12-17 16:27     ` Jamie Iles
  -- strict thread matches above, loose matches on Subject: below --
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-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
2010-01-04 10:48     ` [PATCH 3/5] arm: use the spinlocked, generic atomic64 support Jamie Iles
2010-01-04 10:48       ` [PATCH 4/5] arm: enable support for software perf events Jamie Iles
2010-01-04 10:48         ` [PATCH 5/5] arm/perfevents: implement perf event support for ARMv6 Jamie Iles
2010-01-04 11:17           ` Russell King - ARM Linux
2010-01-04 11:46             ` Jamie Iles
2010-01-05 18:07           ` Will Deacon
2010-01-05 18:23             ` Jean Pihet
2010-01-05 22:26             ` Jamie Iles
2010-01-05 22:31               ` Russell King - ARM Linux
2010-01-06  0:18                 ` Jamie Iles
2010-01-06 12:09                   ` Will Deacon
2010-01-06 12:14                     ` 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 14:04     ` [PATCH 3/5] arm: use the spinlocked, generic atomic64 support Jamie Iles
2009-12-14 14:04       ` [PATCH 4/5] arm: enable support for software perf events Jamie Iles
2009-12-14 14:04         ` [PATCH 5/5] arm/perfevents: implement perf event support for ARMv6 Jamie Iles
2009-12-14 16:12           ` Jean Pihet
2009-12-14 16:33             ` Jamie Iles
2009-12-14 16:57               ` Jean Pihet
2009-12-14 17:09             ` Will Deacon
2009-12-14 16:13           ` Will Deacon
2009-12-14 16:20             ` Jamie Iles
2009-12-14 16:24               ` Will Deacon

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='000101ca7d92$fe903000$fbb09000$@deacon@arm.com' \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).