diff options
| -rw-r--r-- | arch/arm/Kconfig | 2 | ||||
| -rw-r--r-- | arch/arm/include/asm/perf_event.h | 31 | ||||
| -rw-r--r-- | arch/arm/mm/fault.c | 7 |
3 files changed, 40 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9e08891062bf..74d1e767f0b7 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -18,6 +18,8 @@ config ARM | |||
| 18 | select HAVE_KRETPROBES if (HAVE_KPROBES) | 18 | select HAVE_KRETPROBES if (HAVE_KPROBES) |
| 19 | select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) | 19 | select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) |
| 20 | select HAVE_GENERIC_DMA_COHERENT | 20 | select HAVE_GENERIC_DMA_COHERENT |
| 21 | select HAVE_PERF_EVENTS | ||
| 22 | select PERF_USE_VMALLOC | ||
| 21 | help | 23 | help |
| 22 | The ARM series is a line of low-power-consumption RISC chip designs | 24 | The ARM series is a line of low-power-consumption RISC chip designs |
| 23 | licensed by ARM Ltd and targeted at embedded applications and | 25 | licensed by ARM Ltd and targeted at embedded applications and |
diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h new file mode 100644 index 000000000000..49e3049aba32 --- /dev/null +++ b/arch/arm/include/asm/perf_event.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/arm/include/asm/perf_event.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 picoChip Designs Ltd, Jamie Iles | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef __ARM_PERF_EVENT_H__ | ||
| 13 | #define __ARM_PERF_EVENT_H__ | ||
| 14 | |||
| 15 | /* | ||
| 16 | * NOP: on *most* (read: all supported) ARM platforms, the performance | ||
| 17 | * counter interrupts are regular interrupts and not an NMI. This | ||
| 18 | * means that when we receive the interrupt we can call | ||
| 19 | * perf_event_do_pending() that handles all of the work with | ||
| 20 | * interrupts enabled. | ||
| 21 | */ | ||
| 22 | static inline void | ||
| 23 | set_perf_event_pending(void) | ||
| 24 | { | ||
| 25 | } | ||
| 26 | |||
| 27 | /* ARM performance counters start from 1 (in the cp15 accesses) so use the | ||
| 28 | * same indexes here for consistency. */ | ||
| 29 | #define PERF_EVENT_INDEX_OFFSET 1 | ||
| 30 | |||
| 31 | #endif /* __ARM_PERF_EVENT_H__ */ | ||
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 10e06801afb3..9d40c341e07e 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/page-flags.h> | 18 | #include <linux/page-flags.h> |
| 19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
| 20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
| 21 | #include <linux/perf_event.h> | ||
| 21 | 22 | ||
| 22 | #include <asm/system.h> | 23 | #include <asm/system.h> |
| 23 | #include <asm/pgtable.h> | 24 | #include <asm/pgtable.h> |
| @@ -302,6 +303,12 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | |||
| 302 | fault = __do_page_fault(mm, addr, fsr, tsk); | 303 | fault = __do_page_fault(mm, addr, fsr, tsk); |
| 303 | up_read(&mm->mmap_sem); | 304 | up_read(&mm->mmap_sem); |
| 304 | 305 | ||
| 306 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, addr); | ||
| 307 | if (fault & VM_FAULT_MAJOR) | ||
| 308 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, regs, addr); | ||
| 309 | else if (fault & VM_FAULT_MINOR) | ||
| 310 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, regs, addr); | ||
| 311 | |||
| 305 | /* | 312 | /* |
| 306 | * Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR | 313 | * Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR |
| 307 | */ | 314 | */ |
