summaryrefslogtreecommitdiffstats
path: root/include/linux/lockdep.h
diff options
context:
space:
mode:
authorByungchul Park <byungchul.park@lge.com>2017-08-07 03:12:53 -0400
committerIngo Molnar <mingo@kernel.org>2017-08-10 06:29:08 -0400
commit23f873d8f9526ed7e49a1a02a45f8afb9ae5fb84 (patch)
treec926e87ad1197db61dca6677b5e7e7184271698a /include/linux/lockdep.h
parentb09be676e0ff25bd6d2e7637e26d349f9109ad75 (diff)
locking/lockdep: Detect and handle hist_lock ring buffer overwrite
The ring buffer can be overwritten by hardirq/softirq/work contexts. That cases must be considered on rollback or commit. For example, |<------ hist_lock ring buffer size ----->| ppppppppppppiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii wrapped > iiiiiiiiiiiiiiiiiiiiiii.................... where 'p' represents an acquisition in process context, 'i' represents an acquisition in irq context. On irq exit, crossrelease tries to rollback idx to original position, but it should not because the entry already has been invalid by overwriting 'i'. Avoid rollback or commit for entries overwritten. 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-7-git-send-email-byungchul.park@lge.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/lockdep.h')
-rw-r--r--include/linux/lockdep.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index e1e0fcd99613..c75eedd55af5 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -284,6 +284,26 @@ struct held_lock {
284 */ 284 */
285struct hist_lock { 285struct hist_lock {
286 /* 286 /*
287 * Id for each entry in the ring buffer. This is used to
288 * decide whether the ring buffer was overwritten or not.
289 *
290 * For example,
291 *
292 * |<----------- hist_lock ring buffer size ------->|
293 * pppppppppppppppppppppiiiiiiiiiiiiiiiiiiiiiiiiiiiii
294 * wrapped > iiiiiiiiiiiiiiiiiiiiiiiiiii.......................
295 *
296 * where 'p' represents an acquisition in process
297 * context, 'i' represents an acquisition in irq
298 * context.
299 *
300 * In this example, the ring buffer was overwritten by
301 * acquisitions in irq context, that should be detected on
302 * rollback or commit.
303 */
304 unsigned int hist_id;
305
306 /*
287 * Seperate stack_trace data. This will be used at commit step. 307 * Seperate stack_trace data. This will be used at commit step.
288 */ 308 */
289 struct stack_trace trace; 309 struct stack_trace trace;