aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/perf_event.h
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-08-07 09:20:40 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-10 11:17:58 -0400
commitc5ebcedb566ef17bda7b02686e0d658a7bb42ee7 (patch)
tree46619f5d62f0fbe9a6389ce20fd5ed92c25755e3 /include/linux/perf_event.h
parent5685e0ff45f5df67e79e9b052b6ffd501ff38c11 (diff)
perf: Add ability to attach user stack dump to sample
Introducing PERF_SAMPLE_STACK_USER sample type bit to trigger the dump of the user level stack on sample. The size of the dump is specified by sample_stack_user value. Being able to dump parts of the user stack, starting from the stack pointer, will be useful to make a post mortem dwarf CFI based stack unwinding. Added HAVE_PERF_USER_STACK_DUMP config option to determine if the architecture provides user stack dump on perf event samples. This needs access to the user stack pointer which is not unified across architectures. Enabling this for x86 architecture. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Original-patch-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: "Frank Ch. Eigler" <fche@redhat.com> Cc: Arun Sharma <asharma@fb.com> Cc: Benjamin Redelings <benjamin.redelings@nescent.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Frank Ch. Eigler <fche@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Robert Richter <robert.richter@amd.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Ulrich Drepper <drepper@gmail.com> Link: http://lkml.kernel.org/r/1344345647-11536-6-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r--include/linux/perf_event.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 8a73f75beb16..d1d25f6a5e24 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -131,8 +131,9 @@ enum perf_event_sample_format {
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, 133 PERF_SAMPLE_REGS_USER = 1U << 12,
134 PERF_SAMPLE_STACK_USER = 1U << 13,
134 135
135 PERF_SAMPLE_MAX = 1U << 13, /* non-ABI */ 136 PERF_SAMPLE_MAX = 1U << 14, /* non-ABI */
136}; 137};
137 138
138/* 139/*
@@ -205,6 +206,7 @@ enum perf_event_read_format {
205#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */ 206#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */
206#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */ 207#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */
207#define PERF_ATTR_SIZE_VER3 88 /* add: sample_regs_user */ 208#define PERF_ATTR_SIZE_VER3 88 /* add: sample_regs_user */
209#define PERF_ATTR_SIZE_VER4 96 /* add: sample_stack_user */
208 210
209/* 211/*
210 * Hardware event_id to monitor via a performance monitoring event: 212 * Hardware event_id to monitor via a performance monitoring event:
@@ -289,6 +291,14 @@ struct perf_event_attr {
289 * See asm/perf_regs.h for details. 291 * See asm/perf_regs.h for details.
290 */ 292 */
291 __u64 sample_regs_user; 293 __u64 sample_regs_user;
294
295 /*
296 * Defines size of the user stack to dump on samples.
297 */
298 __u32 sample_stack_user;
299
300 /* Align to u64. */
301 __u32 __reserved_2;
292}; 302};
293 303
294/* 304/*
@@ -568,6 +578,10 @@ enum perf_event_type {
568 * 578 *
569 * { u64 abi; # enum perf_sample_regs_abi 579 * { u64 abi; # enum perf_sample_regs_abi
570 * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER 580 * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER
581 *
582 * { u64 size;
583 * char data[size];
584 * u64 dyn_size; } && PERF_SAMPLE_STACK_USER
571 * }; 585 * };
572 */ 586 */
573 PERF_RECORD_SAMPLE = 9, 587 PERF_RECORD_SAMPLE = 9,
@@ -1160,6 +1174,7 @@ struct perf_sample_data {
1160 struct perf_raw_record *raw; 1174 struct perf_raw_record *raw;
1161 struct perf_branch_stack *br_stack; 1175 struct perf_branch_stack *br_stack;
1162 struct perf_regs_user regs_user; 1176 struct perf_regs_user regs_user;
1177 u64 stack_user_size;
1163}; 1178};
1164 1179
1165static inline void perf_sample_data_init(struct perf_sample_data *data, 1180static inline void perf_sample_data_init(struct perf_sample_data *data,
@@ -1172,6 +1187,7 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
1172 data->period = period; 1187 data->period = period;
1173 data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE; 1188 data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE;
1174 data->regs_user.regs = NULL; 1189 data->regs_user.regs = NULL;
1190 data->stack_user_size = 0;
1175} 1191}
1176 1192
1177extern void perf_output_sample(struct perf_output_handle *handle, 1193extern void perf_output_sample(struct perf_output_handle *handle,