locktorture: Track time of last ->writeunlock()
authorPaul E. McKenney <paulmck@kernel.org>
Mon, 31 Aug 2020 04:48:23 +0000 (21:48 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Sat, 7 Nov 2020 01:13:29 +0000 (17:13 -0800)
This commit adds a last_lock_release variable that tracks the time of
the last ->writeunlock() call, which allows easier diagnosing of lock
hangs when using a kernel debugger.

Acked-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/locking/locktorture.c

index 62d215b2e39f608ff6ed313d0d876c288ce85161..316531de2a81c3c391ea5a004f767f278bb9d4a1 100644 (file)
@@ -60,6 +60,7 @@ static struct task_struct **reader_tasks;
 
 static bool lock_is_write_held;
 static bool lock_is_read_held;
+static unsigned long last_lock_release;
 
 struct lock_stress_stats {
        long n_lock_fail;
@@ -632,6 +633,7 @@ static int lock_torture_writer(void *arg)
                lwsp->n_lock_acquired++;
                cxt.cur_ops->write_delay(&rand);
                lock_is_write_held = false;
+               WRITE_ONCE(last_lock_release, jiffies);
                cxt.cur_ops->writeunlock();
 
                stutter_wait("lock_torture_writer");