summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-11-27 06:55:53 +0300
committerIngo Molnar <mingo@elte.hu>2009-11-27 08:22:58 +0300
commit5fa10b28e57f94a90535cfeafe89dcee9f47d540 (patch)
tree951cf12a3b5b3a37546b4f6dd2994bebdac19dc0 /include
parentb2e74a265ded1a185f762ebaab967e9e0d008dd8 (diff)
downloadlinux-5fa10b28e57f94a90535cfeafe89dcee9f47d540.tar.xz
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 {
#ifdef CONFIG_HAVE_HW_BREAKPOINT
+/* As it's for in-kernel or ptrace use, we want it to be pinned */
+#define DEFINE_BREAKPOINT_ATTR(name) \
+struct perf_event_attr name = { \
+ .type = PERF_TYPE_BREAKPOINT, \
+ .size = sizeof(name), \
+ .pinned = 1, \
+};
+
static inline unsigned long hw_breakpoint_addr(struct perf_event *bp)
{
return bp->attr.bp_addr;
@@ -36,22 +44,16 @@ static inline int hw_breakpoint_len(struct perf_event *bp)
}
extern struct perf_event *
-register_user_hw_breakpoint(unsigned long addr,
- int len,
- int type,
+register_user_hw_breakpoint(struct perf_event_attr *attr,
perf_callback_t triggered,
- struct task_struct *tsk,
- bool active);
+ struct task_struct *tsk);
/* FIXME: only change from the attr, and don't unregister */
extern struct perf_event *
modify_user_hw_breakpoint(struct perf_event *bp,
- unsigned long addr,
- int len,
- int type,
+ struct perf_event_attr *attr,
perf_callback_t triggered,
- struct task_struct *tsk,
- bool active);
+ struct task_struct *tsk);
/*
* 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)
#else /* !CONFIG_HAVE_HW_BREAKPOINT */
static inline struct perf_event *
-register_user_hw_breakpoint(unsigned long addr,
- int len,
- int type,
+register_user_hw_breakpoint(struct perf_event_attr *attr,
perf_callback_t triggered,
- struct task_struct *tsk,
- bool active) { return NULL; }
+ struct task_struct *tsk) { return NULL; }
static inline struct perf_event *
modify_user_hw_breakpoint(struct perf_event *bp,
- unsigned long addr,
- int len,
- int type,
+ struct perf_event_attr *attr,
perf_callback_t triggered,
- struct task_struct *tsk,
- bool active) { return NULL; }
+ struct task_struct *tsk) { return NULL; }
static inline struct perf_event *
register_wide_hw_breakpoint_cpu(unsigned long addr,
int len,