diff options
author | Avi Kivity <avi@redhat.com> | 2011-06-29 11:42:35 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-07-01 05:06:38 -0400 |
commit | 4dc0da86967d5463708631d02a70cfed5b104884 (patch) | |
tree | e09071a62f2457b710ff69df3be1bff39340a4c6 /include/linux/hw_breakpoint.h | |
parent | 89d6c0b5bdbb1927775584dcf532d98b3efe1477 (diff) |
perf: Add context field to perf_event
The perf_event overflow handler does not receive any caller-derived
argument, so many callers need to resort to looking up the perf_event
in their local data structure. This is ugly and doesn't scale if a
single callback services many perf_events.
Fix by adding a context parameter to perf_event_create_kernel_counter()
(and derived hardware breakpoints APIs) and storing it in the perf_event.
The field can be accessed from the callback as event->overflow_handler_context.
All callers are updated.
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1309362157-6596-2-git-send-email-avi@redhat.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 | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h index d1e55fed2c7d..6ae9c631a1be 100644 --- a/include/linux/hw_breakpoint.h +++ b/include/linux/hw_breakpoint.h | |||
@@ -73,6 +73,7 @@ static inline unsigned long hw_breakpoint_len(struct perf_event *bp) | |||
73 | extern struct perf_event * | 73 | extern struct perf_event * |
74 | register_user_hw_breakpoint(struct perf_event_attr *attr, | 74 | register_user_hw_breakpoint(struct perf_event_attr *attr, |
75 | perf_overflow_handler_t triggered, | 75 | perf_overflow_handler_t triggered, |
76 | void *context, | ||
76 | struct task_struct *tsk); | 77 | struct task_struct *tsk); |
77 | 78 | ||
78 | /* FIXME: only change from the attr, and don't unregister */ | 79 | /* FIXME: only change from the attr, and don't unregister */ |
@@ -85,11 +86,13 @@ modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr); | |||
85 | extern struct perf_event * | 86 | extern struct perf_event * |
86 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, | 87 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, |
87 | perf_overflow_handler_t triggered, | 88 | perf_overflow_handler_t triggered, |
89 | void *context, | ||
88 | int cpu); | 90 | int cpu); |
89 | 91 | ||
90 | extern struct perf_event * __percpu * | 92 | extern struct perf_event * __percpu * |
91 | register_wide_hw_breakpoint(struct perf_event_attr *attr, | 93 | register_wide_hw_breakpoint(struct perf_event_attr *attr, |
92 | perf_overflow_handler_t triggered); | 94 | perf_overflow_handler_t triggered, |
95 | void *context); | ||
93 | 96 | ||
94 | extern int register_perf_hw_breakpoint(struct perf_event *bp); | 97 | extern int register_perf_hw_breakpoint(struct perf_event *bp); |
95 | extern int __register_perf_hw_breakpoint(struct perf_event *bp); | 98 | extern int __register_perf_hw_breakpoint(struct perf_event *bp); |
@@ -115,6 +118,7 @@ static inline int __init init_hw_breakpoint(void) { return 0; } | |||
115 | static inline struct perf_event * | 118 | static inline struct perf_event * |
116 | register_user_hw_breakpoint(struct perf_event_attr *attr, | 119 | register_user_hw_breakpoint(struct perf_event_attr *attr, |
117 | perf_overflow_handler_t triggered, | 120 | perf_overflow_handler_t triggered, |
121 | void *context, | ||
118 | struct task_struct *tsk) { return NULL; } | 122 | struct task_struct *tsk) { return NULL; } |
119 | static inline int | 123 | static inline int |
120 | modify_user_hw_breakpoint(struct perf_event *bp, | 124 | modify_user_hw_breakpoint(struct perf_event *bp, |
@@ -122,10 +126,12 @@ modify_user_hw_breakpoint(struct perf_event *bp, | |||
122 | static inline struct perf_event * | 126 | static inline struct perf_event * |
123 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, | 127 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, |
124 | perf_overflow_handler_t triggered, | 128 | perf_overflow_handler_t triggered, |
129 | void *context, | ||
125 | int cpu) { return NULL; } | 130 | int cpu) { return NULL; } |
126 | static inline struct perf_event * __percpu * | 131 | static inline struct perf_event * __percpu * |
127 | register_wide_hw_breakpoint(struct perf_event_attr *attr, | 132 | register_wide_hw_breakpoint(struct perf_event_attr *attr, |
128 | perf_overflow_handler_t triggered) { return NULL; } | 133 | perf_overflow_handler_t triggered, |
134 | void *context) { return NULL; } | ||
129 | static inline int | 135 | static inline int |
130 | register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } | 136 | register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } |
131 | static inline int | 137 | static inline int |