diff options
author | Peter Zijlstra <peterz@infradead.org> | 2009-03-04 06:32:55 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-04 12:49:58 -0500 |
commit | efed792d6738964f399a508ef9e831cd60fa4657 (patch) | |
tree | b4b5e472bafb3d5d0d8ea26680e1d8cc87365c30 /kernel/lockdep.c | |
parent | 28b1bd1cbc33cae95a309691d814399a69cf3070 (diff) |
tracing: add lockdep tracepoints for lock acquire/release
Augment the traces with lock names when lockdep is available:
1) | down_read_trylock() {
1) | _spin_lock_irqsave() {
1) | /* lock_acquire: &sem->wait_lock */
1) 4.201 us | }
1) | _spin_unlock_irqrestore() {
1) | /* lock_release: &sem->wait_lock */
1) 3.523 us | }
1) | /* lock_acquire: try read &mm->mmap_sem */
1) + 13.386 us | }
1) 1.635 us | find_vma();
1) | handle_mm_fault() {
1) | __do_fault() {
1) | filemap_fault() {
1) | find_lock_page() {
1) | find_get_page() {
1) | /* lock_acquire: read rcu_read_lock */
1) | /* lock_release: rcu_read_lock */
1) 5.697 us | }
1) 8.158 us | }
1) + 11.079 us | }
1) | _spin_lock() {
1) | /* lock_acquire: __pte_lockptr(page) */
1) 3.949 us | }
1) 1.460 us | page_add_file_rmap();
1) | _spin_unlock() {
1) | /* lock_release: __pte_lockptr(page) */
1) 3.115 us | }
1) | unlock_page() {
1) 1.421 us | page_waitqueue();
1) 1.220 us | __wake_up_bit();
1) 6.519 us | }
1) + 34.328 us | }
1) + 37.452 us | }
1) | up_read() {
1) | /* lock_release: &mm->mmap_sem */
1) | _spin_lock_irqsave() {
1) | /* lock_acquire: &sem->wait_lock */
1) 3.865 us | }
1) | _spin_unlock_irqrestore() {
1) | /* lock_release: &sem->wait_lock */
1) 8.562 us | }
1) + 17.370 us | }
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: =?ISO-8859-1?Q?T=F6r=F6k?= Edwin <edwintorok@gmail.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1236166375.5330.7209.camel@laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r-- | kernel/lockdep.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 02014f7ccc86..cb70c1db85d0 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/hash.h> | 42 | #include <linux/hash.h> |
43 | #include <linux/ftrace.h> | 43 | #include <linux/ftrace.h> |
44 | #include <linux/stringify.h> | 44 | #include <linux/stringify.h> |
45 | #include <trace/lockdep.h> | ||
45 | 46 | ||
46 | #include <asm/sections.h> | 47 | #include <asm/sections.h> |
47 | 48 | ||
@@ -2913,6 +2914,8 @@ void lock_set_class(struct lockdep_map *lock, const char *name, | |||
2913 | } | 2914 | } |
2914 | EXPORT_SYMBOL_GPL(lock_set_class); | 2915 | EXPORT_SYMBOL_GPL(lock_set_class); |
2915 | 2916 | ||
2917 | DEFINE_TRACE(lock_acquire); | ||
2918 | |||
2916 | /* | 2919 | /* |
2917 | * We are not always called with irqs disabled - do that here, | 2920 | * We are not always called with irqs disabled - do that here, |
2918 | * and also avoid lockdep recursion: | 2921 | * and also avoid lockdep recursion: |
@@ -2923,6 +2926,8 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
2923 | { | 2926 | { |
2924 | unsigned long flags; | 2927 | unsigned long flags; |
2925 | 2928 | ||
2929 | trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip); | ||
2930 | |||
2926 | if (unlikely(current->lockdep_recursion)) | 2931 | if (unlikely(current->lockdep_recursion)) |
2927 | return; | 2932 | return; |
2928 | 2933 | ||
@@ -2937,11 +2942,15 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
2937 | } | 2942 | } |
2938 | EXPORT_SYMBOL_GPL(lock_acquire); | 2943 | EXPORT_SYMBOL_GPL(lock_acquire); |
2939 | 2944 | ||
2945 | DEFINE_TRACE(lock_release); | ||
2946 | |||
2940 | void lock_release(struct lockdep_map *lock, int nested, | 2947 | void lock_release(struct lockdep_map *lock, int nested, |
2941 | unsigned long ip) | 2948 | unsigned long ip) |
2942 | { | 2949 | { |
2943 | unsigned long flags; | 2950 | unsigned long flags; |
2944 | 2951 | ||
2952 | trace_lock_release(lock, nested, ip); | ||
2953 | |||
2945 | if (unlikely(current->lockdep_recursion)) | 2954 | if (unlikely(current->lockdep_recursion)) |
2946 | return; | 2955 | return; |
2947 | 2956 | ||
@@ -3090,10 +3099,14 @@ found_it: | |||
3090 | lock->ip = ip; | 3099 | lock->ip = ip; |
3091 | } | 3100 | } |
3092 | 3101 | ||
3102 | DEFINE_TRACE(lock_contended); | ||
3103 | |||
3093 | void lock_contended(struct lockdep_map *lock, unsigned long ip) | 3104 | void lock_contended(struct lockdep_map *lock, unsigned long ip) |
3094 | { | 3105 | { |
3095 | unsigned long flags; | 3106 | unsigned long flags; |
3096 | 3107 | ||
3108 | trace_lock_contended(lock, ip); | ||
3109 | |||
3097 | if (unlikely(!lock_stat)) | 3110 | if (unlikely(!lock_stat)) |
3098 | return; | 3111 | return; |
3099 | 3112 | ||
@@ -3109,10 +3122,14 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip) | |||
3109 | } | 3122 | } |
3110 | EXPORT_SYMBOL_GPL(lock_contended); | 3123 | EXPORT_SYMBOL_GPL(lock_contended); |
3111 | 3124 | ||
3125 | DEFINE_TRACE(lock_acquired); | ||
3126 | |||
3112 | void lock_acquired(struct lockdep_map *lock, unsigned long ip) | 3127 | void lock_acquired(struct lockdep_map *lock, unsigned long ip) |
3113 | { | 3128 | { |
3114 | unsigned long flags; | 3129 | unsigned long flags; |
3115 | 3130 | ||
3131 | trace_lock_acquired(lock, ip); | ||
3132 | |||
3116 | if (unlikely(!lock_stat)) | 3133 | if (unlikely(!lock_stat)) |
3117 | return; | 3134 | return; |
3118 | 3135 | ||