mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gregory Haskins <ghaskins@novell.com>
To: Greg KH <greg@kroah.com>
Cc: Chuck Ebbert <cebbert@redhat.com>,
	Gregory Haskins <ghaskins@novell.com>,
	Peter Zijlstra <peterz@infradead.org>, stable <stable@kernel.org>,
	<mingo@elte.hu>, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] lockdep: fix mismatched lockdep_depth/curr_chain_hash
Date: Wed, 31 Oct 2007 11:44:05 -0400	[thread overview]
Message-ID: <20071031154313.15685.72379.stgit@ghaskins-t60p.haskins.net> (raw)

Hi Greg,
   Here is the backported version of the patch.  I applied it on top of
   2.6.22.10.  Let me know if you have any issues.

-Greg

------------------------------
lockdep: fix mismatched lockdep_depth/curr_chain_hash

It is possible for the current->curr_chain_key to become inconsistent with the
current index if the chain fails to validate.  The end result is that future
lock_acquire() operations may inadvertently fail to find a hit in the cache
resulting in a new node being added to the graph for every acquire.

[ peterz: this might explain some of the lockdep is so _slow_ complaints. ]
[ mingo: this does not impact the correctness of validation, but may slow
  down future operations significantly, if the chain gets very long. ]

Signed-off-by: Gregory Haskins <ghaskins@novell.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---

 kernel/lockdep.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 1a5ff22..072cf25 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2166,7 +2166,6 @@ out_calc_hash:
 	}
 #endif
 	chain_key = iterate_chain_key(chain_key, id);
-	curr->curr_chain_key = chain_key;
 
 	/*
 	 * Trylock needs to maintain the stack of held locks, but it
@@ -2215,6 +2214,7 @@ out_calc_hash:
 		if (unlikely(!debug_locks))
 			return 0;
 
+	curr->curr_chain_key = chain_key;
 	curr->lockdep_depth++;
 	check_chain_key(curr);
 #ifdef CONFIG_DEBUG_LOCKDEP


             reply	other threads:[~2007-10-31 15:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-31 15:44 Gregory Haskins [this message]
2007-10-31 16:19 ` Peter Zijlstra
2007-10-31 16:24 ` [stable] " Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2007-10-05  4:22 [PATCH] LOCKDEP: " Gregory Haskins
2007-10-05  9:31 ` [PATCH] lockdep: " Peter Zijlstra
2007-10-05  4:03 [PATCH] LOCKDEP: " Gregory Haskins
2007-10-05  9:31 ` [PATCH] lockdep: " Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071031154313.15685.72379.stgit@ghaskins-t60p.haskins.net \
    --to=ghaskins@novell.com \
    --cc=cebbert@redhat.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®