]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - kernel/locking/lockdep.c
Merge branches 'pm-core', 'pm-qos', 'pm-domains' and 'pm-opp'
[linux.git] / kernel / locking / lockdep.c
index 7bd265f6b0984a612f20d57aeb3c59647cc383d8..9812e5dd409e98b7cfe8133601854cae8111b772 100644 (file)
@@ -2203,7 +2203,7 @@ static inline int lookup_chain_cache(struct task_struct *curr,
         * Important for check_no_collision().
         */
        if (unlikely(nr_chain_hlocks > MAX_LOCKDEP_CHAIN_HLOCKS)) {
-               if (debug_locks_off_graph_unlock())
+               if (!debug_locks_off_graph_unlock())
                        return 0;
 
                print_lockdep_off("BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!");
@@ -3191,7 +3191,7 @@ print_lock_nested_lock_not_held(struct task_struct *curr,
        return 0;
 }
 
-static int __lock_is_held(struct lockdep_map *lock);
+static int __lock_is_held(struct lockdep_map *lock, int read);
 
 /*
  * This gets called for every mutex_lock*()/spin_lock*() operation.
@@ -3332,7 +3332,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
        }
        chain_key = iterate_chain_key(chain_key, class_idx);
 
-       if (nest_lock && !__lock_is_held(nest_lock))
+       if (nest_lock && !__lock_is_held(nest_lock, -1))
                return print_lock_nested_lock_not_held(curr, hlock, ip);
 
        if (!validate_chain(curr, lock, hlock, chain_head, chain_key))
@@ -3579,7 +3579,7 @@ __lock_release(struct lockdep_map *lock, int nested, unsigned long ip)
        return 1;
 }
 
-static int __lock_is_held(struct lockdep_map *lock)
+static int __lock_is_held(struct lockdep_map *lock, int read)
 {
        struct task_struct *curr = current;
        int i;
@@ -3587,8 +3587,12 @@ static int __lock_is_held(struct lockdep_map *lock)
        for (i = 0; i < curr->lockdep_depth; i++) {
                struct held_lock *hlock = curr->held_locks + i;
 
-               if (match_held_lock(hlock, lock))
-                       return 1;
+               if (match_held_lock(hlock, lock)) {
+                       if (read == -1 || hlock->read == read)
+                               return 1;
+
+                       return 0;
+               }
        }
 
        return 0;
@@ -3772,7 +3776,7 @@ void lock_release(struct lockdep_map *lock, int nested,
 }
 EXPORT_SYMBOL_GPL(lock_release);
 
-int lock_is_held(struct lockdep_map *lock)
+int lock_is_held_type(struct lockdep_map *lock, int read)
 {
        unsigned long flags;
        int ret = 0;
@@ -3784,13 +3788,13 @@ int lock_is_held(struct lockdep_map *lock)
        check_flags(flags);
 
        current->lockdep_recursion = 1;
-       ret = __lock_is_held(lock);
+       ret = __lock_is_held(lock, read);
        current->lockdep_recursion = 0;
        raw_local_irq_restore(flags);
 
        return ret;
 }
-EXPORT_SYMBOL_GPL(lock_is_held);
+EXPORT_SYMBOL_GPL(lock_is_held_type);
 
 struct pin_cookie lock_pin_lock(struct lockdep_map *lock)
 {
@@ -4408,13 +4412,13 @@ void lockdep_rcu_suspicious(const char *file, const int line, const char *s)
 #endif /* #ifdef CONFIG_PROVE_RCU_REPEATEDLY */
        /* Note: the following can be executed concurrently, so be careful. */
        printk("\n");
-       printk("===============================\n");
-       printk("[ INFO: suspicious RCU usage. ]\n");
+       pr_err("===============================\n");
+       pr_err("[ ERR: suspicious RCU usage.  ]\n");
        print_kernel_ident();
-       printk("-------------------------------\n");
-       printk("%s:%d %s!\n", file, line, s);
-       printk("\nother info that might help us debug this:\n\n");
-       printk("\n%srcu_scheduler_active = %d, debug_locks = %d\n",
+       pr_err("-------------------------------\n");
+       pr_err("%s:%d %s!\n", file, line, s);
+       pr_err("\nother info that might help us debug this:\n\n");
+       pr_err("\n%srcu_scheduler_active = %d, debug_locks = %d\n",
               !rcu_lockdep_current_cpu_online()
                        ? "RCU used illegally from offline CPU!\n"
                        : !rcu_is_watching()