From: Boqun Feng <boqun.feng@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Josh Triplett <josh@joshtriplett.org>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
sasha.levin@oracle.com, Boqun Feng <boqun.feng@gmail.com>
Subject: [RFC 1/6] lockdep: Add helper functions of irq_context
Date: Thu, 4 Feb 2016 00:45:07 +0800 [thread overview]
Message-ID: <1454517912-10457-2-git-send-email-boqun.feng@gmail.com> (raw)
In-Reply-To: <1454517912-10457-1-git-send-email-boqun.feng@gmail.com>
Add two helper functions of irq_context:
task_irq_context(): return 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)
is_same_irq_context(): compare whether two irq_context are the same.
Always return true if !(CONFIG_TRACE_IRQFLAGS && CONFIG_PROVE_LOCKING)
These two functions are added for the future use of irq_context by
LOCKED_ACCESS, because LOCKED_ACCESS needs to get the irq_context value
of a task when a data access happens rather than when a lock is
acquired, so it needs another way than getting the value from
held_lock::irq_context
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
kernel/locking/lockdep.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 60ace56..c8a632b 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -2839,6 +2839,16 @@ static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock)
return 1;
}
+static unsigned int task_irq_context(struct task_struct *task)
+{
+ return 2 * (task->hardirq_context ? 1 : 0) + task->softirq_context;
+}
+
+static bool is_same_irq_context(unsigned int ctx1, unsigned int ctx2)
+{
+ return ctx1 == ctx2;
+}
+
static int separate_irq_context(struct task_struct *curr,
struct held_lock *hlock)
{
@@ -2847,8 +2857,7 @@ 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;
+ hlock->irq_context = task_irq_context(curr);
if (depth) {
struct held_lock *prev_hlock;
@@ -2880,6 +2889,16 @@ static inline int mark_irqflags(struct task_struct *curr,
return 1;
}
+static unsigned int task_irq_context(struct task_struct *task)
+{
+ return 0;
+}
+
+static bool is_same_irq_context(unsigned int ctx1, unsigned int ctx2)
+{
+ return true;
+}
+
static inline int separate_irq_context(struct task_struct *curr,
struct held_lock *hlock)
{
--
2.7.0
next prev parent reply other threads:[~2016-02-03 16:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 16:45 [RFC 0/6] Track RCU dereferences in RCU read-side critical sections Boqun Feng
2016-02-03 16:45 ` Boqun Feng [this message]
2016-02-03 16:45 ` [RFC 2/6] lockdep: LOCKED_ACCESS: Introduce locked access class and acqchain Boqun Feng
2016-02-03 16:45 ` [RFC 3/6] lockdep: LOCKED_ACCESS: Maintain the keys of acqchains Boqun Feng
2016-02-03 16:45 ` [RFC 4/6] lockdep: LOCKED_ACCESS: Introduce locked_access_point() Boqun Feng
2016-02-03 16:45 ` [RFC 5/6] lockdep: LOCKED_ACCESS: Add proc interface for locked access class Boqun Feng
2016-02-03 16:45 ` [RFC 6/6] RCU: Track rcu_dereference() in RCU read-side critical section Boqun Feng
2016-02-16 1:05 ` Paul E. McKenney
2016-02-16 3:01 ` Boqun Feng
2016-02-16 4:08 ` Paul E. McKenney
2016-02-16 4:59 ` Boqun Feng
2016-02-16 5:55 ` Josh Triplett
2016-02-15 18:03 ` [RFC 0/6] Track RCU dereferences in RCU read-side critical sections 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=1454517912-10457-2-git-send-email-boqun.feng@gmail.com \
--to=boqun.feng@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@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=sasha.levin@oracle.com \
/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
all inboxes | Powered by JetHome®