]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tools/lib/lockdep/tests: Test the lockdep_reset_lock() implementation
authorBart Van Assche <bvanassche@acm.org>
Fri, 7 Dec 2018 01:11:31 +0000 (17:11 -0800)
committerIngo Molnar <mingo@kernel.org>
Tue, 11 Dec 2018 13:54:51 +0000 (14:54 +0100)
This patch makes sure that the lockdep_reset_lock() function gets
tested.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Waiman Long <longman@redhat.com>
Cc: johannes.berg@intel.com
Cc: tj@kernel.org
Link: https://lkml.kernel.org/r/20181207011148.251812-8-bvanassche@acm.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
tools/lib/lockdep/include/liblockdep/common.h
tools/lib/lockdep/include/liblockdep/mutex.h
tools/lib/lockdep/tests/ABBA.c
tools/lib/lockdep/tests/ABBCCA.c
tools/lib/lockdep/tests/ABBCCDDA.c
tools/lib/lockdep/tests/ABCABC.c
tools/lib/lockdep/tests/ABCDBCDA.c
tools/lib/lockdep/tests/ABCDBDDA.c
tools/lib/lockdep/tests/unlock_balance.c

index 8862da80995a8f2cc1419ce3c839ab43195ad884..d640a9761f09c87894bbc9fac3f6e24935c523e9 100644 (file)
@@ -44,6 +44,7 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
                        struct lockdep_map *nest_lock, unsigned long ip);
 void lock_release(struct lockdep_map *lock, int nested,
                        unsigned long ip);
+void lockdep_reset_lock(struct lockdep_map *lock);
 extern void debug_check_no_locks_freed(const void *from, unsigned long len);
 
 #define STATIC_LOCKDEP_MAP_INIT(_name, _key) \
index a80ac39f966ed3d6c01f3b335494120e0fde999e..2073d4e1f2f08fc8966a9a57fa31a64d7430e823 100644 (file)
@@ -54,6 +54,7 @@ static inline int liblockdep_pthread_mutex_trylock(liblockdep_pthread_mutex_t *l
 
 static inline int liblockdep_pthread_mutex_destroy(liblockdep_pthread_mutex_t *lock)
 {
+       lockdep_reset_lock(&lock->dep_map);
        return pthread_mutex_destroy(&lock->mutex);
 }
 
index 1460afd33d712c2469982190ea7a08019b3c0295..623313f5472095b302f6a0f3ce787f127ec65ab6 100644 (file)
@@ -11,4 +11,7 @@ void main(void)
 
        LOCK_UNLOCK_2(a, b);
        LOCK_UNLOCK_2(b, a);
+
+       pthread_mutex_destroy(&b);
+       pthread_mutex_destroy(&a);
 }
index a54c1b2af118242a12345f0d3dc5a205bf36e505..48446129d49662d004c48c6b7cade613b9d4317c 100644 (file)
@@ -13,4 +13,8 @@ void main(void)
        LOCK_UNLOCK_2(a, b);
        LOCK_UNLOCK_2(b, c);
        LOCK_UNLOCK_2(c, a);
+
+       pthread_mutex_destroy(&c);
+       pthread_mutex_destroy(&b);
+       pthread_mutex_destroy(&a);
 }
index aa5d194e88694ec95f5451083f62ed71ff842b00..3570bf7b38042fe3a96d8787cbe9d34b84fb73cb 100644 (file)
@@ -15,4 +15,9 @@ void main(void)
        LOCK_UNLOCK_2(b, c);
        LOCK_UNLOCK_2(c, d);
        LOCK_UNLOCK_2(d, a);
+
+       pthread_mutex_destroy(&d);
+       pthread_mutex_destroy(&c);
+       pthread_mutex_destroy(&b);
+       pthread_mutex_destroy(&a);
 }
index b54a08e60416f087a5fa60a0475d2bd6cdf70f6a..a1c4659894cd6aee10e3b958686c2a8fa00b8e81 100644 (file)
@@ -13,4 +13,8 @@ void main(void)
        LOCK_UNLOCK_2(a, b);
        LOCK_UNLOCK_2(c, a);
        LOCK_UNLOCK_2(b, c);
+
+       pthread_mutex_destroy(&c);
+       pthread_mutex_destroy(&b);
+       pthread_mutex_destroy(&a);
 }
index a56742250d86f10eedd065dc6b56b056197931a0..335af1c90ab53827fcb29f5e7a4ff9e83a5facf7 100644 (file)
@@ -15,4 +15,9 @@ void main(void)
        LOCK_UNLOCK_2(c, d);
        LOCK_UNLOCK_2(b, c);
        LOCK_UNLOCK_2(d, a);
+
+       pthread_mutex_destroy(&d);
+       pthread_mutex_destroy(&c);
+       pthread_mutex_destroy(&b);
+       pthread_mutex_destroy(&a);
 }
index 238a3353f3c353e9df9f40182fa20a432386bbdb..3c59728630493fc589834ab6714f25f76d3fc199 100644 (file)
@@ -15,4 +15,9 @@ void main(void)
        LOCK_UNLOCK_2(c, d);
        LOCK_UNLOCK_2(b, d);
        LOCK_UNLOCK_2(d, a);
+
+       pthread_mutex_destroy(&d);
+       pthread_mutex_destroy(&c);
+       pthread_mutex_destroy(&b);
+       pthread_mutex_destroy(&a);
 }
index 34cf32f689de00723cb0c7c55ccc29a77454c010..dba25064b50a83d4b0e5a8b1d6140b0c81c22817 100644 (file)
@@ -10,4 +10,6 @@ void main(void)
        pthread_mutex_lock(&a);
        pthread_mutex_unlock(&a);
        pthread_mutex_unlock(&a);
+
+       pthread_mutex_destroy(&a);
 }