From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756806AbdJKCgk (ORCPT ); Tue, 10 Oct 2017 22:36:40 -0400 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:46589 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752198AbdJKCgj (ORCPT ); Tue, 10 Oct 2017 22:36:39 -0400 X-Original-SENDERIP: 156.147.1.125 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com Date: Wed, 11 Oct 2017 11:36:36 +0900 From: Byungchul Park To: Linus Torvalds Cc: Fengguang Wu , Ingo Molnar , "Peter Zijlstra (Intel)" , Linux Kernel Mailing List , LKP , Josh Poimboeuf , kernel-team@lge.com Subject: Re: [lockdep] b09be676e0 BUG: unable to handle kernel NULL pointer dereference at 000001f2 Message-ID: <20171011023635.GI3323@X58A-UD3R> References: <20171003140634.r2jzujgl62ox4uzh@wfg-t540p.sh.intel.com> <20171010054801.GD3323@X58A-UD3R> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 10, 2017 at 09:56:26AM -0700, Linus Torvalds wrote: > On Tue, Oct 10, 2017 at 9:22 AM, Linus Torvalds > 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============2435932787307819960==" MIME-Version: 1.0 From: Byungchul Park To: lkp@lists.01.org Subject: Re: [lockdep] b09be676e0 BUG: unable to handle kernel NULL pointer dereference at 000001f2 Date: Wed, 11 Oct 2017 11:36:36 +0900 Message-ID: <20171011023635.GI3323@X58A-UD3R> In-Reply-To: List-Id: --===============2435932787307819960== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue, Oct 10, 2017 at 09:56:26AM -0700, Linus Torvalds wrote: > On Tue, Oct 10, 2017 at 9:22 AM, Linus Torvalds > 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. --===============2435932787307819960==--