aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/lockdep_types.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-09-30 11:49:37 +0200
committerIngo Molnar <mingo@kernel.org>2020-10-09 08:53:08 +0200
commit2bb8945bcc1a768f2bc402a16c9610bba8d5187d (patch)
treebf7547f8e6361941a5838adeba9d80c2e55825f4 /include/linux/lockdep_types.h
parentMerge tag 'block5.9-2020-10-08' of git://git.kernel.dk/linux-block (diff)
downloadlinux-dev-2bb8945bcc1a768f2bc402a16c9610bba8d5187d.tar.xz
linux-dev-2bb8945bcc1a768f2bc402a16c9610bba8d5187d.zip
lockdep: Fix usage_traceoverflow
Basically print_lock_class_header()'s for loop is out of sync with the the size of of ->usage_traces[]. Also clean things up a bit while at it, to avoid such mishaps in the future. Fixes: 23870f122768 ("locking/lockdep: Fix "USED" <- "IN-NMI" inversions") Reported-by: Qian Cai <cai@redhat.com> Debugged-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: Qian Cai <cai@redhat.com> Link: https://lkml.kernel.org/r/20200930094937.GE2651@hirez.programming.kicks-ass.net
Diffstat (limited to 'include/linux/lockdep_types.h')
-rw-r--r--include/linux/lockdep_types.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/lockdep_types.h b/include/linux/lockdep_types.h
index bb35b449f533..9a1fd49df17f 100644
--- a/include/linux/lockdep_types.h
+++ b/include/linux/lockdep_types.h
@@ -35,8 +35,12 @@ enum lockdep_wait_type {
/*
* We'd rather not expose kernel/lockdep_states.h this wide, but we do need
* the total number of states... :-(
+ *
+ * XXX_LOCK_USAGE_STATES is the number of lines in lockdep_states.h, for each
+ * of those we generates 4 states, Additionally we report on USED and USED_READ.
*/
-#define XXX_LOCK_USAGE_STATES (1+2*4)
+#define XXX_LOCK_USAGE_STATES 2
+#define LOCK_TRACE_STATES (XXX_LOCK_USAGE_STATES*4 + 2)
/*
* NR_LOCKDEP_CACHING_CLASSES ... Number of classes
@@ -106,7 +110,7 @@ struct lock_class {
* IRQ/softirq usage tracking bits:
*/
unsigned long usage_mask;
- const struct lock_trace *usage_traces[XXX_LOCK_USAGE_STATES];
+ const struct lock_trace *usage_traces[LOCK_TRACE_STATES];
/*
* Generation counter, when doing certain classes of graph walking,