2 * Hardware performance events for the Alpha.
4 * We implement HW counts on the EV67 and subsequent CPUs only.
6 * (C) 2010 Michael J. Cree
8 * Somewhat based on the Sparc code, and to a lesser extent the PowerPC and
9 * ARM code, which are copyright by their respective authors.
12 #include <linux/perf_event.h>
13 #include <linux/kprobes.h>
14 #include <linux/kernel.h>
15 #include <linux/kdebug.h>
16 #include <linux/mutex.h>
18 #include <asm/hwrpb.h>
19 #include <asm/atomic.h>
21 #include <asm/irq_regs.h>
23 #include <asm/wrperfmon.h>
24 #include <asm/hw_irq.h>
27 /* The maximum number of PMCs on any Alpha CPU whatsoever. */
28 #define MAX_HWEVENTS 3
29 #define PMC_NO_INDEX -1
31 /* For tracking PMCs and the hw events they monitor on each CPU. */
32 struct cpu_hw_events {
34 /* Number of events scheduled; also number entries valid in arrays below. */
36 /* Number events added since last hw_perf_disable(). */
38 /* Events currently scheduled. */
39 struct perf_event *event[MAX_HWEVENTS];
40 /* Event type of each scheduled event. */
41 unsigned long evtype[MAX_HWEVENTS];
42 /* Current index of each scheduled event; if not yet determined
43 * contains PMC_NO_INDEX.
45 int current_idx[MAX_HWEVENTS];
46 /* The active PMCs' config for easy use with wrperfmon(). */
48 /* The active counters' indices for easy use with wrperfmon(). */
49 unsigned long idx_mask;
51 DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
56 * A structure to hold the description of the PMCs available on a particular
60 /* Mapping of the perf system hw event types to indigenous event types */
62 /* The number of entries in the event_map */
64 /* The number of PMCs on this Alpha */
67 * All PMC counters reside in the IBOX register PCTR. This is the
70 int pmc_count_shift[MAX_HWEVENTS];
72 * The mask that isolates the PMC bits when the LSB of the counter
73 * is shifted to bit 0.
75 unsigned long pmc_count_mask[MAX_HWEVENTS];
76 /* The maximum period the PMC can count. */
77 unsigned long pmc_max_period[MAX_HWEVENTS];
79 * The maximum value that may be written to the counter due to
80 * hardware restrictions is pmc_max_period - pmc_left.
83 /* Subroutine for allocation of PMCs. Enforces constraints. */
84 int (*check_constraints)(struct perf_event **, unsigned long *, int);
88 * The Alpha CPU PMU description currently in operation. This is set during
89 * the boot process to the specific CPU of the machine.
91 static const struct alpha_pmu_t *alpha_pmu;
94 #define HW_OP_UNSUPPORTED -1
97 * The hardware description of the EV67, EV68, EV69, EV7 and EV79 PMUs
98 * follow. Since they are identical we refer to them collectively as the
103 * EV67 PMC event types
105 * There is no one-to-one mapping of the possible hw event types to the
106 * actual codes that are used to program the PMCs hence we introduce our
107 * own hw event type identifiers.
109 enum ev67_pmc_event_type {
116 #define EV67_NUM_EVENT_TYPES (EV67_LAST_ET-EV67_CYCLES)
119 /* Mapping of the hw event types to the perf tool interface */
120 static const int ev67_perfmon_event_map[] = {
121 [PERF_COUNT_HW_CPU_CYCLES] = EV67_CYCLES,
122 [PERF_COUNT_HW_INSTRUCTIONS] = EV67_INSTRUCTIONS,
123 [PERF_COUNT_HW_CACHE_REFERENCES] = HW_OP_UNSUPPORTED,
124 [PERF_COUNT_HW_CACHE_MISSES] = EV67_BCACHEMISS,
127 struct ev67_mapping_t {
133 * The mapping used for one event only - these must be in same order as enum
134 * ev67_pmc_event_type definition.
136 static const struct ev67_mapping_t ev67_mapping[] = {
137 {EV67_PCTR_INSTR_CYCLES, 1}, /* EV67_CYCLES, */
138 {EV67_PCTR_INSTR_CYCLES, 0}, /* EV67_INSTRUCTIONS */
139 {EV67_PCTR_INSTR_BCACHEMISS, 1}, /* EV67_BCACHEMISS */
140 {EV67_PCTR_CYCLES_MBOX, 1} /* EV67_MBOXREPLAY */
145 * Check that a group of events can be simultaneously scheduled on to the
146 * EV67 PMU. Also allocate counter indices and config.
148 static int ev67_check_constraints(struct perf_event **event,
149 unsigned long *evtype, int n_ev)
152 unsigned long config;
154 idx0 = ev67_mapping[evtype[0]-1].idx;
155 config = ev67_mapping[evtype[0]-1].config;
161 if (evtype[0] == EV67_MBOXREPLAY || evtype[1] == EV67_MBOXREPLAY) {
162 /* MBOX replay traps must be on PMC 1 */
163 idx0 = (evtype[0] == EV67_MBOXREPLAY) ? 1 : 0;
164 /* Only cycles can accompany MBOX replay traps */
165 if (evtype[idx0] == EV67_CYCLES) {
166 config = EV67_PCTR_CYCLES_MBOX;
171 if (evtype[0] == EV67_BCACHEMISS || evtype[1] == EV67_BCACHEMISS) {
172 /* Bcache misses must be on PMC 1 */
173 idx0 = (evtype[0] == EV67_BCACHEMISS) ? 1 : 0;
174 /* Only instructions can accompany Bcache misses */
175 if (evtype[idx0] == EV67_INSTRUCTIONS) {
176 config = EV67_PCTR_INSTR_BCACHEMISS;
181 if (evtype[0] == EV67_INSTRUCTIONS || evtype[1] == EV67_INSTRUCTIONS) {
182 /* Instructions must be on PMC 0 */
183 idx0 = (evtype[0] == EV67_INSTRUCTIONS) ? 0 : 1;
184 /* By this point only cycles can accompany instructions */
185 if (evtype[idx0^1] == EV67_CYCLES) {
186 config = EV67_PCTR_INSTR_CYCLES;
191 /* Otherwise, darn it, there is a conflict. */
195 event[0]->hw.idx = idx0;
196 event[0]->hw.config_base = config;
198 event[1]->hw.idx = idx0 ^ 1;
199 event[1]->hw.config_base = config;
205 static const struct alpha_pmu_t ev67_pmu = {
206 .event_map = ev67_perfmon_event_map,
207 .max_events = ARRAY_SIZE(ev67_perfmon_event_map),
209 .pmc_count_shift = {EV67_PCTR_0_COUNT_SHIFT, EV67_PCTR_1_COUNT_SHIFT, 0},
210 .pmc_count_mask = {EV67_PCTR_0_COUNT_MASK, EV67_PCTR_1_COUNT_MASK, 0},
211 .pmc_max_period = {(1UL<<20) - 1, (1UL<<20) - 1, 0},
212 .pmc_left = {16, 4, 0},
213 .check_constraints = ev67_check_constraints
219 * Helper routines to ensure that we read/write only the correct PMC bits
220 * when calling the wrperfmon PALcall.
222 static inline void alpha_write_pmc(int idx, unsigned long val)
224 val &= alpha_pmu->pmc_count_mask[idx];
225 val <<= alpha_pmu->pmc_count_shift[idx];
227 wrperfmon(PERFMON_CMD_WRITE, val);
230 static inline unsigned long alpha_read_pmc(int idx)
234 val = wrperfmon(PERFMON_CMD_READ, 0);
235 val >>= alpha_pmu->pmc_count_shift[idx];
236 val &= alpha_pmu->pmc_count_mask[idx];
240 /* Set a new period to sample over */
241 static int alpha_perf_event_set_period(struct perf_event *event,
242 struct hw_perf_event *hwc, int idx)
244 long left = local64_read(&hwc->period_left);
245 long period = hwc->sample_period;
248 if (unlikely(left <= -period)) {
250 local64_set(&hwc->period_left, left);
251 hwc->last_period = period;
255 if (unlikely(left <= 0)) {
257 local64_set(&hwc->period_left, left);
258 hwc->last_period = period;
263 * Hardware restrictions require that the counters must not be
264 * written with values that are too close to the maximum period.
266 if (unlikely(left < alpha_pmu->pmc_left[idx]))
267 left = alpha_pmu->pmc_left[idx];
269 if (left > (long)alpha_pmu->pmc_max_period[idx])
270 left = alpha_pmu->pmc_max_period[idx];
272 local64_set(&hwc->prev_count, (unsigned long)(-left));
274 alpha_write_pmc(idx, (unsigned long)(-left));
276 perf_event_update_userpage(event);
283 * Calculates the count (the 'delta') since the last time the PMC was read.
285 * As the PMCs' full period can easily be exceeded within the perf system
286 * sampling period we cannot use any high order bits as a guard bit in the
287 * PMCs to detect overflow as is done by other architectures. The code here
288 * calculates the delta on the basis that there is no overflow when ovf is
289 * zero. The value passed via ovf by the interrupt handler corrects for
292 * This can be racey on rare occasions -- a call to this routine can occur
293 * with an overflowed counter just before the PMI service routine is called.
294 * The check for delta negative hopefully always rectifies this situation.
296 static unsigned long alpha_perf_event_update(struct perf_event *event,
297 struct hw_perf_event *hwc, int idx, long ovf)
299 long prev_raw_count, new_raw_count;
303 prev_raw_count = local64_read(&hwc->prev_count);
304 new_raw_count = alpha_read_pmc(idx);
306 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
307 new_raw_count) != prev_raw_count)
310 delta = (new_raw_count - (prev_raw_count & alpha_pmu->pmc_count_mask[idx])) + ovf;
312 /* It is possible on very rare occasions that the PMC has overflowed
313 * but the interrupt is yet to come. Detect and fix this situation.
315 if (unlikely(delta < 0)) {
316 delta += alpha_pmu->pmc_max_period[idx] + 1;
319 local64_add(delta, &event->count);
320 local64_sub(delta, &hwc->period_left);
322 return new_raw_count;
327 * Collect all HW events into the array event[].
329 static int collect_events(struct perf_event *group, int max_count,
330 struct perf_event *event[], unsigned long *evtype,
333 struct perf_event *pe;
336 if (!is_software_event(group)) {
340 evtype[n] = group->hw.event_base;
341 current_idx[n++] = PMC_NO_INDEX;
343 list_for_each_entry(pe, &group->sibling_list, group_entry) {
344 if (!is_software_event(pe) && pe->state != PERF_EVENT_STATE_OFF) {
348 evtype[n] = pe->hw.event_base;
349 current_idx[n++] = PMC_NO_INDEX;
358 * Check that a group of events can be simultaneously scheduled on to the PMU.
360 static int alpha_check_constraints(struct perf_event **events,
361 unsigned long *evtypes, int n_ev)
364 /* No HW events is possible from hw_perf_group_sched_in(). */
368 if (n_ev > alpha_pmu->num_pmcs)
371 return alpha_pmu->check_constraints(events, evtypes, n_ev);
376 * If new events have been scheduled then update cpuc with the new
377 * configuration. This may involve shifting cycle counts from one PMC to
380 static void maybe_change_configuration(struct cpu_hw_events *cpuc)
384 if (cpuc->n_added == 0)
387 /* Find counters that are moving to another PMC and update */
388 for (j = 0; j < cpuc->n_events; j++) {
389 struct perf_event *pe = cpuc->event[j];
391 if (cpuc->current_idx[j] != PMC_NO_INDEX &&
392 cpuc->current_idx[j] != pe->hw.idx) {
393 alpha_perf_event_update(pe, &pe->hw, cpuc->current_idx[j], 0);
394 cpuc->current_idx[j] = PMC_NO_INDEX;
398 /* Assign to counters all unassigned events. */
400 for (j = 0; j < cpuc->n_events; j++) {
401 struct perf_event *pe = cpuc->event[j];
402 struct hw_perf_event *hwc = &pe->hw;
405 if (cpuc->current_idx[j] == PMC_NO_INDEX) {
406 alpha_perf_event_set_period(pe, hwc, idx);
407 cpuc->current_idx[j] = idx;
410 if (!(hwc->state & PERF_HES_STOPPED))
411 cpuc->idx_mask |= (1<<cpuc->current_idx[j]);
413 cpuc->config = cpuc->event[0]->hw.config_base;
418 /* Schedule perf HW event on to PMU.
419 * - this function is called from outside this module via the pmu struct
420 * returned from perf event initialisation.
422 static int alpha_pmu_add(struct perf_event *event, int flags)
424 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
425 struct hw_perf_event *hwc = &event->hw;
428 unsigned long irq_flags;
431 * The Sparc code has the IRQ disable first followed by the perf
432 * disable, however this can lead to an overflowed counter with the
433 * PMI disabled on rare occasions. The alpha_perf_event_update()
434 * routine should detect this situation by noting a negative delta,
435 * nevertheless we disable the PMCs first to enable a potential
436 * final PMI to occur before we disable interrupts.
438 perf_pmu_disable(event->pmu);
439 local_irq_save(irq_flags);
441 /* Default to error to be returned */
444 /* Insert event on to PMU and if successful modify ret to valid return */
446 if (n0 < alpha_pmu->num_pmcs) {
447 cpuc->event[n0] = event;
448 cpuc->evtype[n0] = event->hw.event_base;
449 cpuc->current_idx[n0] = PMC_NO_INDEX;
451 if (!alpha_check_constraints(cpuc->event, cpuc->evtype, n0+1)) {
458 hwc->state = PERF_HES_UPTODATE;
459 if (!(flags & PERF_EF_START))
460 hwc->state |= PERF_HES_STOPPED;
462 local_irq_restore(irq_flags);
463 perf_pmu_enable(event->pmu);
470 /* Disable performance monitoring unit
471 * - this function is called from outside this module via the pmu struct
472 * returned from perf event initialisation.
474 static void alpha_pmu_del(struct perf_event *event, int flags)
476 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
477 struct hw_perf_event *hwc = &event->hw;
478 unsigned long irq_flags;
481 perf_pmu_disable(event->pmu);
482 local_irq_save(irq_flags);
484 for (j = 0; j < cpuc->n_events; j++) {
485 if (event == cpuc->event[j]) {
486 int idx = cpuc->current_idx[j];
488 /* Shift remaining entries down into the existing
491 while (++j < cpuc->n_events) {
492 cpuc->event[j - 1] = cpuc->event[j];
493 cpuc->evtype[j - 1] = cpuc->evtype[j];
494 cpuc->current_idx[j - 1] =
495 cpuc->current_idx[j];
498 /* Absorb the final count and turn off the event. */
499 alpha_perf_event_update(event, hwc, idx, 0);
500 perf_event_update_userpage(event);
502 cpuc->idx_mask &= ~(1UL<<idx);
508 local_irq_restore(irq_flags);
509 perf_pmu_enable(event->pmu);
513 static void alpha_pmu_read(struct perf_event *event)
515 struct hw_perf_event *hwc = &event->hw;
517 alpha_perf_event_update(event, hwc, hwc->idx, 0);
521 static void alpha_pmu_stop(struct perf_event *event, int flags)
523 struct hw_perf_event *hwc = &event->hw;
524 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
526 if (!(hwc->state & PERF_HES_STOPPED)) {
527 cpuc->idx_mask &= ~(1UL<<hwc->idx);
528 hwc->state |= PERF_HES_STOPPED;
531 if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) {
532 alpha_perf_event_update(event, hwc, hwc->idx, 0);
533 hwc->state |= PERF_HES_UPTODATE;
537 wrperfmon(PERFMON_CMD_DISABLE, (1UL<<hwc->idx));
541 static void alpha_pmu_start(struct perf_event *event, int flags)
543 struct hw_perf_event *hwc = &event->hw;
544 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
546 if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED)))
549 if (flags & PERF_EF_RELOAD) {
550 WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
551 alpha_perf_event_set_period(event, hwc, hwc->idx);
556 cpuc->idx_mask |= 1UL<<hwc->idx;
558 wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));
563 * Check that CPU performance counters are supported.
564 * - currently support EV67 and later CPUs.
565 * - actually some later revisions of the EV6 have the same PMC model as the
566 * EV67 but we don't do suffiently deep CPU detection to detect them.
567 * Bad luck to the very few people who might have one, I guess.
569 static int supported_cpu(void)
571 struct percpu_struct *cpu;
572 unsigned long cputype;
574 /* Get cpu type from HW */
575 cpu = (struct percpu_struct *)((char *)hwrpb + hwrpb->processor_offset);
576 cputype = cpu->type & 0xffffffff;
577 /* Include all of EV67, EV68, EV7, EV79 and EV69 as supported. */
578 return (cputype >= EV67_CPU) && (cputype <= EV69_CPU);
583 static void hw_perf_event_destroy(struct perf_event *event)
585 /* Nothing to be done! */
591 static int __hw_perf_event_init(struct perf_event *event)
593 struct perf_event_attr *attr = &event->attr;
594 struct hw_perf_event *hwc = &event->hw;
595 struct perf_event *evts[MAX_HWEVENTS];
596 unsigned long evtypes[MAX_HWEVENTS];
597 int idx_rubbish_bin[MAX_HWEVENTS];
601 /* We only support a limited range of HARDWARE event types with one
602 * only programmable via a RAW event type.
604 if (attr->type == PERF_TYPE_HARDWARE) {
605 if (attr->config >= alpha_pmu->max_events)
607 ev = alpha_pmu->event_map[attr->config];
608 } else if (attr->type == PERF_TYPE_HW_CACHE) {
610 } else if (attr->type == PERF_TYPE_RAW) {
611 ev = attr->config & 0xff;
620 /* The EV67 does not support mode exclusion */
621 if (attr->exclude_kernel || attr->exclude_user
622 || attr->exclude_hv || attr->exclude_idle) {
627 * We place the event type in event_base here and leave calculation
628 * of the codes to programme the PMU for alpha_pmu_enable() because
629 * it is only then we will know what HW events are actually
630 * scheduled on to the PMU. At that point the code to programme the
631 * PMU is put into config_base and the PMC to use is placed into
632 * idx. We initialise idx (below) to PMC_NO_INDEX to indicate that
633 * it is yet to be determined.
635 hwc->event_base = ev;
637 /* Collect events in a group together suitable for calling
638 * alpha_check_constraints() to verify that the group as a whole can
639 * be scheduled on to the PMU.
642 if (event->group_leader != event) {
643 n = collect_events(event->group_leader,
644 alpha_pmu->num_pmcs - 1,
645 evts, evtypes, idx_rubbish_bin);
649 evtypes[n] = hwc->event_base;
652 if (alpha_check_constraints(evts, evtypes, n + 1))
655 /* Indicate that PMU config and idx are yet to be determined. */
656 hwc->config_base = 0;
657 hwc->idx = PMC_NO_INDEX;
659 event->destroy = hw_perf_event_destroy;
662 * Most architectures reserve the PMU for their use at this point.
663 * As there is no existing mechanism to arbitrate usage and there
664 * appears to be no other user of the Alpha PMU we just assume
665 * that we can just use it, hence a NO-OP here.
667 * Maybe an alpha_reserve_pmu() routine should be implemented but is
668 * anything else ever going to use it?
671 if (!hwc->sample_period) {
672 hwc->sample_period = alpha_pmu->pmc_max_period[0];
673 hwc->last_period = hwc->sample_period;
674 local64_set(&hwc->period_left, hwc->sample_period);
681 * Main entry point to initialise a HW performance event.
683 static int alpha_pmu_event_init(struct perf_event *event)
687 switch (event->attr.type) {
689 case PERF_TYPE_HARDWARE:
690 case PERF_TYPE_HW_CACHE:
700 /* Do the real initialisation work. */
701 err = __hw_perf_event_init(event);
707 * Main entry point - enable HW performance counters.
709 static void alpha_pmu_enable(struct pmu *pmu)
711 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
719 if (cpuc->n_events > 0) {
720 /* Update cpuc with information from any new scheduled events. */
721 maybe_change_configuration(cpuc);
723 /* Start counting the desired events. */
724 wrperfmon(PERFMON_CMD_LOGGING_OPTIONS, EV67_PCTR_MODE_AGGREGATE);
725 wrperfmon(PERFMON_CMD_DESIRED_EVENTS, cpuc->config);
726 wrperfmon(PERFMON_CMD_ENABLE, cpuc->idx_mask);
732 * Main entry point - disable HW performance counters.
735 static void alpha_pmu_disable(struct pmu *pmu)
737 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
745 wrperfmon(PERFMON_CMD_DISABLE, cpuc->idx_mask);
748 static struct pmu pmu = {
749 .pmu_enable = alpha_pmu_enable,
750 .pmu_disable = alpha_pmu_disable,
751 .event_init = alpha_pmu_event_init,
752 .add = alpha_pmu_add,
753 .del = alpha_pmu_del,
754 .start = alpha_pmu_start,
755 .stop = alpha_pmu_stop,
756 .read = alpha_pmu_read,
761 * Main entry point - don't know when this is called but it
762 * obviously dumps debug info.
764 void perf_event_print_debug(void)
771 if (!supported_cpu())
774 local_irq_save(flags);
776 cpu = smp_processor_id();
778 pcr = wrperfmon(PERFMON_CMD_READ, 0);
779 pcr0 = (pcr >> alpha_pmu->pmc_count_shift[0]) & alpha_pmu->pmc_count_mask[0];
780 pcr1 = (pcr >> alpha_pmu->pmc_count_shift[1]) & alpha_pmu->pmc_count_mask[1];
782 pr_info("CPU#%d: PCTR0[%06x] PCTR1[%06x]\n", cpu, pcr0, pcr1);
784 local_irq_restore(flags);
789 * Performance Monitoring Interrupt Service Routine called when a PMC
790 * overflows. The PMC that overflowed is passed in la_ptr.
792 static void alpha_perf_event_irq_handler(unsigned long la_ptr,
793 struct pt_regs *regs)
795 struct cpu_hw_events *cpuc;
796 struct perf_sample_data data;
797 struct perf_event *event;
798 struct hw_perf_event *hwc;
801 __get_cpu_var(irq_pmi_count)++;
802 cpuc = &__get_cpu_var(cpu_hw_events);
804 /* Completely counting through the PMC's period to trigger a new PMC
805 * overflow interrupt while in this interrupt routine is utterly
806 * disastrous! The EV6 and EV67 counters are sufficiently large to
807 * prevent this but to be really sure disable the PMCs.
809 wrperfmon(PERFMON_CMD_DISABLE, cpuc->idx_mask);
811 /* la_ptr is the counter that overflowed. */
812 if (unlikely(la_ptr >= alpha_pmu->num_pmcs)) {
813 /* This should never occur! */
815 pr_warning("PMI: silly index %ld\n", la_ptr);
816 wrperfmon(PERFMON_CMD_ENABLE, cpuc->idx_mask);
822 perf_sample_data_init(&data, 0);
823 for (j = 0; j < cpuc->n_events; j++) {
824 if (cpuc->current_idx[j] == idx)
828 if (unlikely(j == cpuc->n_events)) {
829 /* This can occur if the event is disabled right on a PMC overflow. */
830 wrperfmon(PERFMON_CMD_ENABLE, cpuc->idx_mask);
834 event = cpuc->event[j];
836 if (unlikely(!event)) {
837 /* This should never occur! */
839 pr_warning("PMI: No event at index %d!\n", idx);
840 wrperfmon(PERFMON_CMD_ENABLE, cpuc->idx_mask);
845 alpha_perf_event_update(event, hwc, idx, alpha_pmu->pmc_max_period[idx]+1);
846 data.period = event->hw.last_period;
848 if (alpha_perf_event_set_period(event, hwc, idx)) {
849 if (perf_event_overflow(event, 1, &data, regs)) {
850 /* Interrupts coming too quickly; "throttle" the
851 * counter, i.e., disable it for a little while.
853 alpha_pmu_stop(event, 0);
856 wrperfmon(PERFMON_CMD_ENABLE, cpuc->idx_mask);
864 * Init call to initialise performance events at kernel startup.
866 void __init init_hw_perf_events(void)
868 pr_info("Performance events: ");
870 if (!supported_cpu()) {
871 pr_cont("No support for your CPU.\n");
875 pr_cont("Supported CPU type!\n");
877 /* Override performance counter IRQ vector */
879 perf_irq = alpha_perf_event_irq_handler;
881 /* And set up PMU specification */
882 alpha_pmu = &ev67_pmu;
884 perf_pmu_register(&pmu);