aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-11 23:47:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-11 23:47:30 -0500
commit6f696eb17be741668810fe1f798135c7cf6733e2 (patch)
treef9bcfe5831dfcaaad50ca68d7f04d80d8236fa56 /include
parentc4e194e3b71ff4fed01d727c32ee1071921d28a3 (diff)
parent125580380f418000b1a06d9a54700f1191b6e561 (diff)
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (57 commits) x86, perf events: Check if we have APIC enabled perf_event: Fix variable initialization in other codepaths perf kmem: Fix unused argument build warning perf symbols: perf_header__read_build_ids() offset'n'size should be u64 perf symbols: dsos__read_build_ids() should read both user and kernel buildids perf tools: Align long options which have no short forms perf kmem: Show usage if no option is specified sched: Mark sched_clock() as notrace perf sched: Add max delay time snapshot perf tools: Correct size given to memset perf_event: Fix perf_swevent_hrtimer() variable initialization perf sched: Fix for getting task's execution time tracing/kprobes: Fix field creation's bad error handling perf_event: Cleanup for cpu_clock_perf_event_update() perf_event: Allocate children's perf_event_ctxp at the right time perf_event: Clean up __perf_event_init_context() hw-breakpoints: Modify breakpoints without unregistering them perf probe: Update perf-probe document perf probe: Support --del option trace-kprobe: Support delete probe syntax ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/hw_breakpoint.h40
-rw-r--r--include/linux/perf_event.h41
-rw-r--r--include/linux/sched.h3
3 files changed, 39 insertions, 45 deletions
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index a03daed08c59..69f07a9f1277 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -20,19 +20,18 @@ 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
31static inline void hw_breakpoint_init(struct perf_event_attr *attr) 23static inline void hw_breakpoint_init(struct perf_event_attr *attr)
32{ 24{
25 memset(attr, 0, sizeof(*attr));
26
33 attr->type = PERF_TYPE_BREAKPOINT; 27 attr->type = PERF_TYPE_BREAKPOINT;
34 attr->size = sizeof(*attr); 28 attr->size = sizeof(*attr);
29 /*
30 * As it's for in-kernel or ptrace use, we want it to be pinned
31 * and to call its callback every hits.
32 */
35 attr->pinned = 1; 33 attr->pinned = 1;
34 attr->sample_period = 1;
36} 35}
37 36
38static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) 37static inline unsigned long hw_breakpoint_addr(struct perf_event *bp)
@@ -52,27 +51,24 @@ static inline int hw_breakpoint_len(struct perf_event *bp)
52 51
53extern struct perf_event * 52extern struct perf_event *
54register_user_hw_breakpoint(struct perf_event_attr *attr, 53register_user_hw_breakpoint(struct perf_event_attr *attr,
55 perf_callback_t triggered, 54 perf_overflow_handler_t triggered,
56 struct task_struct *tsk); 55 struct task_struct *tsk);
57 56
58/* FIXME: only change from the attr, and don't unregister */ 57/* FIXME: only change from the attr, and don't unregister */
59extern struct perf_event * 58extern int
60modify_user_hw_breakpoint(struct perf_event *bp, 59modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr);
61 struct perf_event_attr *attr,
62 perf_callback_t triggered,
63 struct task_struct *tsk);
64 60
65/* 61/*
66 * Kernel breakpoints are not associated with any particular thread. 62 * Kernel breakpoints are not associated with any particular thread.
67 */ 63 */
68extern struct perf_event * 64extern struct perf_event *
69register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, 65register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
70 perf_callback_t triggered, 66 perf_overflow_handler_t triggered,
71 int cpu); 67 int cpu);
72 68
73extern struct perf_event ** 69extern struct perf_event **
74register_wide_hw_breakpoint(struct perf_event_attr *attr, 70register_wide_hw_breakpoint(struct perf_event_attr *attr,
75 perf_callback_t triggered); 71 perf_overflow_handler_t triggered);
76 72
77extern int register_perf_hw_breakpoint(struct perf_event *bp); 73extern int register_perf_hw_breakpoint(struct perf_event *bp);
78extern int __register_perf_hw_breakpoint(struct perf_event *bp); 74extern int __register_perf_hw_breakpoint(struct perf_event *bp);
@@ -93,20 +89,18 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
93 89
94static inline struct perf_event * 90static inline struct perf_event *
95register_user_hw_breakpoint(struct perf_event_attr *attr, 91register_user_hw_breakpoint(struct perf_event_attr *attr,
96 perf_callback_t triggered, 92 perf_overflow_handler_t triggered,
97 struct task_struct *tsk) { return NULL; } 93 struct task_struct *tsk) { return NULL; }
98static inline struct perf_event * 94static inline int
99modify_user_hw_breakpoint(struct perf_event *bp, 95modify_user_hw_breakpoint(struct perf_event *bp,
100 struct perf_event_attr *attr, 96 struct perf_event_attr *attr) { return NULL; }
101 perf_callback_t triggered,
102 struct task_struct *tsk) { return NULL; }
103static inline struct perf_event * 97static inline struct perf_event *
104register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, 98register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
105 perf_callback_t triggered, 99 perf_overflow_handler_t triggered,
106 int cpu) { return NULL; } 100 int cpu) { return NULL; }
107static inline struct perf_event ** 101static inline struct perf_event **
108register_wide_hw_breakpoint(struct perf_event_attr *attr, 102register_wide_hw_breakpoint(struct perf_event_attr *attr,
109 perf_callback_t triggered) { return NULL; } 103 perf_overflow_handler_t triggered) { return NULL; }
110static inline int 104static inline int
111register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } 105register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; }
112static inline int 106static inline int
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 43adbd7f0010..64a53f74c9a9 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -18,10 +18,6 @@
18#include <linux/ioctl.h> 18#include <linux/ioctl.h>
19#include <asm/byteorder.h> 19#include <asm/byteorder.h>
20 20
21#ifdef CONFIG_HAVE_HW_BREAKPOINT
22#include <asm/hw_breakpoint.h>
23#endif
24
25/* 21/*
26 * User-space ABI bits: 22 * User-space ABI bits:
27 */ 23 */
@@ -215,12 +211,12 @@ struct perf_event_attr {
215 __u32 wakeup_watermark; /* bytes before wakeup */ 211 __u32 wakeup_watermark; /* bytes before wakeup */
216 }; 212 };
217 213
218 union { 214 struct { /* Hardware breakpoint info */
219 struct { /* Hardware breakpoint info */ 215 __u64 bp_addr;
220 __u64 bp_addr; 216 __u32 bp_type;
221 __u32 bp_type; 217 __u32 bp_len;
222 __u32 bp_len; 218 __u64 __bp_reserved_1;
223 }; 219 __u64 __bp_reserved_2;
224 }; 220 };
225 221
226 __u32 __reserved_2; 222 __u32 __reserved_2;
@@ -451,6 +447,10 @@ enum perf_callchain_context {
451# include <asm/perf_event.h> 447# include <asm/perf_event.h>
452#endif 448#endif
453 449
450#ifdef CONFIG_HAVE_HW_BREAKPOINT
451#include <asm/hw_breakpoint.h>
452#endif
453
454#include <linux/list.h> 454#include <linux/list.h>
455#include <linux/mutex.h> 455#include <linux/mutex.h>
456#include <linux/rculist.h> 456#include <linux/rculist.h>
@@ -565,10 +565,12 @@ struct perf_pending_entry {
565 void (*func)(struct perf_pending_entry *); 565 void (*func)(struct perf_pending_entry *);
566}; 566};
567 567
568typedef void (*perf_callback_t)(struct perf_event *, void *);
569
570struct perf_sample_data; 568struct perf_sample_data;
571 569
570typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
571 struct perf_sample_data *,
572 struct pt_regs *regs);
573
572/** 574/**
573 * struct perf_event - performance event kernel representation: 575 * struct perf_event - performance event kernel representation:
574 */ 576 */
@@ -660,18 +662,12 @@ struct perf_event {
660 struct pid_namespace *ns; 662 struct pid_namespace *ns;
661 u64 id; 663 u64 id;
662 664
663 void (*overflow_handler)(struct perf_event *event, 665 perf_overflow_handler_t overflow_handler;
664 int nmi, struct perf_sample_data *data,
665 struct pt_regs *regs);
666 666
667#ifdef CONFIG_EVENT_PROFILE 667#ifdef CONFIG_EVENT_PROFILE
668 struct event_filter *filter; 668 struct event_filter *filter;
669#endif 669#endif
670 670
671 perf_callback_t callback;
672
673 perf_callback_t event_callback;
674
675#endif /* CONFIG_PERF_EVENTS */ 671#endif /* CONFIG_PERF_EVENTS */
676}; 672};
677 673
@@ -781,7 +777,7 @@ extern struct perf_event *
781perf_event_create_kernel_counter(struct perf_event_attr *attr, 777perf_event_create_kernel_counter(struct perf_event_attr *attr,
782 int cpu, 778 int cpu,
783 pid_t pid, 779 pid_t pid,
784 perf_callback_t callback); 780 perf_overflow_handler_t callback);
785extern u64 perf_event_read_value(struct perf_event *event, 781extern u64 perf_event_read_value(struct perf_event *event,
786 u64 *enabled, u64 *running); 782 u64 *enabled, u64 *running);
787 783
@@ -876,6 +872,8 @@ extern void perf_output_copy(struct perf_output_handle *handle,
876 const void *buf, unsigned int len); 872 const void *buf, unsigned int len);
877extern int perf_swevent_get_recursion_context(void); 873extern int perf_swevent_get_recursion_context(void);
878extern void perf_swevent_put_recursion_context(int rctx); 874extern void perf_swevent_put_recursion_context(int rctx);
875extern void perf_event_enable(struct perf_event *event);
876extern void perf_event_disable(struct perf_event *event);
879#else 877#else
880static inline void 878static inline void
881perf_event_task_sched_in(struct task_struct *task, int cpu) { } 879perf_event_task_sched_in(struct task_struct *task, int cpu) { }
@@ -906,7 +904,8 @@ static inline void perf_event_fork(struct task_struct *tsk) { }
906static inline void perf_event_init(void) { } 904static inline void perf_event_init(void) { }
907static inline int perf_swevent_get_recursion_context(void) { return -1; } 905static inline int perf_swevent_get_recursion_context(void) { return -1; }
908static inline void perf_swevent_put_recursion_context(int rctx) { } 906static inline void perf_swevent_put_recursion_context(int rctx) { }
909 907static inline void perf_event_enable(struct perf_event *event) { }
908static inline void perf_event_disable(struct perf_event *event) { }
910#endif 909#endif
911 910
912#define perf_output_put(handle, x) \ 911#define perf_output_put(handle, x) \
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 89115ec7d43f..3f4fa73b512a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1840,7 +1840,8 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1840extern int sched_clock_stable; 1840extern int sched_clock_stable;
1841#endif 1841#endif
1842 1842
1843extern unsigned long long sched_clock(void); 1843/* ftrace calls sched_clock() directly */
1844extern unsigned long long notrace sched_clock(void);
1844 1845
1845extern void sched_clock_init(void); 1846extern void sched_clock_init(void);
1846extern u64 sched_clock_cpu(int cpu); 1847extern u64 sched_clock_cpu(int cpu);