diff options
author | Boqun Feng <boqun.feng@gmail.com> | 2016-02-16 00:57:40 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-04-23 07:53:03 -0400 |
commit | c24697566298df04cac9913e0601501b5ee2b3f5 (patch) | |
tree | 0390a5df22c355080175d28c6c0569bbee1fb362 /kernel/locking/lockdep.c | |
parent | fba7cd681b6155e2d93e7862fcd6f970336b83c3 (diff) |
locking/lockdep: Fix ->irq_context calculation
task_irq_context() returns the encoded irq_context of the task, the
return value is encoded in the same as ->irq_context of held_lock.
Always return 0 if !(CONFIG_TRACE_IRQFLAGS && CONFIG_PROVE_LOCKING)
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: sasha.levin@oracle.com
Link: http://lkml.kernel.org/r/1455602265-16490-2-git-send-email-boqun.feng@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/locking/lockdep.c')
-rw-r--r-- | kernel/locking/lockdep.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index ed9410936a22..beb06f604420 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c | |||
@@ -2932,6 +2932,11 @@ static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock) | |||
2932 | return 1; | 2932 | return 1; |
2933 | } | 2933 | } |
2934 | 2934 | ||
2935 | static inline unsigned int task_irq_context(struct task_struct *task) | ||
2936 | { | ||
2937 | return 2 * !!task->hardirq_context + !!task->softirq_context; | ||
2938 | } | ||
2939 | |||
2935 | static int separate_irq_context(struct task_struct *curr, | 2940 | static int separate_irq_context(struct task_struct *curr, |
2936 | struct held_lock *hlock) | 2941 | struct held_lock *hlock) |
2937 | { | 2942 | { |
@@ -2940,8 +2945,6 @@ static int separate_irq_context(struct task_struct *curr, | |||
2940 | /* | 2945 | /* |
2941 | * Keep track of points where we cross into an interrupt context: | 2946 | * Keep track of points where we cross into an interrupt context: |
2942 | */ | 2947 | */ |
2943 | hlock->irq_context = 2*(curr->hardirq_context ? 1 : 0) + | ||
2944 | curr->softirq_context; | ||
2945 | if (depth) { | 2948 | if (depth) { |
2946 | struct held_lock *prev_hlock; | 2949 | struct held_lock *prev_hlock; |
2947 | 2950 | ||
@@ -2973,6 +2976,11 @@ static inline int mark_irqflags(struct task_struct *curr, | |||
2973 | return 1; | 2976 | return 1; |
2974 | } | 2977 | } |
2975 | 2978 | ||
2979 | static inline unsigned int task_irq_context(struct task_struct *task) | ||
2980 | { | ||
2981 | return 0; | ||
2982 | } | ||
2983 | |||
2976 | static inline int separate_irq_context(struct task_struct *curr, | 2984 | static inline int separate_irq_context(struct task_struct *curr, |
2977 | struct held_lock *hlock) | 2985 | struct held_lock *hlock) |
2978 | { | 2986 | { |
@@ -3241,6 +3249,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
3241 | hlock->acquire_ip = ip; | 3249 | hlock->acquire_ip = ip; |
3242 | hlock->instance = lock; | 3250 | hlock->instance = lock; |
3243 | hlock->nest_lock = nest_lock; | 3251 | hlock->nest_lock = nest_lock; |
3252 | hlock->irq_context = task_irq_context(curr); | ||
3244 | hlock->trylock = trylock; | 3253 | hlock->trylock = trylock; |
3245 | hlock->read = read; | 3254 | hlock->read = read; |
3246 | hlock->check = check; | 3255 | hlock->check = check; |