[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171011023635.GI3323@X58A-UD3R>
Date: Wed, 11 Oct 2017 11:36:36 +0900
From: Byungchul Park <byungchul.park@....com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Fengguang Wu <fengguang.wu@...el.com>,
Ingo Molnar <mingo@...nel.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
LKP <lkp@...org>, Josh Poimboeuf <jpoimboe@...hat.com>,
kernel-team@....com
Subject: Re: [lockdep] b09be676e0 BUG: unable to handle kernel NULL pointer
dereference at 000001f2
On Tue, Oct 10, 2017 at 09:56:26AM -0700, Linus Torvalds wrote:
> On Tue, Oct 10, 2017 at 9:22 AM, Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
> >
> > I really would like to see the sites that do cross-thread lock/unlock
> > pairs themselves be annotated.
> >
> > So when you lock in one thread, and then unlock in another, I'd
> > actually prefer to see something like
> >
> > - T1:
> > lock_mutex_cross();
> >
> > - T2:
> > unlock_mutex_cross();
> >
> > to make it very explicit that *these* particular lock/unlock
> > operations are the fancy ones.
>
> Actually, let's make it even *more* obvious, and even easier for
> lockdep (and for humans) to see what's going on.
>
> So I think the best model would be something like this:
>
> - T1:
> mutex_lock(&lock)
> ...
> mutex_transfer(&lock)
>
> - T2:
> mutex_receive(&lock);
> ...
> mutex_unlock(&lock);
In addition, if we really need to use mutex locks in this way, I also
think it should work with the explicit primitives as you said.
Powered by blists - more mailing lists