Merge git://git.infradead.org/~dwmw2/dwmw2-2.6.27
[pandora-kernel.git] / include / linux / lockdep.h
index e431d1d..331e5f1 100644 (file)
@@ -190,8 +190,13 @@ struct lock_chain {
        u64                             chain_key;
 };
 
-#define MAX_LOCKDEP_KEYS_BITS          11
-#define MAX_LOCKDEP_KEYS               (1UL << MAX_LOCKDEP_KEYS_BITS)
+#define MAX_LOCKDEP_KEYS_BITS          13
+/*
+ * Subtract one because we offset hlock->class_idx by 1 in order
+ * to make 0 mean no class. This avoids overflowing the class_idx
+ * bitfield and hitting the BUG in hlock_class().
+ */
+#define MAX_LOCKDEP_KEYS               ((1UL << MAX_LOCKDEP_KEYS_BITS) - 1)
 
 struct held_lock {
        /*
@@ -211,6 +216,7 @@ struct held_lock {
        u64                             prev_chain_key;
        unsigned long                   acquire_ip;
        struct lockdep_map              *instance;
+       struct lockdep_map              *nest_lock;
 #ifdef CONFIG_LOCK_STAT
        u64                             waittime_stamp;
        u64                             holdtime_stamp;
@@ -297,7 +303,8 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
  *   2: full validation
  */
 extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
-                        int trylock, int read, int check, unsigned long ip);
+                        int trylock, int read, int check,
+                        struct lockdep_map *nest_lock, unsigned long ip);
 
 extern void lock_release(struct lockdep_map *lock, int nested,
                         unsigned long ip);
@@ -319,7 +326,7 @@ static inline void lockdep_on(void)
 {
 }
 
-# define lock_acquire(l, s, t, r, c, i)                do { } while (0)
+# define lock_acquire(l, s, t, r, c, n, i)     do { } while (0)
 # define lock_release(l, n, i)                 do { } while (0)
 # define lock_set_subclass(l, s, i)            do { } while (0)
 # define lockdep_init()                                do { } while (0)
@@ -407,9 +414,11 @@ static inline void print_irqtrace_events(struct task_struct *curr)
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # ifdef CONFIG_PROVE_LOCKING
-#  define spin_acquire(l, s, t, i)             lock_acquire(l, s, t, 0, 2, i)
+#  define spin_acquire(l, s, t, i)             lock_acquire(l, s, t, 0, 2, NULL, i)
+#  define spin_acquire_nest(l, s, t, n, i)     lock_acquire(l, s, t, 0, 2, n, i)
 # else
-#  define spin_acquire(l, s, t, i)             lock_acquire(l, s, t, 0, 1, i)
+#  define spin_acquire(l, s, t, i)             lock_acquire(l, s, t, 0, 1, NULL, i)
+#  define spin_acquire_nest(l, s, t, n, i)     lock_acquire(l, s, t, 0, 1, NULL, i)
 # endif
 # define spin_release(l, n, i)                 lock_release(l, n, i)
 #else
@@ -419,11 +428,11 @@ static inline void print_irqtrace_events(struct task_struct *curr)
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # ifdef CONFIG_PROVE_LOCKING
-#  define rwlock_acquire(l, s, t, i)           lock_acquire(l, s, t, 0, 2, i)
-#  define rwlock_acquire_read(l, s, t, i)      lock_acquire(l, s, t, 2, 2, i)
+#  define rwlock_acquire(l, s, t, i)           lock_acquire(l, s, t, 0, 2, NULL, i)
+#  define rwlock_acquire_read(l, s, t, i)      lock_acquire(l, s, t, 2, 2, NULL, i)
 # else
-#  define rwlock_acquire(l, s, t, i)           lock_acquire(l, s, t, 0, 1, i)
-#  define rwlock_acquire_read(l, s, t, i)      lock_acquire(l, s, t, 2, 1, i)
+#  define rwlock_acquire(l, s, t, i)           lock_acquire(l, s, t, 0, 1, NULL, i)
+#  define rwlock_acquire_read(l, s, t, i)      lock_acquire(l, s, t, 2, 1, NULL, i)
 # endif
 # define rwlock_release(l, n, i)               lock_release(l, n, i)
 #else
@@ -434,9 +443,9 @@ static inline void print_irqtrace_events(struct task_struct *curr)
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # ifdef CONFIG_PROVE_LOCKING
-#  define mutex_acquire(l, s, t, i)            lock_acquire(l, s, t, 0, 2, i)
+#  define mutex_acquire(l, s, t, i)            lock_acquire(l, s, t, 0, 2, NULL, i)
 # else
-#  define mutex_acquire(l, s, t, i)            lock_acquire(l, s, t, 0, 1, i)
+#  define mutex_acquire(l, s, t, i)            lock_acquire(l, s, t, 0, 1, NULL, i)
 # endif
 # define mutex_release(l, n, i)                        lock_release(l, n, i)
 #else
@@ -446,11 +455,11 @@ static inline void print_irqtrace_events(struct task_struct *curr)
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # ifdef CONFIG_PROVE_LOCKING
-#  define rwsem_acquire(l, s, t, i)            lock_acquire(l, s, t, 0, 2, i)
-#  define rwsem_acquire_read(l, s, t, i)       lock_acquire(l, s, t, 1, 2, i)
+#  define rwsem_acquire(l, s, t, i)            lock_acquire(l, s, t, 0, 2, NULL, i)
+#  define rwsem_acquire_read(l, s, t, i)       lock_acquire(l, s, t, 1, 2, NULL, i)
 # else
-#  define rwsem_acquire(l, s, t, i)            lock_acquire(l, s, t, 0, 1, i)
-#  define rwsem_acquire_read(l, s, t, i)       lock_acquire(l, s, t, 1, 1, i)
+#  define rwsem_acquire(l, s, t, i)            lock_acquire(l, s, t, 0, 1, NULL, i)
+#  define rwsem_acquire_read(l, s, t, i)       lock_acquire(l, s, t, 1, 1, NULL, i)
 # endif
 # define rwsem_release(l, n, i)                        lock_release(l, n, i)
 #else
@@ -461,14 +470,14 @@ static inline void print_irqtrace_events(struct task_struct *curr)
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # ifdef CONFIG_PROVE_LOCKING
-#  define map_acquire(l)               lock_acquire(l, 0, 0, 0, 2, _THIS_IP_)
+#  define lock_map_acquire(l)          lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_)
 # else
-#  define map_acquire(l)               lock_acquire(l, 0, 0, 0, 1, _THIS_IP_)
+#  define lock_map_acquire(l)          lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_)
 # endif
-# define map_release(l)                        lock_release(l, 1, _THIS_IP_)
+# define lock_map_release(l)                   lock_release(l, 1, _THIS_IP_)
 #else
-# define map_acquire(l)                        do { } while (0)
-# define map_release(l)                        do { } while (0)
+# define lock_map_acquire(l)                   do { } while (0)
+# define lock_map_release(l)                   do { } while (0)
 #endif
 
 #endif /* __LINUX_LOCKDEP_H */