diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:19:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:19:03 -0400 |
commit | 4d7b4ac22fbec1a03206c6cde353f2fd6942f828 (patch) | |
tree | 2d96a9e9c28cf6fa628a278decc00ad55a8b043b /include | |
parent | 3aaf51ace5975050ab43c7d4d7e439e0ae7d13d7 (diff) | |
parent | 94f3ca95787ada3d64339a4ecb2754236ab563f6 (diff) |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (311 commits)
perf tools: Add mode to build without newt support
perf symbols: symbol inconsistency message should be done only at verbose=1
perf tui: Add explicit -lslang option
perf options: Type check all the remaining OPT_ variants
perf options: Type check OPT_BOOLEAN and fix the offenders
perf options: Check v type in OPT_U?INTEGER
perf options: Introduce OPT_UINTEGER
perf tui: Add workaround for slang < 2.1.4
perf record: Fix bug mismatch with -c option definition
perf options: Introduce OPT_U64
perf tui: Add help window to show key associations
perf tui: Make <- exit menus too
perf newt: Add single key shortcuts for zoom into DSO and threads
perf newt: Exit browser unconditionally when CTRL+C, q or Q is pressed
perf newt: Fix the 'A'/'a' shortcut for annotate
perf newt: Make <- exit the ui_browser
x86, perf: P4 PMU - fix counters management logic
perf newt: Make <- zoom out filters
perf report: Report number of events, not samples
perf hist: Clarify events_stats fields usage
...
Fix up trivial conflicts in kernel/fork.c and tools/perf/builtin-record.c
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ftrace.h | 12 | ||||
-rw-r--r-- | include/linux/hw_breakpoint.h | 25 | ||||
-rw-r--r-- | include/linux/mm.h | 4 | ||||
-rw-r--r-- | include/linux/perf_event.h | 83 | ||||
-rw-r--r-- | include/linux/ptrace.h | 12 | ||||
-rw-r--r-- | include/linux/sched.h | 9 | ||||
-rw-r--r-- | include/trace/events/lock.h | 55 | ||||
-rw-r--r-- | include/trace/ftrace.h | 23 |
8 files changed, 128 insertions, 95 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 01e6adea07ec..cc12b3c556b3 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -504,18 +504,6 @@ extern int ftrace_dump_on_oops; | |||
504 | #define INIT_TRACE_RECURSION | 504 | #define INIT_TRACE_RECURSION |
505 | #endif | 505 | #endif |
506 | 506 | ||
507 | #ifdef CONFIG_HW_BRANCH_TRACER | ||
508 | |||
509 | void trace_hw_branch(u64 from, u64 to); | ||
510 | void trace_hw_branch_oops(void); | ||
511 | |||
512 | #else /* CONFIG_HW_BRANCH_TRACER */ | ||
513 | |||
514 | static inline void trace_hw_branch(u64 from, u64 to) {} | ||
515 | static inline void trace_hw_branch_oops(void) {} | ||
516 | |||
517 | #endif /* CONFIG_HW_BRANCH_TRACER */ | ||
518 | |||
519 | #ifdef CONFIG_FTRACE_SYSCALLS | 507 | #ifdef CONFIG_FTRACE_SYSCALLS |
520 | 508 | ||
521 | unsigned long arch_syscall_addr(int nr); | 509 | unsigned long arch_syscall_addr(int nr); |
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h index c70d27af03f9..a2d6ea49ec56 100644 --- a/include/linux/hw_breakpoint.h +++ b/include/linux/hw_breakpoint.h | |||
@@ -9,9 +9,22 @@ enum { | |||
9 | }; | 9 | }; |
10 | 10 | ||
11 | enum { | 11 | enum { |
12 | HW_BREAKPOINT_R = 1, | 12 | HW_BREAKPOINT_EMPTY = 0, |
13 | HW_BREAKPOINT_W = 2, | 13 | HW_BREAKPOINT_R = 1, |
14 | HW_BREAKPOINT_X = 4, | 14 | HW_BREAKPOINT_W = 2, |
15 | HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W, | ||
16 | HW_BREAKPOINT_X = 4, | ||
17 | HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X, | ||
18 | }; | ||
19 | |||
20 | enum bp_type_idx { | ||
21 | TYPE_INST = 0, | ||
22 | #ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS | ||
23 | TYPE_DATA = 0, | ||
24 | #else | ||
25 | TYPE_DATA = 1, | ||
26 | #endif | ||
27 | TYPE_MAX | ||
15 | }; | 28 | }; |
16 | 29 | ||
17 | #ifdef __KERNEL__ | 30 | #ifdef __KERNEL__ |
@@ -34,6 +47,12 @@ static inline void hw_breakpoint_init(struct perf_event_attr *attr) | |||
34 | attr->sample_period = 1; | 47 | attr->sample_period = 1; |
35 | } | 48 | } |
36 | 49 | ||
50 | static inline void ptrace_breakpoint_init(struct perf_event_attr *attr) | ||
51 | { | ||
52 | hw_breakpoint_init(attr); | ||
53 | attr->exclude_kernel = 1; | ||
54 | } | ||
55 | |||
37 | static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) | 56 | static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) |
38 | { | 57 | { |
39 | return bp->attr.bp_addr; | 58 | return bp->attr.bp_addr; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 462acaf36f3a..fb19bb92b809 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -19,7 +19,6 @@ struct anon_vma; | |||
19 | struct file_ra_state; | 19 | struct file_ra_state; |
20 | struct user_struct; | 20 | struct user_struct; |
21 | struct writeback_control; | 21 | struct writeback_control; |
22 | struct rlimit; | ||
23 | 22 | ||
24 | #ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ | 23 | #ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ |
25 | extern unsigned long max_mapnr; | 24 | extern unsigned long max_mapnr; |
@@ -1449,9 +1448,6 @@ int vmemmap_populate_basepages(struct page *start_page, | |||
1449 | int vmemmap_populate(struct page *start_page, unsigned long pages, int node); | 1448 | int vmemmap_populate(struct page *start_page, unsigned long pages, int node); |
1450 | void vmemmap_populate_print_last(void); | 1449 | void vmemmap_populate_print_last(void); |
1451 | 1450 | ||
1452 | extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, | ||
1453 | size_t size); | ||
1454 | extern void refund_locked_memory(struct mm_struct *mm, size_t size); | ||
1455 | 1451 | ||
1456 | enum mf_flags { | 1452 | enum mf_flags { |
1457 | MF_COUNT_INCREASED = 1 << 0, | 1453 | MF_COUNT_INCREASED = 1 << 0, |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index c8e375440403..3fd5c82e0e18 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -203,8 +203,19 @@ struct perf_event_attr { | |||
203 | enable_on_exec : 1, /* next exec enables */ | 203 | enable_on_exec : 1, /* next exec enables */ |
204 | task : 1, /* trace fork/exit */ | 204 | task : 1, /* trace fork/exit */ |
205 | watermark : 1, /* wakeup_watermark */ | 205 | watermark : 1, /* wakeup_watermark */ |
206 | 206 | /* | |
207 | __reserved_1 : 49; | 207 | * precise_ip: |
208 | * | ||
209 | * 0 - SAMPLE_IP can have arbitrary skid | ||
210 | * 1 - SAMPLE_IP must have constant skid | ||
211 | * 2 - SAMPLE_IP requested to have 0 skid | ||
212 | * 3 - SAMPLE_IP must have 0 skid | ||
213 | * | ||
214 | * See also PERF_RECORD_MISC_EXACT_IP | ||
215 | */ | ||
216 | precise_ip : 2, /* skid constraint */ | ||
217 | |||
218 | __reserved_1 : 47; | ||
208 | 219 | ||
209 | union { | 220 | union { |
210 | __u32 wakeup_events; /* wakeup every n events */ | 221 | __u32 wakeup_events; /* wakeup every n events */ |
@@ -287,11 +298,24 @@ struct perf_event_mmap_page { | |||
287 | __u64 data_tail; /* user-space written tail */ | 298 | __u64 data_tail; /* user-space written tail */ |
288 | }; | 299 | }; |
289 | 300 | ||
290 | #define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0) | 301 | #define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0) |
291 | #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) | 302 | #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) |
292 | #define PERF_RECORD_MISC_KERNEL (1 << 0) | 303 | #define PERF_RECORD_MISC_KERNEL (1 << 0) |
293 | #define PERF_RECORD_MISC_USER (2 << 0) | 304 | #define PERF_RECORD_MISC_USER (2 << 0) |
294 | #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) | 305 | #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) |
306 | #define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) | ||
307 | #define PERF_RECORD_MISC_GUEST_USER (5 << 0) | ||
308 | |||
309 | /* | ||
310 | * Indicates that the content of PERF_SAMPLE_IP points to | ||
311 | * the actual instruction that triggered the event. See also | ||
312 | * perf_event_attr::precise_ip. | ||
313 | */ | ||
314 | #define PERF_RECORD_MISC_EXACT_IP (1 << 14) | ||
315 | /* | ||
316 | * Reserve the last bit to indicate some extended misc field | ||
317 | */ | ||
318 | #define PERF_RECORD_MISC_EXT_RESERVED (1 << 15) | ||
295 | 319 | ||
296 | struct perf_event_header { | 320 | struct perf_event_header { |
297 | __u32 type; | 321 | __u32 type; |
@@ -439,6 +463,12 @@ enum perf_callchain_context { | |||
439 | # include <asm/perf_event.h> | 463 | # include <asm/perf_event.h> |
440 | #endif | 464 | #endif |
441 | 465 | ||
466 | struct perf_guest_info_callbacks { | ||
467 | int (*is_in_guest) (void); | ||
468 | int (*is_user_mode) (void); | ||
469 | unsigned long (*get_guest_ip) (void); | ||
470 | }; | ||
471 | |||
442 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | 472 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
443 | #include <asm/hw_breakpoint.h> | 473 | #include <asm/hw_breakpoint.h> |
444 | #endif | 474 | #endif |
@@ -468,6 +498,17 @@ struct perf_raw_record { | |||
468 | void *data; | 498 | void *data; |
469 | }; | 499 | }; |
470 | 500 | ||
501 | struct perf_branch_entry { | ||
502 | __u64 from; | ||
503 | __u64 to; | ||
504 | __u64 flags; | ||
505 | }; | ||
506 | |||
507 | struct perf_branch_stack { | ||
508 | __u64 nr; | ||
509 | struct perf_branch_entry entries[0]; | ||
510 | }; | ||
511 | |||
471 | struct task_struct; | 512 | struct task_struct; |
472 | 513 | ||
473 | /** | 514 | /** |
@@ -506,6 +547,8 @@ struct hw_perf_event { | |||
506 | 547 | ||
507 | struct perf_event; | 548 | struct perf_event; |
508 | 549 | ||
550 | #define PERF_EVENT_TXN_STARTED 1 | ||
551 | |||
509 | /** | 552 | /** |
510 | * struct pmu - generic performance monitoring unit | 553 | * struct pmu - generic performance monitoring unit |
511 | */ | 554 | */ |
@@ -516,6 +559,16 @@ struct pmu { | |||
516 | void (*stop) (struct perf_event *event); | 559 | void (*stop) (struct perf_event *event); |
517 | void (*read) (struct perf_event *event); | 560 | void (*read) (struct perf_event *event); |
518 | void (*unthrottle) (struct perf_event *event); | 561 | void (*unthrottle) (struct perf_event *event); |
562 | |||
563 | /* | ||
564 | * group events scheduling is treated as a transaction, | ||
565 | * add group events as a whole and perform one schedulability test. | ||
566 | * If test fails, roll back the whole group | ||
567 | */ | ||
568 | |||
569 | void (*start_txn) (const struct pmu *pmu); | ||
570 | void (*cancel_txn) (const struct pmu *pmu); | ||
571 | int (*commit_txn) (const struct pmu *pmu); | ||
519 | }; | 572 | }; |
520 | 573 | ||
521 | /** | 574 | /** |
@@ -571,6 +624,14 @@ enum perf_group_flag { | |||
571 | PERF_GROUP_SOFTWARE = 0x1, | 624 | PERF_GROUP_SOFTWARE = 0x1, |
572 | }; | 625 | }; |
573 | 626 | ||
627 | #define SWEVENT_HLIST_BITS 8 | ||
628 | #define SWEVENT_HLIST_SIZE (1 << SWEVENT_HLIST_BITS) | ||
629 | |||
630 | struct swevent_hlist { | ||
631 | struct hlist_head heads[SWEVENT_HLIST_SIZE]; | ||
632 | struct rcu_head rcu_head; | ||
633 | }; | ||
634 | |||
574 | /** | 635 | /** |
575 | * struct perf_event - performance event kernel representation: | 636 | * struct perf_event - performance event kernel representation: |
576 | */ | 637 | */ |
@@ -579,6 +640,7 @@ struct perf_event { | |||
579 | struct list_head group_entry; | 640 | struct list_head group_entry; |
580 | struct list_head event_entry; | 641 | struct list_head event_entry; |
581 | struct list_head sibling_list; | 642 | struct list_head sibling_list; |
643 | struct hlist_node hlist_entry; | ||
582 | int nr_siblings; | 644 | int nr_siblings; |
583 | int group_flags; | 645 | int group_flags; |
584 | struct perf_event *group_leader; | 646 | struct perf_event *group_leader; |
@@ -726,6 +788,9 @@ struct perf_cpu_context { | |||
726 | int active_oncpu; | 788 | int active_oncpu; |
727 | int max_pertask; | 789 | int max_pertask; |
728 | int exclusive; | 790 | int exclusive; |
791 | struct swevent_hlist *swevent_hlist; | ||
792 | struct mutex hlist_mutex; | ||
793 | int hlist_refcount; | ||
729 | 794 | ||
730 | /* | 795 | /* |
731 | * Recursion avoidance: | 796 | * Recursion avoidance: |
@@ -769,9 +834,6 @@ extern void perf_disable(void); | |||
769 | extern void perf_enable(void); | 834 | extern void perf_enable(void); |
770 | extern int perf_event_task_disable(void); | 835 | extern int perf_event_task_disable(void); |
771 | extern int perf_event_task_enable(void); | 836 | extern int perf_event_task_enable(void); |
772 | extern int hw_perf_group_sched_in(struct perf_event *group_leader, | ||
773 | struct perf_cpu_context *cpuctx, | ||
774 | struct perf_event_context *ctx); | ||
775 | extern void perf_event_update_userpage(struct perf_event *event); | 837 | extern void perf_event_update_userpage(struct perf_event *event); |
776 | extern int perf_event_release_kernel(struct perf_event *event); | 838 | extern int perf_event_release_kernel(struct perf_event *event); |
777 | extern struct perf_event * | 839 | extern struct perf_event * |
@@ -902,6 +964,10 @@ static inline void perf_event_mmap(struct vm_area_struct *vma) | |||
902 | __perf_event_mmap(vma); | 964 | __perf_event_mmap(vma); |
903 | } | 965 | } |
904 | 966 | ||
967 | extern struct perf_guest_info_callbacks *perf_guest_cbs; | ||
968 | extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); | ||
969 | extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); | ||
970 | |||
905 | extern void perf_event_comm(struct task_struct *tsk); | 971 | extern void perf_event_comm(struct task_struct *tsk); |
906 | extern void perf_event_fork(struct task_struct *tsk); | 972 | extern void perf_event_fork(struct task_struct *tsk); |
907 | 973 | ||
@@ -971,6 +1037,11 @@ perf_sw_event(u32 event_id, u64 nr, int nmi, | |||
971 | static inline void | 1037 | static inline void |
972 | perf_bp_event(struct perf_event *event, void *data) { } | 1038 | perf_bp_event(struct perf_event *event, void *data) { } |
973 | 1039 | ||
1040 | static inline int perf_register_guest_info_callbacks | ||
1041 | (struct perf_guest_info_callbacks *callbacks) { return 0; } | ||
1042 | static inline int perf_unregister_guest_info_callbacks | ||
1043 | (struct perf_guest_info_callbacks *callbacks) { return 0; } | ||
1044 | |||
974 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } | 1045 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } |
975 | static inline void perf_event_comm(struct task_struct *tsk) { } | 1046 | static inline void perf_event_comm(struct task_struct *tsk) { } |
976 | static inline void perf_event_fork(struct task_struct *tsk) { } | 1047 | static inline void perf_event_fork(struct task_struct *tsk) { } |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index e1fb60729979..4272521e29e9 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -345,18 +345,6 @@ static inline void user_single_step_siginfo(struct task_struct *tsk, | |||
345 | #define arch_ptrace_stop(code, info) do { } while (0) | 345 | #define arch_ptrace_stop(code, info) do { } while (0) |
346 | #endif | 346 | #endif |
347 | 347 | ||
348 | #ifndef arch_ptrace_untrace | ||
349 | /* | ||
350 | * Do machine-specific work before untracing child. | ||
351 | * | ||
352 | * This is called for a normal detach as well as from ptrace_exit() | ||
353 | * when the tracing task dies. | ||
354 | * | ||
355 | * Called with write_lock(&tasklist_lock) held. | ||
356 | */ | ||
357 | #define arch_ptrace_untrace(task) do { } while (0) | ||
358 | #endif | ||
359 | |||
360 | extern int task_current_syscall(struct task_struct *target, long *callno, | 348 | extern int task_current_syscall(struct task_struct *target, long *callno, |
361 | unsigned long args[6], unsigned int maxargs, | 349 | unsigned long args[6], unsigned int maxargs, |
362 | unsigned long *sp, unsigned long *pc); | 350 | unsigned long *sp, unsigned long *pc); |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 2b7b81df78b3..28b71ee133f0 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -99,7 +99,6 @@ struct futex_pi_state; | |||
99 | struct robust_list_head; | 99 | struct robust_list_head; |
100 | struct bio_list; | 100 | struct bio_list; |
101 | struct fs_struct; | 101 | struct fs_struct; |
102 | struct bts_context; | ||
103 | struct perf_event_context; | 102 | struct perf_event_context; |
104 | 103 | ||
105 | /* | 104 | /* |
@@ -1272,12 +1271,6 @@ struct task_struct { | |||
1272 | struct list_head ptraced; | 1271 | struct list_head ptraced; |
1273 | struct list_head ptrace_entry; | 1272 | struct list_head ptrace_entry; |
1274 | 1273 | ||
1275 | /* | ||
1276 | * This is the tracer handle for the ptrace BTS extension. | ||
1277 | * This field actually belongs to the ptracer task. | ||
1278 | */ | ||
1279 | struct bts_context *bts; | ||
1280 | |||
1281 | /* PID/PID hash table linkage. */ | 1274 | /* PID/PID hash table linkage. */ |
1282 | struct pid_link pids[PIDTYPE_MAX]; | 1275 | struct pid_link pids[PIDTYPE_MAX]; |
1283 | struct list_head thread_group; | 1276 | struct list_head thread_group; |
@@ -2122,10 +2115,8 @@ extern void set_task_comm(struct task_struct *tsk, char *from); | |||
2122 | extern char *get_task_comm(char *to, struct task_struct *tsk); | 2115 | extern char *get_task_comm(char *to, struct task_struct *tsk); |
2123 | 2116 | ||
2124 | #ifdef CONFIG_SMP | 2117 | #ifdef CONFIG_SMP |
2125 | extern void wait_task_context_switch(struct task_struct *p); | ||
2126 | extern unsigned long wait_task_inactive(struct task_struct *, long match_state); | 2118 | extern unsigned long wait_task_inactive(struct task_struct *, long match_state); |
2127 | #else | 2119 | #else |
2128 | static inline void wait_task_context_switch(struct task_struct *p) {} | ||
2129 | static inline unsigned long wait_task_inactive(struct task_struct *p, | 2120 | static inline unsigned long wait_task_inactive(struct task_struct *p, |
2130 | long match_state) | 2121 | long match_state) |
2131 | { | 2122 | { |
diff --git a/include/trace/events/lock.h b/include/trace/events/lock.h index 5c1dcfc16c60..2821b86de63b 100644 --- a/include/trace/events/lock.h +++ b/include/trace/events/lock.h | |||
@@ -35,15 +35,15 @@ TRACE_EVENT(lock_acquire, | |||
35 | __get_str(name)) | 35 | __get_str(name)) |
36 | ); | 36 | ); |
37 | 37 | ||
38 | TRACE_EVENT(lock_release, | 38 | DECLARE_EVENT_CLASS(lock, |
39 | 39 | ||
40 | TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), | 40 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
41 | 41 | ||
42 | TP_ARGS(lock, nested, ip), | 42 | TP_ARGS(lock, ip), |
43 | 43 | ||
44 | TP_STRUCT__entry( | 44 | TP_STRUCT__entry( |
45 | __string(name, lock->name) | 45 | __string( name, lock->name ) |
46 | __field(void *, lockdep_addr) | 46 | __field( void *, lockdep_addr ) |
47 | ), | 47 | ), |
48 | 48 | ||
49 | TP_fast_assign( | 49 | TP_fast_assign( |
@@ -51,51 +51,30 @@ TRACE_EVENT(lock_release, | |||
51 | __entry->lockdep_addr = lock; | 51 | __entry->lockdep_addr = lock; |
52 | ), | 52 | ), |
53 | 53 | ||
54 | TP_printk("%p %s", | 54 | TP_printk("%p %s", __entry->lockdep_addr, __get_str(name)) |
55 | __entry->lockdep_addr, __get_str(name)) | ||
56 | ); | 55 | ); |
57 | 56 | ||
58 | #ifdef CONFIG_LOCK_STAT | 57 | DEFINE_EVENT(lock, lock_release, |
59 | |||
60 | TRACE_EVENT(lock_contended, | ||
61 | 58 | ||
62 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | 59 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
63 | 60 | ||
64 | TP_ARGS(lock, ip), | 61 | TP_ARGS(lock, ip) |
62 | ); | ||
65 | 63 | ||
66 | TP_STRUCT__entry( | 64 | #ifdef CONFIG_LOCK_STAT |
67 | __string(name, lock->name) | ||
68 | __field(void *, lockdep_addr) | ||
69 | ), | ||
70 | 65 | ||
71 | TP_fast_assign( | 66 | DEFINE_EVENT(lock, lock_contended, |
72 | __assign_str(name, lock->name); | ||
73 | __entry->lockdep_addr = lock; | ||
74 | ), | ||
75 | 67 | ||
76 | TP_printk("%p %s", | 68 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
77 | __entry->lockdep_addr, __get_str(name)) | ||
78 | ); | ||
79 | 69 | ||
80 | TRACE_EVENT(lock_acquired, | 70 | TP_ARGS(lock, ip) |
81 | TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime), | 71 | ); |
82 | 72 | ||
83 | TP_ARGS(lock, ip, waittime), | 73 | DEFINE_EVENT(lock, lock_acquired, |
84 | 74 | ||
85 | TP_STRUCT__entry( | 75 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
86 | __string(name, lock->name) | ||
87 | __field(s64, wait_nsec) | ||
88 | __field(void *, lockdep_addr) | ||
89 | ), | ||
90 | 76 | ||
91 | TP_fast_assign( | 77 | TP_ARGS(lock, ip) |
92 | __assign_str(name, lock->name); | ||
93 | __entry->wait_nsec = waittime; | ||
94 | __entry->lockdep_addr = lock; | ||
95 | ), | ||
96 | TP_printk("%p %s (%llu ns)", __entry->lockdep_addr, | ||
97 | __get_str(name), | ||
98 | __entry->wait_nsec) | ||
99 | ); | 78 | ); |
100 | 79 | ||
101 | #endif | 80 | #endif |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 75dd7787fb37..16253db38d73 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -763,13 +763,12 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
763 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ | 763 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
764 | static notrace void \ | 764 | static notrace void \ |
765 | perf_trace_templ_##call(struct ftrace_event_call *event_call, \ | 765 | perf_trace_templ_##call(struct ftrace_event_call *event_call, \ |
766 | proto) \ | 766 | struct pt_regs *__regs, proto) \ |
767 | { \ | 767 | { \ |
768 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ | 768 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ |
769 | struct ftrace_raw_##call *entry; \ | 769 | struct ftrace_raw_##call *entry; \ |
770 | u64 __addr = 0, __count = 1; \ | 770 | u64 __addr = 0, __count = 1; \ |
771 | unsigned long irq_flags; \ | 771 | unsigned long irq_flags; \ |
772 | struct pt_regs *__regs; \ | ||
773 | int __entry_size; \ | 772 | int __entry_size; \ |
774 | int __data_size; \ | 773 | int __data_size; \ |
775 | int rctx; \ | 774 | int rctx; \ |
@@ -790,20 +789,22 @@ perf_trace_templ_##call(struct ftrace_event_call *event_call, \ | |||
790 | \ | 789 | \ |
791 | { assign; } \ | 790 | { assign; } \ |
792 | \ | 791 | \ |
793 | __regs = &__get_cpu_var(perf_trace_regs); \ | ||
794 | perf_fetch_caller_regs(__regs, 2); \ | ||
795 | \ | ||
796 | perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \ | 792 | perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \ |
797 | __count, irq_flags, __regs); \ | 793 | __count, irq_flags, __regs); \ |
798 | } | 794 | } |
799 | 795 | ||
800 | #undef DEFINE_EVENT | 796 | #undef DEFINE_EVENT |
801 | #define DEFINE_EVENT(template, call, proto, args) \ | 797 | #define DEFINE_EVENT(template, call, proto, args) \ |
802 | static notrace void perf_trace_##call(proto) \ | 798 | static notrace void perf_trace_##call(proto) \ |
803 | { \ | 799 | { \ |
804 | struct ftrace_event_call *event_call = &event_##call; \ | 800 | struct ftrace_event_call *event_call = &event_##call; \ |
805 | \ | 801 | struct pt_regs *__regs = &get_cpu_var(perf_trace_regs); \ |
806 | perf_trace_templ_##template(event_call, args); \ | 802 | \ |
803 | perf_fetch_caller_regs(__regs, 1); \ | ||
804 | \ | ||
805 | perf_trace_templ_##template(event_call, __regs, args); \ | ||
806 | \ | ||
807 | put_cpu_var(perf_trace_regs); \ | ||
807 | } | 808 | } |
808 | 809 | ||
809 | #undef DEFINE_EVENT_PRINT | 810 | #undef DEFINE_EVENT_PRINT |