[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160331155221.GA19435@fixme-laptop.cn.ibm.com>
Date: Thu, 31 Mar 2016 23:52:21 +0800
From: Boqun Feng <boqun.feng@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Alfredo Alvarez Fernandez <alfredoalvarezfernandez@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Sedat Dilek <sedat.dilek@...il.com>,
Theodore Ts'o <tytso@....edu>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at
kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260
On Thu, Mar 31, 2016 at 05:42:34PM +0200, Peter Zijlstra wrote:
> 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.
>
Thank you, Peter! It looks good to me ;-)
Regards,
Boqun
> ---
> Subject: lockdep: Add task_irq_context()
> From: Boqun Feng <boqun.feng@...il.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@...il.com>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Josh Triplett <josh@...htriplett.org>
> Cc: sasha.levin@...cle.com
> Cc: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
> Signed-off-by: Boqun Feng <boqun.feng@...il.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.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;
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists