diff options
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 58 |
1 files changed, 52 insertions, 6 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 9e7012689a84..c66b34f75eea 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -31,6 +31,7 @@ enum perf_type_id { | |||
31 | PERF_TYPE_TRACEPOINT = 2, | 31 | PERF_TYPE_TRACEPOINT = 2, |
32 | PERF_TYPE_HW_CACHE = 3, | 32 | PERF_TYPE_HW_CACHE = 3, |
33 | PERF_TYPE_RAW = 4, | 33 | PERF_TYPE_RAW = 4, |
34 | PERF_TYPE_BREAKPOINT = 5, | ||
34 | 35 | ||
35 | PERF_TYPE_MAX, /* non-ABI */ | 36 | PERF_TYPE_MAX, /* non-ABI */ |
36 | }; | 37 | }; |
@@ -102,6 +103,8 @@ enum perf_sw_ids { | |||
102 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, | 103 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, |
103 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, | 104 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, |
104 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, | 105 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, |
106 | PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, | ||
107 | PERF_COUNT_SW_EMULATION_FAULTS = 8, | ||
105 | 108 | ||
106 | PERF_COUNT_SW_MAX, /* non-ABI */ | 109 | PERF_COUNT_SW_MAX, /* non-ABI */ |
107 | }; | 110 | }; |
@@ -207,9 +210,12 @@ struct perf_event_attr { | |||
207 | __u32 wakeup_events; /* wakeup every n events */ | 210 | __u32 wakeup_events; /* wakeup every n events */ |
208 | __u32 wakeup_watermark; /* bytes before wakeup */ | 211 | __u32 wakeup_watermark; /* bytes before wakeup */ |
209 | }; | 212 | }; |
213 | |||
210 | __u32 __reserved_2; | 214 | __u32 __reserved_2; |
211 | 215 | ||
212 | __u64 __reserved_3; | 216 | __u64 bp_addr; |
217 | __u32 bp_type; | ||
218 | __u32 bp_len; | ||
213 | }; | 219 | }; |
214 | 220 | ||
215 | /* | 221 | /* |
@@ -219,8 +225,9 @@ struct perf_event_attr { | |||
219 | #define PERF_EVENT_IOC_DISABLE _IO ('$', 1) | 225 | #define PERF_EVENT_IOC_DISABLE _IO ('$', 1) |
220 | #define PERF_EVENT_IOC_REFRESH _IO ('$', 2) | 226 | #define PERF_EVENT_IOC_REFRESH _IO ('$', 2) |
221 | #define PERF_EVENT_IOC_RESET _IO ('$', 3) | 227 | #define PERF_EVENT_IOC_RESET _IO ('$', 3) |
222 | #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, u64) | 228 | #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) |
223 | #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) | 229 | #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) |
230 | #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) | ||
224 | 231 | ||
225 | enum perf_event_ioc_flags { | 232 | enum perf_event_ioc_flags { |
226 | PERF_IOC_FLAG_GROUP = 1U << 0, | 233 | PERF_IOC_FLAG_GROUP = 1U << 0, |
@@ -434,6 +441,10 @@ enum perf_callchain_context { | |||
434 | # include <asm/perf_event.h> | 441 | # include <asm/perf_event.h> |
435 | #endif | 442 | #endif |
436 | 443 | ||
444 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
445 | #include <asm/hw_breakpoint.h> | ||
446 | #endif | ||
447 | |||
437 | #include <linux/list.h> | 448 | #include <linux/list.h> |
438 | #include <linux/mutex.h> | 449 | #include <linux/mutex.h> |
439 | #include <linux/rculist.h> | 450 | #include <linux/rculist.h> |
@@ -475,6 +486,11 @@ struct hw_perf_event { | |||
475 | s64 remaining; | 486 | s64 remaining; |
476 | struct hrtimer hrtimer; | 487 | struct hrtimer hrtimer; |
477 | }; | 488 | }; |
489 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
490 | union { /* breakpoint */ | ||
491 | struct arch_hw_breakpoint info; | ||
492 | }; | ||
493 | #endif | ||
478 | }; | 494 | }; |
479 | atomic64_t prev_count; | 495 | atomic64_t prev_count; |
480 | u64 sample_period; | 496 | u64 sample_period; |
@@ -543,6 +559,12 @@ struct perf_pending_entry { | |||
543 | void (*func)(struct perf_pending_entry *); | 559 | void (*func)(struct perf_pending_entry *); |
544 | }; | 560 | }; |
545 | 561 | ||
562 | struct perf_sample_data; | ||
563 | |||
564 | typedef void (*perf_overflow_handler_t)(struct perf_event *, int, | ||
565 | struct perf_sample_data *, | ||
566 | struct pt_regs *regs); | ||
567 | |||
546 | /** | 568 | /** |
547 | * struct perf_event - performance event kernel representation: | 569 | * struct perf_event - performance event kernel representation: |
548 | */ | 570 | */ |
@@ -585,7 +607,7 @@ struct perf_event { | |||
585 | u64 tstamp_running; | 607 | u64 tstamp_running; |
586 | u64 tstamp_stopped; | 608 | u64 tstamp_stopped; |
587 | 609 | ||
588 | struct perf_event_attr attr; | 610 | struct perf_event_attr attr; |
589 | struct hw_perf_event hw; | 611 | struct hw_perf_event hw; |
590 | 612 | ||
591 | struct perf_event_context *ctx; | 613 | struct perf_event_context *ctx; |
@@ -633,7 +655,14 @@ struct perf_event { | |||
633 | 655 | ||
634 | struct pid_namespace *ns; | 656 | struct pid_namespace *ns; |
635 | u64 id; | 657 | u64 id; |
658 | |||
659 | perf_overflow_handler_t overflow_handler; | ||
660 | |||
661 | #ifdef CONFIG_EVENT_PROFILE | ||
662 | struct event_filter *filter; | ||
636 | #endif | 663 | #endif |
664 | |||
665 | #endif /* CONFIG_PERF_EVENTS */ | ||
637 | }; | 666 | }; |
638 | 667 | ||
639 | /** | 668 | /** |
@@ -646,7 +675,7 @@ struct perf_event_context { | |||
646 | * Protect the states of the events in the list, | 675 | * Protect the states of the events in the list, |
647 | * nr_active, and the list: | 676 | * nr_active, and the list: |
648 | */ | 677 | */ |
649 | spinlock_t lock; | 678 | raw_spinlock_t lock; |
650 | /* | 679 | /* |
651 | * Protect the list of events. Locking either mutex or lock | 680 | * Protect the list of events. Locking either mutex or lock |
652 | * is sufficient to ensure the list doesn't change; to change | 681 | * is sufficient to ensure the list doesn't change; to change |
@@ -706,7 +735,6 @@ struct perf_output_handle { | |||
706 | int nmi; | 735 | int nmi; |
707 | int sample; | 736 | int sample; |
708 | int locked; | 737 | int locked; |
709 | unsigned long flags; | ||
710 | }; | 738 | }; |
711 | 739 | ||
712 | #ifdef CONFIG_PERF_EVENTS | 740 | #ifdef CONFIG_PERF_EVENTS |
@@ -738,6 +766,14 @@ extern int hw_perf_group_sched_in(struct perf_event *group_leader, | |||
738 | struct perf_cpu_context *cpuctx, | 766 | struct perf_cpu_context *cpuctx, |
739 | struct perf_event_context *ctx, int cpu); | 767 | struct perf_event_context *ctx, int cpu); |
740 | extern void perf_event_update_userpage(struct perf_event *event); | 768 | extern void perf_event_update_userpage(struct perf_event *event); |
769 | extern int perf_event_release_kernel(struct perf_event *event); | ||
770 | extern struct perf_event * | ||
771 | perf_event_create_kernel_counter(struct perf_event_attr *attr, | ||
772 | int cpu, | ||
773 | pid_t pid, | ||
774 | perf_overflow_handler_t callback); | ||
775 | extern u64 perf_event_read_value(struct perf_event *event, | ||
776 | u64 *enabled, u64 *running); | ||
741 | 777 | ||
742 | struct perf_sample_data { | 778 | struct perf_sample_data { |
743 | u64 type; | 779 | u64 type; |
@@ -814,6 +850,7 @@ extern int sysctl_perf_event_sample_rate; | |||
814 | extern void perf_event_init(void); | 850 | extern void perf_event_init(void); |
815 | extern void perf_tp_event(int event_id, u64 addr, u64 count, | 851 | extern void perf_tp_event(int event_id, u64 addr, u64 count, |
816 | void *record, int entry_size); | 852 | void *record, int entry_size); |
853 | extern void perf_bp_event(struct perf_event *event, void *data); | ||
817 | 854 | ||
818 | #ifndef perf_misc_flags | 855 | #ifndef perf_misc_flags |
819 | #define perf_misc_flags(regs) (user_mode(regs) ? PERF_RECORD_MISC_USER : \ | 856 | #define perf_misc_flags(regs) (user_mode(regs) ? PERF_RECORD_MISC_USER : \ |
@@ -827,6 +864,10 @@ extern int perf_output_begin(struct perf_output_handle *handle, | |||
827 | extern void perf_output_end(struct perf_output_handle *handle); | 864 | extern void perf_output_end(struct perf_output_handle *handle); |
828 | extern void perf_output_copy(struct perf_output_handle *handle, | 865 | extern void perf_output_copy(struct perf_output_handle *handle, |
829 | const void *buf, unsigned int len); | 866 | const void *buf, unsigned int len); |
867 | extern int perf_swevent_get_recursion_context(void); | ||
868 | extern void perf_swevent_put_recursion_context(int rctx); | ||
869 | extern void perf_event_enable(struct perf_event *event); | ||
870 | extern void perf_event_disable(struct perf_event *event); | ||
830 | #else | 871 | #else |
831 | static inline void | 872 | static inline void |
832 | perf_event_task_sched_in(struct task_struct *task, int cpu) { } | 873 | perf_event_task_sched_in(struct task_struct *task, int cpu) { } |
@@ -848,12 +889,17 @@ static inline int perf_event_task_enable(void) { return -EINVAL; } | |||
848 | static inline void | 889 | static inline void |
849 | perf_sw_event(u32 event_id, u64 nr, int nmi, | 890 | perf_sw_event(u32 event_id, u64 nr, int nmi, |
850 | struct pt_regs *regs, u64 addr) { } | 891 | struct pt_regs *regs, u64 addr) { } |
892 | static inline void | ||
893 | perf_bp_event(struct perf_event *event, void *data) { } | ||
851 | 894 | ||
852 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } | 895 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } |
853 | static inline void perf_event_comm(struct task_struct *tsk) { } | 896 | static inline void perf_event_comm(struct task_struct *tsk) { } |
854 | static inline void perf_event_fork(struct task_struct *tsk) { } | 897 | static inline void perf_event_fork(struct task_struct *tsk) { } |
855 | static inline void perf_event_init(void) { } | 898 | static inline void perf_event_init(void) { } |
856 | 899 | static inline int perf_swevent_get_recursion_context(void) { return -1; } | |
900 | static inline void perf_swevent_put_recursion_context(int rctx) { } | ||
901 | static inline void perf_event_enable(struct perf_event *event) { } | ||
902 | static inline void perf_event_disable(struct perf_event *event) { } | ||
857 | #endif | 903 | #endif |
858 | 904 | ||
859 | #define perf_output_put(handle, x) \ | 905 | #define perf_output_put(handle, x) \ |