Commit d99d5917e7eff7308d11b76328102ad24d03af73

Authored by Linus Torvalds

Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking fixes from Ingo Molnar:
 "liblockdep fixes and mutex debugging fixes"

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  locking/mutex: Fix debug_mutexes
  tools/liblockdep: Add proper versioning to the shared obj
  tools/liblockdep: Ignore asmlinkage and visible

Showing 3 changed files Side-by-side Diff

kernel/locking/mutex-debug.c
... ... @@ -71,18 +71,17 @@
71 71  
72 72 void debug_mutex_unlock(struct mutex *lock)
73 73 {
74   - if (unlikely(!debug_locks))
75   - return;
  74 + if (likely(debug_locks)) {
  75 + DEBUG_LOCKS_WARN_ON(lock->magic != lock);
76 76  
77   - DEBUG_LOCKS_WARN_ON(lock->magic != lock);
  77 + if (!lock->owner)
  78 + DEBUG_LOCKS_WARN_ON(!lock->owner);
  79 + else
  80 + DEBUG_LOCKS_WARN_ON(lock->owner != current);
78 81  
79   - if (!lock->owner)
80   - DEBUG_LOCKS_WARN_ON(!lock->owner);
81   - else
82   - DEBUG_LOCKS_WARN_ON(lock->owner != current);
83   -
84   - DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
85   - mutex_clear_owner(lock);
  82 + DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
  83 + mutex_clear_owner(lock);
  84 + }
86 85  
87 86 /*
88 87 * __mutex_slowpath_needs_to_unlock() is explicitly 0 for debug
tools/lib/lockdep/Makefile
1   -# liblockdep version
2   -LL_VERSION = 0
3   -LL_PATCHLEVEL = 0
4   -LL_EXTRAVERSION = 1
5   -
6 1 # file format version
7 2 FILE_VERSION = 1
8 3  
9 4 MAKEFLAGS += --no-print-directory
  5 +LIBLOCKDEP_VERSION=$(shell make -sC ../../.. kernelversion)
10 6  
11   -
12 7 # Makefiles suck: This macro sets a default value of $(2) for the
13 8 # variable named by $(1), unless the variable has been set by
14 9 # environment or command line. This is necessary for CC and AR
... ... @@ -98,7 +93,7 @@
98 93 libdir_SQ = $(subst ','\'',$(libdir))
99 94 bindir_SQ = $(subst ','\'',$(bindir))
100 95  
101   -LIB_FILE = liblockdep.a liblockdep.so
  96 +LIB_FILE = liblockdep.a liblockdep.so.$(LIBLOCKDEP_VERSION)
102 97 BIN_FILE = lockdep
103 98  
104 99 CONFIG_INCLUDES =
... ... @@ -110,8 +105,6 @@
110 105  
111 106 export Q VERBOSE
112 107  
113   -LIBLOCKDEP_VERSION = $(LL_VERSION).$(LL_PATCHLEVEL).$(LL_EXTRAVERSION)
114   -
115 108 INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES)
116 109  
117 110 # Set compile option CFLAGS if not set elsewhere
... ... @@ -146,7 +139,7 @@
146 139  
147 140 do_compile_shared_library = \
148 141 ($(print_shared_lib_compile) \
149   - $(CC) --shared $^ -o $@ -lpthread -ldl)
  142 + $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$@"';$(shell ln -s $@ liblockdep.so))
150 143  
151 144 do_build_static_lib = \
152 145 ($(print_static_lib_build) \
... ... @@ -177,7 +170,7 @@
177 170  
178 171 all_cmd: $(CMD_TARGETS)
179 172  
180   -liblockdep.so: $(PEVENT_LIB_OBJS)
  173 +liblockdep.so.$(LIBLOCKDEP_VERSION): $(PEVENT_LIB_OBJS)
181 174 $(Q)$(do_compile_shared_library)
182 175  
183 176 liblockdep.a: $(PEVENT_LIB_OBJS)
tools/lib/lockdep/uinclude/linux/lockdep.h
... ... @@ -10,6 +10,9 @@
10 10  
11 11 #define MAX_LOCK_DEPTH 2000UL
12 12  
  13 +#define asmlinkage
  14 +#define __visible
  15 +
13 16 #include "../../../include/linux/lockdep.h"
14 17  
15 18 struct task_struct {