diff options
Diffstat (limited to 'include/linux/perf_event.h')
| -rw-r--r-- | include/linux/perf_event.h | 121 |
1 files changed, 115 insertions, 6 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 2b621982938d..61992cf2e977 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -53,6 +53,7 @@ struct perf_guest_info_callbacks { | |||
| 53 | #include <linux/sysfs.h> | 53 | #include <linux/sysfs.h> |
| 54 | #include <linux/perf_regs.h> | 54 | #include <linux/perf_regs.h> |
| 55 | #include <linux/workqueue.h> | 55 | #include <linux/workqueue.h> |
| 56 | #include <linux/cgroup.h> | ||
| 56 | #include <asm/local.h> | 57 | #include <asm/local.h> |
| 57 | 58 | ||
| 58 | struct perf_callchain_entry { | 59 | struct perf_callchain_entry { |
| @@ -118,10 +119,19 @@ struct hw_perf_event { | |||
| 118 | struct hrtimer hrtimer; | 119 | struct hrtimer hrtimer; |
| 119 | }; | 120 | }; |
| 120 | struct { /* tracepoint */ | 121 | struct { /* tracepoint */ |
| 121 | struct task_struct *tp_target; | ||
| 122 | /* for tp_event->class */ | 122 | /* for tp_event->class */ |
| 123 | struct list_head tp_list; | 123 | struct list_head tp_list; |
| 124 | }; | 124 | }; |
| 125 | struct { /* intel_cqm */ | ||
| 126 | int cqm_state; | ||
| 127 | int cqm_rmid; | ||
| 128 | struct list_head cqm_events_entry; | ||
| 129 | struct list_head cqm_groups_entry; | ||
| 130 | struct list_head cqm_group_entry; | ||
| 131 | }; | ||
| 132 | struct { /* itrace */ | ||
| 133 | int itrace_started; | ||
| 134 | }; | ||
| 125 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | 135 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
| 126 | struct { /* breakpoint */ | 136 | struct { /* breakpoint */ |
| 127 | /* | 137 | /* |
| @@ -129,12 +139,12 @@ struct hw_perf_event { | |||
| 129 | * problem hw_breakpoint has with context | 139 | * problem hw_breakpoint has with context |
| 130 | * creation and event initalization. | 140 | * creation and event initalization. |
| 131 | */ | 141 | */ |
| 132 | struct task_struct *bp_target; | ||
| 133 | struct arch_hw_breakpoint info; | 142 | struct arch_hw_breakpoint info; |
| 134 | struct list_head bp_list; | 143 | struct list_head bp_list; |
| 135 | }; | 144 | }; |
| 136 | #endif | 145 | #endif |
| 137 | }; | 146 | }; |
| 147 | struct task_struct *target; | ||
| 138 | int state; | 148 | int state; |
| 139 | local64_t prev_count; | 149 | local64_t prev_count; |
| 140 | u64 sample_period; | 150 | u64 sample_period; |
| @@ -166,6 +176,11 @@ struct perf_event; | |||
| 166 | * pmu::capabilities flags | 176 | * pmu::capabilities flags |
| 167 | */ | 177 | */ |
| 168 | #define PERF_PMU_CAP_NO_INTERRUPT 0x01 | 178 | #define PERF_PMU_CAP_NO_INTERRUPT 0x01 |
| 179 | #define PERF_PMU_CAP_NO_NMI 0x02 | ||
| 180 | #define PERF_PMU_CAP_AUX_NO_SG 0x04 | ||
| 181 | #define PERF_PMU_CAP_AUX_SW_DOUBLEBUF 0x08 | ||
| 182 | #define PERF_PMU_CAP_EXCLUSIVE 0x10 | ||
| 183 | #define PERF_PMU_CAP_ITRACE 0x20 | ||
| 169 | 184 | ||
| 170 | /** | 185 | /** |
| 171 | * struct pmu - generic performance monitoring unit | 186 | * struct pmu - generic performance monitoring unit |
| @@ -186,6 +201,7 @@ struct pmu { | |||
| 186 | 201 | ||
| 187 | int * __percpu pmu_disable_count; | 202 | int * __percpu pmu_disable_count; |
| 188 | struct perf_cpu_context * __percpu pmu_cpu_context; | 203 | struct perf_cpu_context * __percpu pmu_cpu_context; |
| 204 | atomic_t exclusive_cnt; /* < 0: cpu; > 0: tsk */ | ||
| 189 | int task_ctx_nr; | 205 | int task_ctx_nr; |
| 190 | int hrtimer_interval_ms; | 206 | int hrtimer_interval_ms; |
| 191 | 207 | ||
| @@ -262,9 +278,32 @@ struct pmu { | |||
| 262 | int (*event_idx) (struct perf_event *event); /*optional */ | 278 | int (*event_idx) (struct perf_event *event); /*optional */ |
| 263 | 279 | ||
| 264 | /* | 280 | /* |
| 265 | * flush branch stack on context-switches (needed in cpu-wide mode) | 281 | * context-switches callback |
| 282 | */ | ||
| 283 | void (*sched_task) (struct perf_event_context *ctx, | ||
| 284 | bool sched_in); | ||
| 285 | /* | ||
| 286 | * PMU specific data size | ||
| 287 | */ | ||
| 288 | size_t task_ctx_size; | ||
| 289 | |||
| 290 | |||
| 291 | /* | ||
| 292 | * Return the count value for a counter. | ||
| 293 | */ | ||
| 294 | u64 (*count) (struct perf_event *event); /*optional*/ | ||
| 295 | |||
| 296 | /* | ||
| 297 | * Set up pmu-private data structures for an AUX area | ||
| 266 | */ | 298 | */ |
| 267 | void (*flush_branch_stack) (void); | 299 | void *(*setup_aux) (int cpu, void **pages, |
| 300 | int nr_pages, bool overwrite); | ||
| 301 | /* optional */ | ||
| 302 | |||
| 303 | /* | ||
| 304 | * Free pmu-private AUX data structures | ||
| 305 | */ | ||
| 306 | void (*free_aux) (void *aux); /* optional */ | ||
| 268 | }; | 307 | }; |
| 269 | 308 | ||
| 270 | /** | 309 | /** |
| @@ -300,6 +339,7 @@ struct swevent_hlist { | |||
| 300 | #define PERF_ATTACH_CONTEXT 0x01 | 339 | #define PERF_ATTACH_CONTEXT 0x01 |
| 301 | #define PERF_ATTACH_GROUP 0x02 | 340 | #define PERF_ATTACH_GROUP 0x02 |
| 302 | #define PERF_ATTACH_TASK 0x04 | 341 | #define PERF_ATTACH_TASK 0x04 |
| 342 | #define PERF_ATTACH_TASK_DATA 0x08 | ||
| 303 | 343 | ||
| 304 | struct perf_cgroup; | 344 | struct perf_cgroup; |
| 305 | struct ring_buffer; | 345 | struct ring_buffer; |
| @@ -438,6 +478,7 @@ struct perf_event { | |||
| 438 | struct pid_namespace *ns; | 478 | struct pid_namespace *ns; |
| 439 | u64 id; | 479 | u64 id; |
| 440 | 480 | ||
| 481 | u64 (*clock)(void); | ||
| 441 | perf_overflow_handler_t overflow_handler; | 482 | perf_overflow_handler_t overflow_handler; |
| 442 | void *overflow_handler_context; | 483 | void *overflow_handler_context; |
| 443 | 484 | ||
| @@ -504,7 +545,7 @@ struct perf_event_context { | |||
| 504 | u64 generation; | 545 | u64 generation; |
| 505 | int pin_count; | 546 | int pin_count; |
| 506 | int nr_cgroups; /* cgroup evts */ | 547 | int nr_cgroups; /* cgroup evts */ |
| 507 | int nr_branch_stack; /* branch_stack evt */ | 548 | void *task_ctx_data; /* pmu specific data */ |
| 508 | struct rcu_head rcu_head; | 549 | struct rcu_head rcu_head; |
| 509 | 550 | ||
| 510 | struct delayed_work orphans_remove; | 551 | struct delayed_work orphans_remove; |
| @@ -536,12 +577,52 @@ struct perf_output_handle { | |||
| 536 | struct ring_buffer *rb; | 577 | struct ring_buffer *rb; |
| 537 | unsigned long wakeup; | 578 | unsigned long wakeup; |
| 538 | unsigned long size; | 579 | unsigned long size; |
| 539 | void *addr; | 580 | union { |
| 581 | void *addr; | ||
| 582 | unsigned long head; | ||
| 583 | }; | ||
| 540 | int page; | 584 | int page; |
| 541 | }; | 585 | }; |
| 542 | 586 | ||
| 587 | #ifdef CONFIG_CGROUP_PERF | ||
| 588 | |||
| 589 | /* | ||
| 590 | * perf_cgroup_info keeps track of time_enabled for a cgroup. | ||
| 591 | * This is a per-cpu dynamically allocated data structure. | ||
| 592 | */ | ||
| 593 | struct perf_cgroup_info { | ||
| 594 | u64 time; | ||
| 595 | u64 timestamp; | ||
| 596 | }; | ||
| 597 | |||
| 598 | struct perf_cgroup { | ||
| 599 | struct cgroup_subsys_state css; | ||
| 600 | struct perf_cgroup_info __percpu *info; | ||
| 601 | }; | ||
| 602 | |||
| 603 | /* | ||
| 604 | * Must ensure cgroup is pinned (css_get) before calling | ||
| 605 | * this function. In other words, we cannot call this function | ||
| 606 | * if there is no cgroup event for the current CPU context. | ||
| 607 | */ | ||
| 608 | static inline struct perf_cgroup * | ||
| 609 | perf_cgroup_from_task(struct task_struct *task) | ||
| 610 | { | ||
| 611 | return container_of(task_css(task, perf_event_cgrp_id), | ||
| 612 | struct perf_cgroup, css); | ||
| 613 | } | ||
| 614 | #endif /* CONFIG_CGROUP_PERF */ | ||
| 615 | |||
| 543 | #ifdef CONFIG_PERF_EVENTS | 616 | #ifdef CONFIG_PERF_EVENTS |
| 544 | 617 | ||
| 618 | extern void *perf_aux_output_begin(struct perf_output_handle *handle, | ||
| 619 | struct perf_event *event); | ||
| 620 | extern void perf_aux_output_end(struct perf_output_handle *handle, | ||
| 621 | unsigned long size, bool truncated); | ||
| 622 | extern int perf_aux_output_skip(struct perf_output_handle *handle, | ||
| 623 | unsigned long size); | ||
| 624 | extern void *perf_get_aux(struct perf_output_handle *handle); | ||
| 625 | |||
| 545 | extern int perf_pmu_register(struct pmu *pmu, const char *name, int type); | 626 | extern int perf_pmu_register(struct pmu *pmu, const char *name, int type); |
| 546 | extern void perf_pmu_unregister(struct pmu *pmu); | 627 | extern void perf_pmu_unregister(struct pmu *pmu); |
| 547 | 628 | ||
