From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757309AbcCaPxM (ORCPT ); Thu, 31 Mar 2016 11:53:12 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:36000 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757185AbcCaPxK (ORCPT ); Thu, 31 Mar 2016 11:53:10 -0400 Date: Thu, 31 Mar 2016 23:52:21 +0800 From: Boqun Feng To: Peter Zijlstra Cc: Ingo Molnar , Alfredo Alvarez Fernandez , Linus Torvalds , Sedat Dilek , "Theodore Ts'o" , linux-fsdevel , LKML Subject: Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Message-ID: <20160331155221.GA19435@fixme-laptop.cn.ibm.com> References: <20160327204810.GW6356@twins.programming.kicks-ass.net> <20160329084701.GA9393@gmail.com> <20160330093659.GS3408@twins.programming.kicks-ass.net> <20160330095954.GB14352@fixme-laptop.cn.ibm.com> <20160331154234.GA3448@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pf9I7BMVVzbSWLtt" Content-Disposition: inline In-Reply-To: <20160331154234.GA3448@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --pf9I7BMVVzbSWLtt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: > >=20 > > http://lkml.kernel.org/g/1455602265-16490-2-git-send-email-boqun.feng@g= mail.com > >=20 > > if you don't think that overkills ;-) >=20 > I changed it into the below; since I did significant edits, let me know > if you disagree and / or want your name taken off. >=20 Thank you, Peter! It looks good to me ;-) Regards, Boqun > --- > Subject: lockdep: Add task_irq_context() > From: Boqun Feng > Date: Tue, 16 Feb 2016 13:57:40 +0800 >=20 > 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) >=20 > Cc: Lai Jiangshan > Cc: Mathieu Desnoyers > Cc: Steven Rostedt > Cc: Ingo Molnar > Cc: Josh Triplett > Cc: sasha.levin@oracle.com > Cc: "Paul E. McKenney" > Signed-off-by: Boqun Feng > Signed-off-by: Peter Zijlstra (Intel) > Link: http://lkml.kernel.org/r/1455602265-16490-2-git-send-email-boqun.fe= ng@gmail.com > --- > kernel/locking/lockdep.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) >=20 > --- a/kernel/locking/lockdep.c > +++ b/kernel/locking/lockdep.c > @@ -2932,6 +2932,11 @@ static int mark_irqflags(struct task_str > return 1; > } > =20 > +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 =3D 2*(curr->hardirq_context ? 1 : 0) + > - curr->softirq_context; > if (depth) { > struct held_lock *prev_hlock; > =20 > @@ -2973,6 +2976,11 @@ static inline int mark_irqflags(struct t > return 1; > } > =20 > +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 =3D ip; > hlock->instance =3D lock; > hlock->nest_lock =3D nest_lock; > + hlock->irq_context =3D task_irq_context(curr); > hlock->trylock =3D trylock; > hlock->read =3D read; > hlock->check =3D check; --pf9I7BMVVzbSWLtt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJW/UeuAAoJEEl56MO1B/q4ya0H/jUS26zR7lKsuMxOZtmbg+bO LO5qVANsNNHDldeQnMDHos8IkbxWetsaeW9Sokp+kfsW4MCypmhZ+kkSUIbXEdHc JdKdQmxeFftf8k4MiHNCLRbB06TzySUHgCkzFvE4l4yC1Dge12FGKuMNGmgCg3Yn ML6n7KX5vppCUFoQivoe4Nk2oH4gnRY7H2pPybrMXEfY/6xbQcWTOC3VAC5pNz23 jy5Bm4d4NPiN9QGrOiLU77car6v/JKatHy5Zo2ZHlGj89EWGMPnb8O+rBruRBIvl fjtE/kx2kKinxtwTZa6WzKdF654PbYimWzpvNeMZ2Iof3gqNsnG8//vdJHCVre4= =WBQD -----END PGP SIGNATURE----- --pf9I7BMVVzbSWLtt--