diff options
Diffstat (limited to 'include/linux/perf_event.h')
| -rw-r--r-- | include/linux/perf_event.h | 60 |
1 files changed, 55 insertions, 5 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index bdb41612bfec..599afc4bb67e 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -130,8 +130,10 @@ enum perf_event_sample_format { | |||
| 130 | PERF_SAMPLE_STREAM_ID = 1U << 9, | 130 | PERF_SAMPLE_STREAM_ID = 1U << 9, |
| 131 | PERF_SAMPLE_RAW = 1U << 10, | 131 | PERF_SAMPLE_RAW = 1U << 10, |
| 132 | PERF_SAMPLE_BRANCH_STACK = 1U << 11, | 132 | PERF_SAMPLE_BRANCH_STACK = 1U << 11, |
| 133 | PERF_SAMPLE_REGS_USER = 1U << 12, | ||
| 134 | PERF_SAMPLE_STACK_USER = 1U << 13, | ||
| 133 | 135 | ||
| 134 | PERF_SAMPLE_MAX = 1U << 12, /* non-ABI */ | 136 | PERF_SAMPLE_MAX = 1U << 14, /* non-ABI */ |
| 135 | }; | 137 | }; |
| 136 | 138 | ||
| 137 | /* | 139 | /* |
| @@ -163,6 +165,15 @@ enum perf_branch_sample_type { | |||
| 163 | PERF_SAMPLE_BRANCH_HV) | 165 | PERF_SAMPLE_BRANCH_HV) |
| 164 | 166 | ||
| 165 | /* | 167 | /* |
| 168 | * Values to determine ABI of the registers dump. | ||
| 169 | */ | ||
| 170 | enum perf_sample_regs_abi { | ||
| 171 | PERF_SAMPLE_REGS_ABI_NONE = 0, | ||
| 172 | PERF_SAMPLE_REGS_ABI_32 = 1, | ||
| 173 | PERF_SAMPLE_REGS_ABI_64 = 2, | ||
| 174 | }; | ||
| 175 | |||
| 176 | /* | ||
| 166 | * The format of the data returned by read() on a perf event fd, | 177 | * The format of the data returned by read() on a perf event fd, |
| 167 | * as specified by attr.read_format: | 178 | * as specified by attr.read_format: |
| 168 | * | 179 | * |
| @@ -194,6 +205,8 @@ enum perf_event_read_format { | |||
| 194 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ | 205 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ |
| 195 | #define PERF_ATTR_SIZE_VER1 72 /* add: config2 */ | 206 | #define PERF_ATTR_SIZE_VER1 72 /* add: config2 */ |
| 196 | #define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */ | 207 | #define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */ |
| 208 | #define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */ | ||
| 209 | /* add: sample_stack_user */ | ||
| 197 | 210 | ||
| 198 | /* | 211 | /* |
| 199 | * Hardware event_id to monitor via a performance monitoring event: | 212 | * Hardware event_id to monitor via a performance monitoring event: |
| @@ -255,7 +268,10 @@ struct perf_event_attr { | |||
| 255 | exclude_host : 1, /* don't count in host */ | 268 | exclude_host : 1, /* don't count in host */ |
| 256 | exclude_guest : 1, /* don't count in guest */ | 269 | exclude_guest : 1, /* don't count in guest */ |
| 257 | 270 | ||
| 258 | __reserved_1 : 43; | 271 | exclude_callchain_kernel : 1, /* exclude kernel callchains */ |
| 272 | exclude_callchain_user : 1, /* exclude user callchains */ | ||
| 273 | |||
| 274 | __reserved_1 : 41; | ||
| 259 | 275 | ||
| 260 | union { | 276 | union { |
| 261 | __u32 wakeup_events; /* wakeup every n events */ | 277 | __u32 wakeup_events; /* wakeup every n events */ |
| @@ -271,7 +287,21 @@ struct perf_event_attr { | |||
| 271 | __u64 bp_len; | 287 | __u64 bp_len; |
| 272 | __u64 config2; /* extension of config1 */ | 288 | __u64 config2; /* extension of config1 */ |
| 273 | }; | 289 | }; |
| 274 | __u64 branch_sample_type; /* enum branch_sample_type */ | 290 | __u64 branch_sample_type; /* enum perf_branch_sample_type */ |
| 291 | |||
| 292 | /* | ||
| 293 | * Defines set of user regs to dump on samples. | ||
| 294 | * See asm/perf_regs.h for details. | ||
| 295 | */ | ||
| 296 | __u64 sample_regs_user; | ||
| 297 | |||
| 298 | /* | ||
| 299 | * Defines size of the user stack to dump on samples. | ||
| 300 | */ | ||
| 301 | __u32 sample_stack_user; | ||
| 302 | |||
| 303 | /* Align to u64. */ | ||
| 304 | __u32 __reserved_2; | ||
| 275 | }; | 305 | }; |
| 276 | 306 | ||
| 277 | #define perf_flags(attr) (*(&(attr)->read_format + 1)) | 307 | #define perf_flags(attr) (*(&(attr)->read_format + 1)) |
| @@ -550,6 +580,13 @@ enum perf_event_type { | |||
| 550 | * char data[size];}&& PERF_SAMPLE_RAW | 580 | * char data[size];}&& PERF_SAMPLE_RAW |
| 551 | * | 581 | * |
| 552 | * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK | 582 | * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK |
| 583 | * | ||
| 584 | * { u64 abi; # enum perf_sample_regs_abi | ||
| 585 | * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER | ||
| 586 | * | ||
| 587 | * { u64 size; | ||
| 588 | * char data[size]; | ||
| 589 | * u64 dyn_size; } && PERF_SAMPLE_STACK_USER | ||
| 553 | * }; | 590 | * }; |
| 554 | */ | 591 | */ |
| 555 | PERF_RECORD_SAMPLE = 9, | 592 | PERF_RECORD_SAMPLE = 9, |
| @@ -611,6 +648,7 @@ struct perf_guest_info_callbacks { | |||
| 611 | #include <linux/static_key.h> | 648 | #include <linux/static_key.h> |
| 612 | #include <linux/atomic.h> | 649 | #include <linux/atomic.h> |
| 613 | #include <linux/sysfs.h> | 650 | #include <linux/sysfs.h> |
| 651 | #include <linux/perf_regs.h> | ||
| 614 | #include <asm/local.h> | 652 | #include <asm/local.h> |
| 615 | 653 | ||
| 616 | struct perf_callchain_entry { | 654 | struct perf_callchain_entry { |
| @@ -656,6 +694,11 @@ struct perf_branch_stack { | |||
| 656 | struct perf_branch_entry entries[0]; | 694 | struct perf_branch_entry entries[0]; |
| 657 | }; | 695 | }; |
| 658 | 696 | ||
| 697 | struct perf_regs_user { | ||
| 698 | __u64 abi; | ||
| 699 | struct pt_regs *regs; | ||
| 700 | }; | ||
| 701 | |||
| 659 | struct task_struct; | 702 | struct task_struct; |
| 660 | 703 | ||
| 661 | /* | 704 | /* |
| @@ -1135,6 +1178,8 @@ struct perf_sample_data { | |||
| 1135 | struct perf_callchain_entry *callchain; | 1178 | struct perf_callchain_entry *callchain; |
| 1136 | struct perf_raw_record *raw; | 1179 | struct perf_raw_record *raw; |
| 1137 | struct perf_branch_stack *br_stack; | 1180 | struct perf_branch_stack *br_stack; |
| 1181 | struct perf_regs_user regs_user; | ||
| 1182 | u64 stack_user_size; | ||
| 1138 | }; | 1183 | }; |
| 1139 | 1184 | ||
| 1140 | static inline void perf_sample_data_init(struct perf_sample_data *data, | 1185 | static inline void perf_sample_data_init(struct perf_sample_data *data, |
| @@ -1144,7 +1189,10 @@ static inline void perf_sample_data_init(struct perf_sample_data *data, | |||
| 1144 | data->addr = addr; | 1189 | data->addr = addr; |
| 1145 | data->raw = NULL; | 1190 | data->raw = NULL; |
| 1146 | data->br_stack = NULL; | 1191 | data->br_stack = NULL; |
| 1147 | data->period = period; | 1192 | data->period = period; |
| 1193 | data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE; | ||
| 1194 | data->regs_user.regs = NULL; | ||
| 1195 | data->stack_user_size = 0; | ||
| 1148 | } | 1196 | } |
| 1149 | 1197 | ||
| 1150 | extern void perf_output_sample(struct perf_output_handle *handle, | 1198 | extern void perf_output_sample(struct perf_output_handle *handle, |
| @@ -1292,8 +1340,10 @@ static inline bool has_branch_stack(struct perf_event *event) | |||
| 1292 | extern int perf_output_begin(struct perf_output_handle *handle, | 1340 | extern int perf_output_begin(struct perf_output_handle *handle, |
| 1293 | struct perf_event *event, unsigned int size); | 1341 | struct perf_event *event, unsigned int size); |
| 1294 | extern void perf_output_end(struct perf_output_handle *handle); | 1342 | extern void perf_output_end(struct perf_output_handle *handle); |
| 1295 | extern void perf_output_copy(struct perf_output_handle *handle, | 1343 | extern unsigned int perf_output_copy(struct perf_output_handle *handle, |
| 1296 | const void *buf, unsigned int len); | 1344 | const void *buf, unsigned int len); |
| 1345 | extern unsigned int perf_output_skip(struct perf_output_handle *handle, | ||
| 1346 | unsigned int len); | ||
| 1297 | extern int perf_swevent_get_recursion_context(void); | 1347 | extern int perf_swevent_get_recursion_context(void); |
| 1298 | extern void perf_swevent_put_recursion_context(int rctx); | 1348 | extern void perf_swevent_put_recursion_context(int rctx); |
| 1299 | extern void perf_event_enable(struct perf_event *event); | 1349 | extern void perf_event_enable(struct perf_event *event); |
