diff options
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 83 |
1 files changed, 77 insertions, 6 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index c8e375440403..3fd5c82e0e18 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -203,8 +203,19 @@ struct perf_event_attr { | |||
203 | enable_on_exec : 1, /* next exec enables */ | 203 | enable_on_exec : 1, /* next exec enables */ |
204 | task : 1, /* trace fork/exit */ | 204 | task : 1, /* trace fork/exit */ |
205 | watermark : 1, /* wakeup_watermark */ | 205 | watermark : 1, /* wakeup_watermark */ |
206 | 206 | /* | |
207 | __reserved_1 : 49; | 207 | * precise_ip: |
208 | * | ||
209 | * 0 - SAMPLE_IP can have arbitrary skid | ||
210 | * 1 - SAMPLE_IP must have constant skid | ||
211 | * 2 - SAMPLE_IP requested to have 0 skid | ||
212 | * 3 - SAMPLE_IP must have 0 skid | ||
213 | * | ||
214 | * See also PERF_RECORD_MISC_EXACT_IP | ||
215 | */ | ||
216 | precise_ip : 2, /* skid constraint */ | ||
217 | |||
218 | __reserved_1 : 47; | ||
208 | 219 | ||
209 | union { | 220 | union { |
210 | __u32 wakeup_events; /* wakeup every n events */ | 221 | __u32 wakeup_events; /* wakeup every n events */ |
@@ -287,11 +298,24 @@ struct perf_event_mmap_page { | |||
287 | __u64 data_tail; /* user-space written tail */ | 298 | __u64 data_tail; /* user-space written tail */ |
288 | }; | 299 | }; |
289 | 300 | ||
290 | #define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0) | 301 | #define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0) |
291 | #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) | 302 | #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) |
292 | #define PERF_RECORD_MISC_KERNEL (1 << 0) | 303 | #define PERF_RECORD_MISC_KERNEL (1 << 0) |
293 | #define PERF_RECORD_MISC_USER (2 << 0) | 304 | #define PERF_RECORD_MISC_USER (2 << 0) |
294 | #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) | 305 | #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) |
306 | #define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) | ||
307 | #define PERF_RECORD_MISC_GUEST_USER (5 << 0) | ||
308 | |||
309 | /* | ||
310 | * Indicates that the content of PERF_SAMPLE_IP points to | ||
311 | * the actual instruction that triggered the event. See also | ||
312 | * perf_event_attr::precise_ip. | ||
313 | */ | ||
314 | #define PERF_RECORD_MISC_EXACT_IP (1 << 14) | ||
315 | /* | ||
316 | * Reserve the last bit to indicate some extended misc field | ||
317 | */ | ||
318 | #define PERF_RECORD_MISC_EXT_RESERVED (1 << 15) | ||
295 | 319 | ||
296 | struct perf_event_header { | 320 | struct perf_event_header { |
297 | __u32 type; | 321 | __u32 type; |
@@ -439,6 +463,12 @@ enum perf_callchain_context { | |||
439 | # include <asm/perf_event.h> | 463 | # include <asm/perf_event.h> |
440 | #endif | 464 | #endif |
441 | 465 | ||
466 | struct perf_guest_info_callbacks { | ||
467 | int (*is_in_guest) (void); | ||
468 | int (*is_user_mode) (void); | ||
469 | unsigned long (*get_guest_ip) (void); | ||
470 | }; | ||
471 | |||
442 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | 472 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
443 | #include <asm/hw_breakpoint.h> | 473 | #include <asm/hw_breakpoint.h> |
444 | #endif | 474 | #endif |
@@ -468,6 +498,17 @@ struct perf_raw_record { | |||
468 | void *data; | 498 | void *data; |
469 | }; | 499 | }; |
470 | 500 | ||
501 | struct perf_branch_entry { | ||
502 | __u64 from; | ||
503 | __u64 to; | ||
504 | __u64 flags; | ||
505 | }; | ||
506 | |||
507 | struct perf_branch_stack { | ||
508 | __u64 nr; | ||
509 | struct perf_branch_entry entries[0]; | ||
510 | }; | ||
511 | |||
471 | struct task_struct; | 512 | struct task_struct; |
472 | 513 | ||
473 | /** | 514 | /** |
@@ -506,6 +547,8 @@ struct hw_perf_event { | |||
506 | 547 | ||
507 | struct perf_event; | 548 | struct perf_event; |
508 | 549 | ||
550 | #define PERF_EVENT_TXN_STARTED 1 | ||
551 | |||
509 | /** | 552 | /** |
510 | * struct pmu - generic performance monitoring unit | 553 | * struct pmu - generic performance monitoring unit |
511 | */ | 554 | */ |
@@ -516,6 +559,16 @@ struct pmu { | |||
516 | void (*stop) (struct perf_event *event); | 559 | void (*stop) (struct perf_event *event); |
517 | void (*read) (struct perf_event *event); | 560 | void (*read) (struct perf_event *event); |
518 | void (*unthrottle) (struct perf_event *event); | 561 | void (*unthrottle) (struct perf_event *event); |
562 | |||
563 | /* | ||
564 | * group events scheduling is treated as a transaction, | ||
565 | * add group events as a whole and perform one schedulability test. | ||
566 | * If test fails, roll back the whole group | ||
567 | */ | ||
568 | |||
569 | void (*start_txn) (const struct pmu *pmu); | ||
570 | void (*cancel_txn) (const struct pmu *pmu); | ||
571 | int (*commit_txn) (const struct pmu *pmu); | ||
519 | }; | 572 | }; |
520 | 573 | ||
521 | /** | 574 | /** |
@@ -571,6 +624,14 @@ enum perf_group_flag { | |||
571 | PERF_GROUP_SOFTWARE = 0x1, | 624 | PERF_GROUP_SOFTWARE = 0x1, |
572 | }; | 625 | }; |
573 | 626 | ||
627 | #define SWEVENT_HLIST_BITS 8 | ||
628 | #define SWEVENT_HLIST_SIZE (1 << SWEVENT_HLIST_BITS) | ||
629 | |||
630 | struct swevent_hlist { | ||
631 | struct hlist_head heads[SWEVENT_HLIST_SIZE]; | ||
632 | struct rcu_head rcu_head; | ||
633 | }; | ||
634 | |||
574 | /** | 635 | /** |
575 | * struct perf_event - performance event kernel representation: | 636 | * struct perf_event - performance event kernel representation: |
576 | */ | 637 | */ |
@@ -579,6 +640,7 @@ struct perf_event { | |||
579 | struct list_head group_entry; | 640 | struct list_head group_entry; |
580 | struct list_head event_entry; | 641 | struct list_head event_entry; |
581 | struct list_head sibling_list; | 642 | struct list_head sibling_list; |
643 | struct hlist_node hlist_entry; | ||
582 | int nr_siblings; | 644 | int nr_siblings; |
583 | int group_flags; | 645 | int group_flags; |
584 | struct perf_event *group_leader; | 646 | struct perf_event *group_leader; |
@@ -726,6 +788,9 @@ struct perf_cpu_context { | |||
726 | int active_oncpu; | 788 | int active_oncpu; |
727 | int max_pertask; | 789 | int max_pertask; |
728 | int exclusive; | 790 | int exclusive; |
791 | struct swevent_hlist *swevent_hlist; | ||
792 | struct mutex hlist_mutex; | ||
793 | int hlist_refcount; | ||
729 | 794 | ||
730 | /* | 795 | /* |
731 | * Recursion avoidance: | 796 | * Recursion avoidance: |
@@ -769,9 +834,6 @@ extern void perf_disable(void); | |||
769 | extern void perf_enable(void); | 834 | extern void perf_enable(void); |
770 | extern int perf_event_task_disable(void); | 835 | extern int perf_event_task_disable(void); |
771 | extern int perf_event_task_enable(void); | 836 | extern int perf_event_task_enable(void); |
772 | extern int hw_perf_group_sched_in(struct perf_event *group_leader, | ||
773 | struct perf_cpu_context *cpuctx, | ||
774 | struct perf_event_context *ctx); | ||
775 | extern void perf_event_update_userpage(struct perf_event *event); | 837 | extern void perf_event_update_userpage(struct perf_event *event); |
776 | extern int perf_event_release_kernel(struct perf_event *event); | 838 | extern int perf_event_release_kernel(struct perf_event *event); |
777 | extern struct perf_event * | 839 | extern struct perf_event * |
@@ -902,6 +964,10 @@ static inline void perf_event_mmap(struct vm_area_struct *vma) | |||
902 | __perf_event_mmap(vma); | 964 | __perf_event_mmap(vma); |
903 | } | 965 | } |
904 | 966 | ||
967 | extern struct perf_guest_info_callbacks *perf_guest_cbs; | ||
968 | extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); | ||
969 | extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); | ||
970 | |||
905 | extern void perf_event_comm(struct task_struct *tsk); | 971 | extern void perf_event_comm(struct task_struct *tsk); |
906 | extern void perf_event_fork(struct task_struct *tsk); | 972 | extern void perf_event_fork(struct task_struct *tsk); |
907 | 973 | ||
@@ -971,6 +1037,11 @@ perf_sw_event(u32 event_id, u64 nr, int nmi, | |||
971 | static inline void | 1037 | static inline void |
972 | perf_bp_event(struct perf_event *event, void *data) { } | 1038 | perf_bp_event(struct perf_event *event, void *data) { } |
973 | 1039 | ||
1040 | static inline int perf_register_guest_info_callbacks | ||
1041 | (struct perf_guest_info_callbacks *callbacks) { return 0; } | ||
1042 | static inline int perf_unregister_guest_info_callbacks | ||
1043 | (struct perf_guest_info_callbacks *callbacks) { return 0; } | ||
1044 | |||
974 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } | 1045 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } |
975 | static inline void perf_event_comm(struct task_struct *tsk) { } | 1046 | static inline void perf_event_comm(struct task_struct *tsk) { } |
976 | static inline void perf_event_fork(struct task_struct *tsk) { } | 1047 | static inline void perf_event_fork(struct task_struct *tsk) { } |