From: tip-bot for Boqun Feng <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: torvalds@linux-foundation.org, hpa@zytor.com,
linux-kernel@vger.kernel.org, mingo@kernel.org,
mathieu.desnoyers@efficios.com, josh@joshtriplett.org,
rostedt@goodmis.org, akpm@linux-foundation.org,
boqun.feng@gmail.com, jiangshanlai@gmail.com,
paulmck@linux.vnet.ibm.com, tglx@linutronix.de,
peterz@infradead.org
Subject: [tip:locking/urgent] locking/lockdep: Fix ->irq_context calculation
Date: Sat, 23 Apr 2016 05:53:59 -0700 [thread overview]
Message-ID: <tip-c24697566298df04cac9913e0601501b5ee2b3f5@git.kernel.org> (raw)
In-Reply-To: <1455602265-16490-2-git-send-email-boqun.feng@gmail.com>
Commit-ID: c24697566298df04cac9913e0601501b5ee2b3f5
Gitweb: http://git.kernel.org/tip/c24697566298df04cac9913e0601501b5ee2b3f5
Author: Boqun Feng <boqun.feng@gmail.com>
AuthorDate: Tue, 16 Feb 2016 13:57:40 +0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 23 Apr 2016 13:53:03 +0200
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>
---
kernel/locking/lockdep.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index ed94109..beb06f6 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)
return 1;
}
+static inline unsigned int task_irq_context(struct task_struct *task)
+{
+ return 2 * !!task->hardirq_context + !!task->softirq_context;
+}
+
static int separate_irq_context(struct task_struct *curr,
struct held_lock *hlock)
{
@@ -2940,8 +2945,6 @@ static int separate_irq_context(struct task_struct *curr,
/*
* Keep track of points where we cross into an interrupt context:
*/
- hlock->irq_context = 2*(curr->hardirq_context ? 1 : 0) +
- curr->softirq_context;
if (depth) {
struct held_lock *prev_hlock;
@@ -2973,6 +2976,11 @@ static inline int mark_irqflags(struct task_struct *curr,
return 1;
}
+static inline unsigned int task_irq_context(struct task_struct *task)
+{
+ return 0;
+}
+
static inline int separate_irq_context(struct task_struct *curr,
struct held_lock *hlock)
{
@@ -3241,6 +3249,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
hlock->acquire_ip = ip;
hlock->instance = lock;
hlock->nest_lock = nest_lock;
+ hlock->irq_context = task_irq_context(curr);
hlock->trylock = trylock;
hlock->read = read;
hlock->check = check;
next prev parent reply other threads:[~2016-04-23 12:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 5:57 [RFC v2 0/6] Track RCU dereferences in RCU read-side critical sections Boqun Feng
2016-02-16 5:57 ` [RFC v2 1/6] lockdep: Add helper functions of irq_context Boqun Feng
2016-02-17 0:17 ` Paul E. McKenney
2016-04-23 12:53 ` tip-bot for Boqun Feng [this message]
2016-02-16 5:57 ` [RFC v2 2/6] lockdep: LOCKED_ACCESS: Introduce locked access class and acqchain Boqun Feng
2016-02-16 5:57 ` [RFC v2 3/6] lockdep: LOCKED_ACCESS: Maintain the keys of acqchains Boqun Feng
2016-02-16 5:57 ` [RFC v2 4/6] lockdep: LOCKED_ACCESS: Introduce locked_access_point() Boqun Feng
2016-02-16 5:57 ` [RFC v2 5/6] lockdep: LOCKED_ACCESS: Add proc interface for locked access class Boqun Feng
2016-02-16 5:57 ` [RFC v2 6/6] RCU: Track rcu_dereference() in RCU read-side critical section Boqun Feng
2016-02-25 14:32 ` [RFC v2 0/6] Track RCU dereferences in RCU read-side critical sections Peter Zijlstra
2016-02-25 15:37 ` Paul E. McKenney
2016-02-26 3:06 ` Boqun Feng
2016-02-26 11:25 ` Peter Zijlstra
2016-02-29 1:12 ` Boqun Feng
2016-02-29 12:43 ` Peter Zijlstra
2016-03-01 9:32 ` Boqun Feng
2016-03-01 9:57 ` Peter Zijlstra
2016-03-01 10:01 ` Peter Zijlstra
2016-03-02 6:37 ` Boqun Feng
2016-03-02 10:18 ` Peter Zijlstra
2016-03-02 14:08 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-c24697566298df04cac9913e0601501b5ee2b3f5@git.kernel.org \
--to=tipbot@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=boqun.feng@gmail.com \
--cc=hpa@zytor.com \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox