diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-11-26 22:55:54 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-27 00:22:59 -0500 |
commit | dd1853c3f493f6d22d9e5390b192a07b73d2ac0a (patch) | |
tree | af87226bcdc254ce2ab656530263e61f6552322b /include/linux/hw_breakpoint.h | |
parent | 5fa10b28e57f94a90535cfeafe89dcee9f47d540 (diff) |
hw-breakpoints: Use struct perf_event_attr to define kernel breakpoints
Kernel 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
architectures 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-2-git-send-regression-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/hw_breakpoint.h')
-rw-r--r-- | include/linux/hw_breakpoint.h | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h index 5da472e434b7..a03daed08c59 100644 --- a/include/linux/hw_breakpoint.h +++ b/include/linux/hw_breakpoint.h | |||
@@ -28,6 +28,13 @@ struct perf_event_attr name = { \ | |||
28 | .pinned = 1, \ | 28 | .pinned = 1, \ |
29 | }; | 29 | }; |
30 | 30 | ||
31 | static inline void hw_breakpoint_init(struct perf_event_attr *attr) | ||
32 | { | ||
33 | attr->type = PERF_TYPE_BREAKPOINT; | ||
34 | attr->size = sizeof(*attr); | ||
35 | attr->pinned = 1; | ||
36 | } | ||
37 | |||
31 | static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) | 38 | static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) |
32 | { | 39 | { |
33 | return bp->attr.bp_addr; | 40 | return bp->attr.bp_addr; |
@@ -59,19 +66,13 @@ modify_user_hw_breakpoint(struct perf_event *bp, | |||
59 | * Kernel breakpoints are not associated with any particular thread. | 66 | * Kernel breakpoints are not associated with any particular thread. |
60 | */ | 67 | */ |
61 | extern struct perf_event * | 68 | extern struct perf_event * |
62 | register_wide_hw_breakpoint_cpu(unsigned long addr, | 69 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, |
63 | int len, | ||
64 | int type, | ||
65 | perf_callback_t triggered, | 70 | perf_callback_t triggered, |
66 | int cpu, | 71 | int cpu); |
67 | bool active); | ||
68 | 72 | ||
69 | extern struct perf_event ** | 73 | extern struct perf_event ** |
70 | register_wide_hw_breakpoint(unsigned long addr, | 74 | register_wide_hw_breakpoint(struct perf_event_attr *attr, |
71 | int len, | 75 | perf_callback_t triggered); |
72 | int type, | ||
73 | perf_callback_t triggered, | ||
74 | bool active); | ||
75 | 76 | ||
76 | extern int register_perf_hw_breakpoint(struct perf_event *bp); | 77 | extern int register_perf_hw_breakpoint(struct perf_event *bp); |
77 | extern int __register_perf_hw_breakpoint(struct perf_event *bp); | 78 | extern int __register_perf_hw_breakpoint(struct perf_event *bp); |
@@ -100,18 +101,12 @@ modify_user_hw_breakpoint(struct perf_event *bp, | |||
100 | perf_callback_t triggered, | 101 | perf_callback_t triggered, |
101 | struct task_struct *tsk) { return NULL; } | 102 | struct task_struct *tsk) { return NULL; } |
102 | static inline struct perf_event * | 103 | static inline struct perf_event * |
103 | register_wide_hw_breakpoint_cpu(unsigned long addr, | 104 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, |
104 | int len, | ||
105 | int type, | ||
106 | perf_callback_t triggered, | 105 | perf_callback_t triggered, |
107 | int cpu, | 106 | int cpu) { return NULL; } |
108 | bool active) { return NULL; } | ||
109 | static inline struct perf_event ** | 107 | static inline struct perf_event ** |
110 | register_wide_hw_breakpoint(unsigned long addr, | 108 | register_wide_hw_breakpoint(struct perf_event_attr *attr, |
111 | int len, | 109 | perf_callback_t triggered) { return NULL; } |
112 | int type, | ||
113 | perf_callback_t triggered, | ||
114 | bool active) { return NULL; } | ||
115 | static inline int | 110 | static inline int |
116 | register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } | 111 | register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } |
117 | static inline int | 112 | static inline int |