aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorByungchul Park <byungchul.park@lge.com>2017-08-07 03:12:52 -0400
committerIngo Molnar <mingo@kernel.org>2017-08-10 06:29:07 -0400
commitb09be676e0ff25bd6d2e7637e26d349f9109ad75 (patch)
tree8dc82ceaa001d29bb07a51f5c4814759b303e8e4 /kernel/workqueue.c
parentce07a9415f266e181a0a33033a5f7138760240a4 (diff)
locking/lockdep: Implement the 'crossrelease' feature
Lockdep is a runtime locking correctness validator that detects and reports a deadlock or its possibility by checking dependencies between locks. It's useful since it does not report just an actual deadlock but also the possibility of a deadlock that has not actually happened yet. That enables problems to be fixed before they affect real systems. However, this facility is only applicable to typical locks, such as spinlocks and mutexes, which are normally released within the context in which they were acquired. However, synchronization primitives like page locks or completions, which are allowed to be released in any context, also create dependencies and can cause a deadlock. So lockdep should track these locks to do a better job. The 'crossrelease' implementation makes these primitives also be tracked. Signed-off-by: Byungchul Park <byungchul.park@lge.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: akpm@linux-foundation.org Cc: boqun.feng@gmail.com Cc: kernel-team@lge.com Cc: kirill@shutemov.name Cc: npiggin@gmail.com Cc: walken@google.com Cc: willy@infradead.org Link: http://lkml.kernel.org/r/1502089981-21272-6-git-send-email-byungchul.park@lge.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ca937b0c3a96..e86733a8b344 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2093,6 +2093,7 @@ __acquires(&pool->lock)
2093 2093
2094 lock_map_acquire_read(&pwq->wq->lockdep_map); 2094 lock_map_acquire_read(&pwq->wq->lockdep_map);
2095 lock_map_acquire(&lockdep_map); 2095 lock_map_acquire(&lockdep_map);
2096 crossrelease_hist_start(XHLOCK_PROC);
2096 trace_workqueue_execute_start(work); 2097 trace_workqueue_execute_start(work);
2097 worker->current_func(work); 2098 worker->current_func(work);
2098 /* 2099 /*
@@ -2100,6 +2101,7 @@ __acquires(&pool->lock)
2100 * point will only record its address. 2101 * point will only record its address.
2101 */ 2102 */
2102 trace_workqueue_execute_end(work); 2103 trace_workqueue_execute_end(work);
2104 crossrelease_hist_end(XHLOCK_PROC);
2103 lock_map_release(&lockdep_map); 2105 lock_map_release(&lockdep_map);
2104 lock_map_release(&pwq->wq->lockdep_map); 2106 lock_map_release(&pwq->wq->lockdep_map);
2105 2107