aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/perf_regs.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-08-07 09:20:37 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-10 10:31:26 -0400
commit4018994f3d8785275ef0e7391b75c3462c029e56 (patch)
tree661b5c488977c5150eb9d1ac4cec944309c83a16 /arch/x86/kernel/perf_regs.c
parentc5e63197db519bae1c33e41ea0342a50f39e7a93 (diff)
perf: Add ability to attach user level registers dump to sample
Introducing PERF_SAMPLE_REGS_USER sample type bit to trigger the dump of user level registers on sample. Registers we want to dump are specified by sample_regs_user bitmask. Only user level registers are dumped at the moment. Meaning the register values of the user space context as it was before the user entered the kernel for whatever reason (syscall, irq, exception, or a PMI happening in userspace). The layout of the sample_regs_user bitmap is described in asm/perf_regs.h for archs that support register dump. This is going to be useful to bring Dwarf CFI based stack unwinding on top of samples. Original-patch-by: Frederic Weisbecker <fweisbec@gmail.com> [ Dump registers ABI specification. ] Signed-off-by: Jiri Olsa <jolsa@redhat.com> Suggested-by: Stephane Eranian <eranian@google.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-3-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'arch/x86/kernel/perf_regs.c')
-rw-r--r--arch/x86/kernel/perf_regs.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/kernel/perf_regs.c b/arch/x86/kernel/perf_regs.c
index 3d6923528b1c..c5a3e5cfe07f 100644
--- a/arch/x86/kernel/perf_regs.c
+++ b/arch/x86/kernel/perf_regs.c
@@ -1,5 +1,7 @@
1#include <linux/errno.h> 1#include <linux/errno.h>
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <linux/sched.h>
4#include <linux/perf_event.h>
3#include <linux/bug.h> 5#include <linux/bug.h>
4#include <linux/stddef.h> 6#include <linux/stddef.h>
5#include <asm/perf_regs.h> 7#include <asm/perf_regs.h>
@@ -71,6 +73,11 @@ int perf_reg_validate(u64 mask)
71 73
72 return 0; 74 return 0;
73} 75}
76
77u64 perf_reg_abi(struct task_struct *task)
78{
79 return PERF_SAMPLE_REGS_ABI_32;
80}
74#else /* CONFIG_X86_64 */ 81#else /* CONFIG_X86_64 */
75#define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \ 82#define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \
76 (1ULL << PERF_REG_X86_ES) | \ 83 (1ULL << PERF_REG_X86_ES) | \
@@ -87,4 +94,12 @@ int perf_reg_validate(u64 mask)
87 94
88 return 0; 95 return 0;
89} 96}
97
98u64 perf_reg_abi(struct task_struct *task)
99{
100 if (test_tsk_thread_flag(task, TIF_IA32))
101 return PERF_SAMPLE_REGS_ABI_32;
102 else
103 return PERF_SAMPLE_REGS_ABI_64;
104}
90#endif /* CONFIG_X86_32 */ 105#endif /* CONFIG_X86_32 */