diff options
-rw-r--r-- | include/trace/lockdep_event_types.h | 23 | ||||
-rw-r--r-- | kernel/lockdep.c | 8 |
2 files changed, 22 insertions, 9 deletions
diff --git a/include/trace/lockdep_event_types.h b/include/trace/lockdep_event_types.h index adccfcd2ec8f..863f1e4583a6 100644 --- a/include/trace/lockdep_event_types.h +++ b/include/trace/lockdep_event_types.h | |||
@@ -32,11 +32,24 @@ TRACE_FORMAT(lock_contended, | |||
32 | TP_FMT("%s", lock->name) | 32 | TP_FMT("%s", lock->name) |
33 | ); | 33 | ); |
34 | 34 | ||
35 | TRACE_FORMAT(lock_acquired, | 35 | TRACE_EVENT(lock_acquired, |
36 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | 36 | TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime), |
37 | TP_ARGS(lock, ip), | 37 | |
38 | TP_FMT("%s", lock->name) | 38 | TP_ARGS(lock, ip, waittime), |
39 | ); | 39 | |
40 | TP_STRUCT__entry( | ||
41 | __field(const char *, name) | ||
42 | __field(unsigned long, wait_usec) | ||
43 | __field(unsigned long, wait_nsec_rem) | ||
44 | ), | ||
45 | TP_fast_assign( | ||
46 | __entry->name = lock->name; | ||
47 | __entry->wait_nsec_rem = do_div(waittime, NSEC_PER_USEC); | ||
48 | __entry->wait_usec = (unsigned long) waittime; | ||
49 | ), | ||
50 | TP_printk("%s (%lu.%03lu us)", __entry->name, __entry->wait_usec, | ||
51 | __entry->wait_nsec_rem) | ||
52 | ); | ||
40 | 53 | ||
41 | #endif | 54 | #endif |
42 | #endif | 55 | #endif |
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index b0f011866969..c4582a6ea953 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -3061,6 +3061,8 @@ found_it: | |||
3061 | put_lock_stats(stats); | 3061 | put_lock_stats(stats); |
3062 | } | 3062 | } |
3063 | 3063 | ||
3064 | DEFINE_TRACE(lock_acquired); | ||
3065 | |||
3064 | static void | 3066 | static void |
3065 | __lock_acquired(struct lockdep_map *lock, unsigned long ip) | 3067 | __lock_acquired(struct lockdep_map *lock, unsigned long ip) |
3066 | { | 3068 | { |
@@ -3099,6 +3101,8 @@ found_it: | |||
3099 | hlock->holdtime_stamp = now; | 3101 | hlock->holdtime_stamp = now; |
3100 | } | 3102 | } |
3101 | 3103 | ||
3104 | trace_lock_acquired(lock, ip, waittime); | ||
3105 | |||
3102 | stats = get_lock_stats(hlock_class(hlock)); | 3106 | stats = get_lock_stats(hlock_class(hlock)); |
3103 | if (waittime) { | 3107 | if (waittime) { |
3104 | if (hlock->read) | 3108 | if (hlock->read) |
@@ -3137,14 +3141,10 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip) | |||
3137 | } | 3141 | } |
3138 | EXPORT_SYMBOL_GPL(lock_contended); | 3142 | EXPORT_SYMBOL_GPL(lock_contended); |
3139 | 3143 | ||
3140 | DEFINE_TRACE(lock_acquired); | ||
3141 | |||
3142 | void lock_acquired(struct lockdep_map *lock, unsigned long ip) | 3144 | void lock_acquired(struct lockdep_map *lock, unsigned long ip) |
3143 | { | 3145 | { |
3144 | unsigned long flags; | 3146 | unsigned long flags; |
3145 | 3147 | ||
3146 | trace_lock_acquired(lock, ip); | ||
3147 | |||
3148 | if (unlikely(!lock_stat)) | 3148 | if (unlikely(!lock_stat)) |
3149 | return; | 3149 | return; |
3150 | 3150 | ||