aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-11-26 22:55:53 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-27 00:22:58 -0500
commit5fa10b28e57f94a90535cfeafe89dcee9f47d540 (patch)
tree951cf12a3b5b3a37546b4f6dd2994bebdac19dc0 /include
parentb2e74a265ded1a185f762ebaab967e9e0d008dd8 (diff)
hw-breakpoints: Use struct perf_event_attr to define user breakpoints
In-kernel user breakpoints are created using functions in which we pass breakpoint parameters as individual variables: address, length and type. Although it fits well for x86, this just does not scale across archictectures that may support this api later as these may have more or different needs. Pass in a perf_event_attr structure instead because it is meant to evolve as much as possible into a generic hardware breakpoint parameter structure. Reported-by: K.Prasad <prasad@linux.vnet.ibm.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <1259294154-5197-1-git-send-regression-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r--include/linux/hw_breakpoint.h36
1 files changed, 16 insertions, 20 deletions
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index c9f7f7c7b0e0..5da472e434b7 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -20,6 +20,14 @@ enum {
20 20
21#ifdef CONFIG_HAVE_HW_BREAKPOINT 21#ifdef CONFIG_HAVE_HW_BREAKPOINT
22 22
23/* As it's for in-kernel or ptrace use, we want it to be pinned */
24#define DEFINE_BREAKPOINT_ATTR(name) \
25struct perf_event_attr name = { \
26 .type = PERF_TYPE_BREAKPOINT, \
27 .size = sizeof(name), \
28 .pinned = 1, \
29};
30
23static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) 31static inline unsigned long hw_breakpoint_addr(struct perf_event *bp)
24{ 32{
25 return bp->attr.bp_addr; 33 return bp->attr.bp_addr;
@@ -36,22 +44,16 @@ static inline int hw_breakpoint_len(struct perf_event *bp)
36} 44}
37 45
38extern struct perf_event * 46extern struct perf_event *
39register_user_hw_breakpoint(unsigned long addr, 47register_user_hw_breakpoint(struct perf_event_attr *attr,
40 int len,
41 int type,
42 perf_callback_t triggered, 48 perf_callback_t triggered,
43 struct task_struct *tsk, 49 struct task_struct *tsk);
44 bool active);
45 50
46/* FIXME: only change from the attr, and don't unregister */ 51/* FIXME: only change from the attr, and don't unregister */
47extern struct perf_event * 52extern struct perf_event *
48modify_user_hw_breakpoint(struct perf_event *bp, 53modify_user_hw_breakpoint(struct perf_event *bp,
49 unsigned long addr, 54 struct perf_event_attr *attr,
50 int len,
51 int type,
52 perf_callback_t triggered, 55 perf_callback_t triggered,
53 struct task_struct *tsk, 56 struct task_struct *tsk);
54 bool active);
55 57
56/* 58/*
57 * Kernel breakpoints are not associated with any particular thread. 59 * Kernel breakpoints are not associated with any particular thread.
@@ -89,20 +91,14 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
89#else /* !CONFIG_HAVE_HW_BREAKPOINT */ 91#else /* !CONFIG_HAVE_HW_BREAKPOINT */
90 92
91static inline struct perf_event * 93static inline struct perf_event *
92register_user_hw_breakpoint(unsigned long addr, 94register_user_hw_breakpoint(struct perf_event_attr *attr,
93 int len,
94 int type,
95 perf_callback_t triggered, 95 perf_callback_t triggered,
96 struct task_struct *tsk, 96 struct task_struct *tsk) { return NULL; }
97 bool active) { return NULL; }
98static inline struct perf_event * 97static inline struct perf_event *
99modify_user_hw_breakpoint(struct perf_event *bp, 98modify_user_hw_breakpoint(struct perf_event *bp,
100 unsigned long addr, 99 struct perf_event_attr *attr,
101 int len,
102 int type,
103 perf_callback_t triggered, 100 perf_callback_t triggered,
104 struct task_struct *tsk, 101 struct task_struct *tsk) { return NULL; }
105 bool active) { return NULL; }
106static inline struct perf_event * 102static inline struct perf_event *
107register_wide_hw_breakpoint_cpu(unsigned long addr, 103register_wide_hw_breakpoint_cpu(unsigned long addr,
108 int len, 104 int len,