LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] lockdep: comment hidden releases of graph_lock 
@ 2008-04-17 15:41 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2008-04-17 15:41 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, Ingo Molnar, akpm


While reviewing the lockdep.c code, it looked to me that I found a bug where
the release of the graph_lock was not done on failure. This turns out not
to be the case, because the graph_unlock is performed within the internal
functions of lockdep when a failure occurs.

To help out others when visually reviewing this code, I've added comments
to the places where it looks like it may be a bug not to call graph_unlock.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 kernel/lockdep.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-sched-devel.git/kernel/lockdep.c
===================================================================
--- linux-sched-devel.git.orig/kernel/lockdep.c	2008-04-17 10:52:40.000000000 -0400
+++ linux-sched-devel.git/kernel/lockdep.c	2008-04-17 11:20:49.000000000 -0400
@@ -1566,6 +1566,7 @@ static int validate_chain(struct task_st
 		/*
 		 * Add dependency only if this lock is not the head
 		 * of the chain, and if it's not a secondary read-lock:
+		 * (will do graph_unlock on failure)
 		 */
 		if (!chain_head && ret != 2)
 			if (!check_prevs_add(curr, hlock))
@@ -2284,6 +2285,7 @@ static int mark_lock(struct task_struct

 	this->class->usage_mask |= new_mask;

+	/* save_trace does graph_unlock on failure */
 	if (!save_trace(this->class->usage_traces + new_bit))
 		return 0;

@@ -2296,6 +2298,7 @@ static int mark_lock(struct task_struct
 	case LOCK_ENABLED_SOFTIRQS:
 	case LOCK_ENABLED_HARDIRQS_READ:
 	case LOCK_ENABLED_SOFTIRQS_READ:
+		/* mark_lock_irq does graph_unlock on failure */
 		ret = mark_lock_irq(curr, this, new_bit);
 		if (!ret)
 			return 0;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-17 15:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-17 15:41 [PATCH] lockdep: comment hidden releases of graph_lock Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).