aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/lockdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r--kernel/lockdep.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index b0f011866969..8bbeef996c76 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -42,12 +42,14 @@
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>
46 45
47#include <asm/sections.h> 46#include <asm/sections.h>
48 47
49#include "lockdep_internals.h" 48#include "lockdep_internals.h"
50 49
50#define CREATE_TRACE_POINTS
51#include <trace/events/lockdep.h>
52
51#ifdef CONFIG_PROVE_LOCKING 53#ifdef CONFIG_PROVE_LOCKING
52int prove_locking = 1; 54int prove_locking = 1;
53module_param(prove_locking, int, 0644); 55module_param(prove_locking, int, 0644);
@@ -2490,13 +2492,20 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
2490void lockdep_init_map(struct lockdep_map *lock, const char *name, 2492void lockdep_init_map(struct lockdep_map *lock, const char *name,
2491 struct lock_class_key *key, int subclass) 2493 struct lock_class_key *key, int subclass)
2492{ 2494{
2493 if (unlikely(!debug_locks)) 2495 lock->class_cache = NULL;
2496#ifdef CONFIG_LOCK_STAT
2497 lock->cpu = raw_smp_processor_id();
2498#endif
2499
2500 if (DEBUG_LOCKS_WARN_ON(!name)) {
2501 lock->name = "NULL";
2494 return; 2502 return;
2503 }
2504
2505 lock->name = name;
2495 2506
2496 if (DEBUG_LOCKS_WARN_ON(!key)) 2507 if (DEBUG_LOCKS_WARN_ON(!key))
2497 return; 2508 return;
2498 if (DEBUG_LOCKS_WARN_ON(!name))
2499 return;
2500 /* 2509 /*
2501 * Sanity check, the lock-class key must be persistent: 2510 * Sanity check, the lock-class key must be persistent:
2502 */ 2511 */
@@ -2505,12 +2514,11 @@ void lockdep_init_map(struct lockdep_map *lock, const char *name,
2505 DEBUG_LOCKS_WARN_ON(1); 2514 DEBUG_LOCKS_WARN_ON(1);
2506 return; 2515 return;
2507 } 2516 }
2508 lock->name = name;
2509 lock->key = key; 2517 lock->key = key;
2510 lock->class_cache = NULL; 2518
2511#ifdef CONFIG_LOCK_STAT 2519 if (unlikely(!debug_locks))
2512 lock->cpu = raw_smp_processor_id(); 2520 return;
2513#endif 2521
2514 if (subclass) 2522 if (subclass)
2515 register_lock_class(lock, subclass, 1); 2523 register_lock_class(lock, subclass, 1);
2516} 2524}
@@ -2929,8 +2937,6 @@ void lock_set_class(struct lockdep_map *lock, const char *name,
2929} 2937}
2930EXPORT_SYMBOL_GPL(lock_set_class); 2938EXPORT_SYMBOL_GPL(lock_set_class);
2931 2939
2932DEFINE_TRACE(lock_acquire);
2933
2934/* 2940/*
2935 * We are not always called with irqs disabled - do that here, 2941 * We are not always called with irqs disabled - do that here,
2936 * and also avoid lockdep recursion: 2942 * and also avoid lockdep recursion:
@@ -2957,8 +2963,6 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
2957} 2963}
2958EXPORT_SYMBOL_GPL(lock_acquire); 2964EXPORT_SYMBOL_GPL(lock_acquire);
2959 2965
2960DEFINE_TRACE(lock_release);
2961
2962void lock_release(struct lockdep_map *lock, int nested, 2966void lock_release(struct lockdep_map *lock, int nested,
2963 unsigned long ip) 2967 unsigned long ip)
2964{ 2968{
@@ -3099,6 +3103,8 @@ found_it:
3099 hlock->holdtime_stamp = now; 3103 hlock->holdtime_stamp = now;
3100 } 3104 }
3101 3105
3106 trace_lock_acquired(lock, ip, waittime);
3107
3102 stats = get_lock_stats(hlock_class(hlock)); 3108 stats = get_lock_stats(hlock_class(hlock));
3103 if (waittime) { 3109 if (waittime) {
3104 if (hlock->read) 3110 if (hlock->read)
@@ -3114,8 +3120,6 @@ found_it:
3114 lock->ip = ip; 3120 lock->ip = ip;
3115} 3121}
3116 3122
3117DEFINE_TRACE(lock_contended);
3118
3119void lock_contended(struct lockdep_map *lock, unsigned long ip) 3123void lock_contended(struct lockdep_map *lock, unsigned long ip)
3120{ 3124{
3121 unsigned long flags; 3125 unsigned long flags;
@@ -3137,14 +3141,10 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip)
3137} 3141}
3138EXPORT_SYMBOL_GPL(lock_contended); 3142EXPORT_SYMBOL_GPL(lock_contended);
3139 3143
3140DEFINE_TRACE(lock_acquired);
3141
3142void lock_acquired(struct lockdep_map *lock, unsigned long ip) 3144void 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