hw-breakpoints: Modify breakpoints without unregistering them
[safe/jmp/linux-2.6] / include / linux / perf_event.h
index df4e73e..64a53f7 100644 (file)
@@ -31,6 +31,7 @@ enum perf_type_id {
        PERF_TYPE_TRACEPOINT                    = 2,
        PERF_TYPE_HW_CACHE                      = 3,
        PERF_TYPE_RAW                           = 4,
+       PERF_TYPE_BREAKPOINT                    = 5,
 
        PERF_TYPE_MAX,                          /* non-ABI */
 };
@@ -209,6 +210,15 @@ struct perf_event_attr {
                __u32           wakeup_events;    /* wakeup every n events */
                __u32           wakeup_watermark; /* bytes before wakeup   */
        };
+
+       struct { /* Hardware breakpoint info */
+               __u64           bp_addr;
+               __u32           bp_type;
+               __u32           bp_len;
+               __u64           __bp_reserved_1;
+               __u64           __bp_reserved_2;
+       };
+
        __u32                   __reserved_2;
 
        __u64                   __reserved_3;
@@ -437,6 +447,10 @@ enum perf_callchain_context {
 # include <asm/perf_event.h>
 #endif
 
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#include <asm/hw_breakpoint.h>
+#endif
+
 #include <linux/list.h>
 #include <linux/mutex.h>
 #include <linux/rculist.h>
@@ -478,6 +492,11 @@ struct hw_perf_event {
                        s64             remaining;
                        struct hrtimer  hrtimer;
                };
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+               union { /* breakpoint */
+                       struct arch_hw_breakpoint       info;
+               };
+#endif
        };
        atomic64_t                      prev_count;
        u64                             sample_period;
@@ -546,6 +565,12 @@ struct perf_pending_entry {
        void (*func)(struct perf_pending_entry *);
 };
 
+struct perf_sample_data;
+
+typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
+                                       struct perf_sample_data *,
+                                       struct pt_regs *regs);
+
 /**
  * struct perf_event - performance event kernel representation:
  */
@@ -588,7 +613,7 @@ struct perf_event {
        u64                             tstamp_running;
        u64                             tstamp_stopped;
 
-       struct perf_event_attr  attr;
+       struct perf_event_attr          attr;
        struct hw_perf_event            hw;
 
        struct perf_event_context       *ctx;
@@ -637,6 +662,8 @@ struct perf_event {
        struct pid_namespace            *ns;
        u64                             id;
 
+       perf_overflow_handler_t         overflow_handler;
+
 #ifdef CONFIG_EVENT_PROFILE
        struct event_filter             *filter;
 #endif
@@ -714,7 +741,6 @@ struct perf_output_handle {
        int                             nmi;
        int                             sample;
        int                             locked;
-       unsigned long                   flags;
 };
 
 #ifdef CONFIG_PERF_EVENTS
@@ -746,6 +772,14 @@ extern int hw_perf_group_sched_in(struct perf_event *group_leader,
               struct perf_cpu_context *cpuctx,
               struct perf_event_context *ctx, int cpu);
 extern void perf_event_update_userpage(struct perf_event *event);
+extern int perf_event_release_kernel(struct perf_event *event);
+extern struct perf_event *
+perf_event_create_kernel_counter(struct perf_event_attr *attr,
+                               int cpu,
+                               pid_t pid,
+                               perf_overflow_handler_t callback);
+extern u64 perf_event_read_value(struct perf_event *event,
+                                u64 *enabled, u64 *running);
 
 struct perf_sample_data {
        u64                             type;
@@ -822,6 +856,7 @@ extern int sysctl_perf_event_sample_rate;
 extern void perf_event_init(void);
 extern void perf_tp_event(int event_id, u64 addr, u64 count,
                                 void *record, int entry_size);
+extern void perf_bp_event(struct perf_event *event, void *data);
 
 #ifndef perf_misc_flags
 #define perf_misc_flags(regs)  (user_mode(regs) ? PERF_RECORD_MISC_USER : \
@@ -835,6 +870,10 @@ extern int perf_output_begin(struct perf_output_handle *handle,
 extern void perf_output_end(struct perf_output_handle *handle);
 extern void perf_output_copy(struct perf_output_handle *handle,
                             const void *buf, unsigned int len);
+extern int perf_swevent_get_recursion_context(void);
+extern void perf_swevent_put_recursion_context(int rctx);
+extern void perf_event_enable(struct perf_event *event);
+extern void perf_event_disable(struct perf_event *event);
 #else
 static inline void
 perf_event_task_sched_in(struct task_struct *task, int cpu)            { }
@@ -856,12 +895,17 @@ static inline int perf_event_task_enable(void)                            { return -EINVAL; }
 static inline void
 perf_sw_event(u32 event_id, u64 nr, int nmi,
                     struct pt_regs *regs, u64 addr)                    { }
+static inline void
+perf_bp_event(struct perf_event *event, void *data)            { }
 
 static inline void perf_event_mmap(struct vm_area_struct *vma)         { }
 static inline void perf_event_comm(struct task_struct *tsk)            { }
 static inline void perf_event_fork(struct task_struct *tsk)            { }
 static inline void perf_event_init(void)                               { }
-
+static inline int  perf_swevent_get_recursion_context(void)  { return -1; }
+static inline void perf_swevent_put_recursion_context(int rctx)                { }
+static inline void perf_event_enable(struct perf_event *event)         { }
+static inline void perf_event_disable(struct perf_event *event)                { }
 #endif
 
 #define perf_output_put(handle, x) \