Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1368409

Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260
Date 2016-03-31 17:50 +0200
Message-ID <riN18-7fd-9@gated-at.bofh.it> (permalink)
References (2 earlier) <rhhG1-85z-1@gated-at.bofh.it> <rhpNf-56p-1@gated-at.bofh.it> <rhXvz-3qM-1@gated-at.bofh.it> <rikLx-3iV-9@gated-at.bofh.it> <rilez-3Ki-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Mar 30, 2016 at 05:59:54PM +0800, Boqun Feng wrote:
> So we should use macro like current_hardirq_context() here? Or
> considering the two helpers introduced in my RFC:
> 
> http://lkml.kernel.org/g/1455602265-16490-2-git-send-email-boqun.feng@gmail.com
> 
> if you don't think that overkills ;-)

I changed it into the below; since I did significant edits, let me know
if you disagree and / or want your name taken off.

---
Subject: lockdep: Add task_irq_context()
From: Boqun Feng <boqun.feng@gmail.com>
Date: Tue, 16 Feb 2016 13:57:40 +0800

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)

Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: sasha.levin@oracle.com
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1455602265-16490-2-git-send-email-boqun.feng@gmail.com
---
 kernel/locking/lockdep.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -2932,6 +2932,11 @@ static int mark_irqflags(struct task_str
 	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 t
 	/*
 	 * 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 t
 	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
 	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;

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-27 14:10 +0200
  Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Boqun Feng <boqun.feng@gmail.com> - 2016-03-27 15:40 +0200
  Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Theodore Ts'o <tytso@mit.edu> - 2016-03-27 20:30 +0200
    Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-27 21:50 +0200
      Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-27 22:30 +0200
  Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-27 22:50 +0200
    Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-27 23:50 +0200
    Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-28 08:40 +0200
    Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Ingo Molnar <mingo@kernel.org> - 2016-03-29 10:50 +0200
      Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 11:40 +0200
        Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-30 12:00 +0200
          Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 14:50 +0200
            Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-30 14:50 +0200
              Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 15:20 +0200
        Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 12:00 +0200
        Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Boqun Feng <boqun.feng@gmail.com> - 2016-03-30 12:10 +0200
          Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 12:40 +0200
            Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-30 13:10 +0200
          Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-31 17:50 +0200
            Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Boqun Feng <boqun.feng@gmail.com> - 2016-03-31 18:00 +0200
            Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-04-02 08:30 +0200
        Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 16:10 +0200
          Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-30 17:30 +0200
            [PATCH] lockdep: print chain_key collision information Alfredo Alvarez Fernandez <alfredoalvarezfernandez@gmail.com> - 2016-03-30 19:10 +0200
              Re: [PATCH] lockdep: print chain_key collision information Peter Zijlstra <peterz@infradead.org> - 2016-03-30 19:20 +0200
              [tip:core/urgent] locking/lockdep: Print chain_key collision  information tip-bot for Alfredo Alvarez Fernandez <tipbot@zytor.com> - 2016-04-01 08:40 +0200
      Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-30 11:40 +0200

csiph-web