Skip to contentSkip to conversation

locking fixes

GIT PULL Ingo Molnar 1 participant 1 message Apr 18, 2015 Locking primitives

lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest locking-urgent-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking-urgent-for-linus

# HEAD: 8053871d0f7f67c7efb7f226ef031f78877d6625 smp: Fix smp_call_function_single_async() locking

Two fixes: your smp-call fix and a lockdep fix.

Thanks,

Ingo

------------------>
Linus Torvalds (1):
smp: Fix smp_call_function_single_async() locking

Peter Zijlstra (1):
lockdep: Make print_lock() robust against concurrent release

 kernel/locking/lockdep.c | 16 +++++++++-
 kernel/smp.c             | 78 +++++++++++++++++++++++++++++-------------------
 2 files changed, 62 insertions(+), 32 deletions(-)
kernel/locking/lockdep.c +15 -1
index ba77ab5f64dd..a0831e1b99f4 100644
@@ -551,7 +551,21 @@ static void print_lockdep_cache(struct lockdep_map *lock)
 
 static void print_lock(struct held_lock *hlock)
 {
-	print_lock_name(hlock_class(hlock));
+	/*
+	 * We can be called locklessly through debug_show_all_locks() so be
+	 * extra careful, the hlock might have been released and cleared.
+	 */
+	unsigned int class_idx = hlock->class_idx;
+
+	/* Don't re-read hlock->class_idx, can't use READ_ONCE() on bitfields: */
+	barrier();
+
+	if (!class_idx || (class_idx - 1) >= MAX_LOCKDEP_KEYS) {
+		printk("<RELEASED>\n");
+		return;
+	}
+
+	print_lock_name(lock_classes + class_idx - 1);
 	printk(", at: ");
 	print_ip_sym(hlock->acquire_ip);
 }
kernel/smp.c +47 -31

157 lines not on this page · raw message