diff options
Diffstat (limited to 'include/linux/perf_event.h')
| -rw-r--r-- | include/linux/perf_event.h | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index f463a46424e2..866e85c5eb94 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -48,6 +48,7 @@ struct perf_guest_info_callbacks { | |||
| 48 | #include <linux/cpu.h> | 48 | #include <linux/cpu.h> |
| 49 | #include <linux/irq_work.h> | 49 | #include <linux/irq_work.h> |
| 50 | #include <linux/static_key.h> | 50 | #include <linux/static_key.h> |
| 51 | #include <linux/jump_label_ratelimit.h> | ||
| 51 | #include <linux/atomic.h> | 52 | #include <linux/atomic.h> |
| 52 | #include <linux/sysfs.h> | 53 | #include <linux/sysfs.h> |
| 53 | #include <linux/perf_regs.h> | 54 | #include <linux/perf_regs.h> |
| @@ -64,25 +65,6 @@ struct perf_raw_record { | |||
| 64 | }; | 65 | }; |
| 65 | 66 | ||
| 66 | /* | 67 | /* |
| 67 | * single taken branch record layout: | ||
| 68 | * | ||
| 69 | * from: source instruction (may not always be a branch insn) | ||
| 70 | * to: branch target | ||
| 71 | * mispred: branch target was mispredicted | ||
| 72 | * predicted: branch target was predicted | ||
| 73 | * | ||
| 74 | * support for mispred, predicted is optional. In case it | ||
| 75 | * is not supported mispred = predicted = 0. | ||
| 76 | */ | ||
| 77 | struct perf_branch_entry { | ||
| 78 | __u64 from; | ||
| 79 | __u64 to; | ||
| 80 | __u64 mispred:1, /* target mispredicted */ | ||
| 81 | predicted:1,/* target predicted */ | ||
| 82 | reserved:62; | ||
| 83 | }; | ||
| 84 | |||
| 85 | /* | ||
| 86 | * branch stack layout: | 68 | * branch stack layout: |
| 87 | * nr: number of taken branches stored in entries[] | 69 | * nr: number of taken branches stored in entries[] |
| 88 | * | 70 | * |
| @@ -113,6 +95,8 @@ struct hw_perf_event_extra { | |||
| 113 | int idx; /* index in shared_regs->regs[] */ | 95 | int idx; /* index in shared_regs->regs[] */ |
| 114 | }; | 96 | }; |
| 115 | 97 | ||
| 98 | struct event_constraint; | ||
| 99 | |||
| 116 | /** | 100 | /** |
| 117 | * struct hw_perf_event - performance event hardware details: | 101 | * struct hw_perf_event - performance event hardware details: |
| 118 | */ | 102 | */ |
| @@ -131,6 +115,8 @@ struct hw_perf_event { | |||
| 131 | 115 | ||
| 132 | struct hw_perf_event_extra extra_reg; | 116 | struct hw_perf_event_extra extra_reg; |
| 133 | struct hw_perf_event_extra branch_reg; | 117 | struct hw_perf_event_extra branch_reg; |
| 118 | |||
| 119 | struct event_constraint *constraint; | ||
| 134 | }; | 120 | }; |
| 135 | struct { /* software */ | 121 | struct { /* software */ |
| 136 | struct hrtimer hrtimer; | 122 | struct hrtimer hrtimer; |
| @@ -188,12 +174,13 @@ struct pmu { | |||
| 188 | 174 | ||
| 189 | struct device *dev; | 175 | struct device *dev; |
| 190 | const struct attribute_group **attr_groups; | 176 | const struct attribute_group **attr_groups; |
| 191 | char *name; | 177 | const char *name; |
| 192 | int type; | 178 | int type; |
| 193 | 179 | ||
| 194 | int * __percpu pmu_disable_count; | 180 | int * __percpu pmu_disable_count; |
| 195 | struct perf_cpu_context * __percpu pmu_cpu_context; | 181 | struct perf_cpu_context * __percpu pmu_cpu_context; |
| 196 | int task_ctx_nr; | 182 | int task_ctx_nr; |
| 183 | int hrtimer_interval_ms; | ||
| 197 | 184 | ||
| 198 | /* | 185 | /* |
| 199 | * Fully disable/enable this PMU, can be used to protect from the PMI | 186 | * Fully disable/enable this PMU, can be used to protect from the PMI |
| @@ -389,8 +376,7 @@ struct perf_event { | |||
| 389 | /* mmap bits */ | 376 | /* mmap bits */ |
| 390 | struct mutex mmap_mutex; | 377 | struct mutex mmap_mutex; |
| 391 | atomic_t mmap_count; | 378 | atomic_t mmap_count; |
| 392 | int mmap_locked; | 379 | |
| 393 | struct user_struct *mmap_user; | ||
| 394 | struct ring_buffer *rb; | 380 | struct ring_buffer *rb; |
| 395 | struct list_head rb_entry; | 381 | struct list_head rb_entry; |
| 396 | 382 | ||
| @@ -501,8 +487,9 @@ struct perf_cpu_context { | |||
| 501 | struct perf_event_context *task_ctx; | 487 | struct perf_event_context *task_ctx; |
| 502 | int active_oncpu; | 488 | int active_oncpu; |
| 503 | int exclusive; | 489 | int exclusive; |
| 490 | struct hrtimer hrtimer; | ||
| 491 | ktime_t hrtimer_interval; | ||
| 504 | struct list_head rotation_list; | 492 | struct list_head rotation_list; |
| 505 | int jiffies_interval; | ||
| 506 | struct pmu *unique_pmu; | 493 | struct pmu *unique_pmu; |
| 507 | struct perf_cgroup *cgrp; | 494 | struct perf_cgroup *cgrp; |
| 508 | }; | 495 | }; |
| @@ -518,7 +505,7 @@ struct perf_output_handle { | |||
| 518 | 505 | ||
| 519 | #ifdef CONFIG_PERF_EVENTS | 506 | #ifdef CONFIG_PERF_EVENTS |
| 520 | 507 | ||
| 521 | extern int perf_pmu_register(struct pmu *pmu, char *name, int type); | 508 | extern int perf_pmu_register(struct pmu *pmu, const char *name, int type); |
| 522 | extern void perf_pmu_unregister(struct pmu *pmu); | 509 | extern void perf_pmu_unregister(struct pmu *pmu); |
| 523 | 510 | ||
| 524 | extern int perf_num_counters(void); | 511 | extern int perf_num_counters(void); |
| @@ -696,10 +683,17 @@ static inline void perf_callchain_store(struct perf_callchain_entry *entry, u64 | |||
| 696 | extern int sysctl_perf_event_paranoid; | 683 | extern int sysctl_perf_event_paranoid; |
| 697 | extern int sysctl_perf_event_mlock; | 684 | extern int sysctl_perf_event_mlock; |
| 698 | extern int sysctl_perf_event_sample_rate; | 685 | extern int sysctl_perf_event_sample_rate; |
| 686 | extern int sysctl_perf_cpu_time_max_percent; | ||
| 687 | |||
| 688 | extern void perf_sample_event_took(u64 sample_len_ns); | ||
| 699 | 689 | ||
| 700 | extern int perf_proc_update_handler(struct ctl_table *table, int write, | 690 | extern int perf_proc_update_handler(struct ctl_table *table, int write, |
| 701 | void __user *buffer, size_t *lenp, | 691 | void __user *buffer, size_t *lenp, |
| 702 | loff_t *ppos); | 692 | loff_t *ppos); |
| 693 | extern int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write, | ||
| 694 | void __user *buffer, size_t *lenp, | ||
| 695 | loff_t *ppos); | ||
| 696 | |||
| 703 | 697 | ||
| 704 | static inline bool perf_paranoid_tracepoint_raw(void) | 698 | static inline bool perf_paranoid_tracepoint_raw(void) |
| 705 | { | 699 | { |
| @@ -743,6 +737,7 @@ extern unsigned int perf_output_skip(struct perf_output_handle *handle, | |||
| 743 | unsigned int len); | 737 | unsigned int len); |
| 744 | extern int perf_swevent_get_recursion_context(void); | 738 | extern int perf_swevent_get_recursion_context(void); |
| 745 | extern void perf_swevent_put_recursion_context(int rctx); | 739 | extern void perf_swevent_put_recursion_context(int rctx); |
| 740 | extern u64 perf_swevent_set_period(struct perf_event *event); | ||
| 746 | extern void perf_event_enable(struct perf_event *event); | 741 | extern void perf_event_enable(struct perf_event *event); |
| 747 | extern void perf_event_disable(struct perf_event *event); | 742 | extern void perf_event_disable(struct perf_event *event); |
| 748 | extern int __perf_event_disable(void *info); | 743 | extern int __perf_event_disable(void *info); |
| @@ -782,6 +777,7 @@ static inline void perf_event_fork(struct task_struct *tsk) { } | |||
| 782 | static inline void perf_event_init(void) { } | 777 | static inline void perf_event_init(void) { } |
| 783 | static inline int perf_swevent_get_recursion_context(void) { return -1; } | 778 | static inline int perf_swevent_get_recursion_context(void) { return -1; } |
| 784 | static inline void perf_swevent_put_recursion_context(int rctx) { } | 779 | static inline void perf_swevent_put_recursion_context(int rctx) { } |
| 780 | static inline u64 perf_swevent_set_period(struct perf_event *event) { return 0; } | ||
| 785 | static inline void perf_event_enable(struct perf_event *event) { } | 781 | static inline void perf_event_enable(struct perf_event *event) { } |
| 786 | static inline void perf_event_disable(struct perf_event *event) { } | 782 | static inline void perf_event_disable(struct perf_event *event) { } |
| 787 | static inline int __perf_event_disable(void *info) { return -1; } | 783 | static inline int __perf_event_disable(void *info) { return -1; } |
| @@ -803,11 +799,11 @@ static inline void perf_restore_debug_store(void) { } | |||
| 803 | #define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x)) | 799 | #define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x)) |
| 804 | 800 | ||
| 805 | /* | 801 | /* |
| 806 | * This has to have a higher priority than migration_notifier in sched.c. | 802 | * This has to have a higher priority than migration_notifier in sched/core.c. |
| 807 | */ | 803 | */ |
| 808 | #define perf_cpu_notifier(fn) \ | 804 | #define perf_cpu_notifier(fn) \ |
| 809 | do { \ | 805 | do { \ |
| 810 | static struct notifier_block fn##_nb __cpuinitdata = \ | 806 | static struct notifier_block fn##_nb = \ |
| 811 | { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ | 807 | { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ |
| 812 | unsigned long cpu = smp_processor_id(); \ | 808 | unsigned long cpu = smp_processor_id(); \ |
| 813 | unsigned long flags; \ | 809 | unsigned long flags; \ |
