[PATCH] lockdep: Recompute chain-key after validation_chain may tweak hlock->read

Chris Wilson chris at chris-wilson.co.uk
Wed Oct 28 18:12:23 UTC 2020


Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2606
Fixes: f611e8cf98ec ("lockdep: Take read/write status in consideration when generate chainkey")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 kernel/locking/lockdep.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 035f81b1cc87..4ccd6a4323ff 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -4831,7 +4831,10 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
 	if (!validate_chain(curr, hlock, chain_head, chain_key))
 		return 0;
 
-	curr->curr_chain_key = chain_key;
+	chain_key = hlock->prev_chain_key;
+	if (separate_irq_context(curr, hlock))
+		chain_key = INITIAL_CHAIN_KEY;
+	curr->curr_chain_key = iterate_chain_key(chain_key, hlock_id(hlock));
 	curr->lockdep_depth++;
 	check_chain_key(curr);
 #ifdef CONFIG_DEBUG_LOCKDEP
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list