Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754374AbbDONNU (ORCPT ); Wed, 15 Apr 2015 09:13:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37764 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751809AbbDONNM (ORCPT ); Wed, 15 Apr 2015 09:13:12 -0400 Date: Wed, 15 Apr 2015 15:13:09 +0200 From: Greg Kroah-Hartman To: Al Viro Cc: Jiri Kosina , Borislav Petkov , Andy Lutomirski , Linus Torvalds , Andrew Morton , Arnd Bergmann , "Eric W. Biederman" , One Thousand Gnomes , Tom Gundersen , "linux-kernel@vger.kernel.org" , Daniel Mack , David Herrmann , Djalal Harouni Subject: Re: [GIT PULL] kdbus for 4.1-rc1 Message-ID: <20150415131309.GA21491@kroah.com> References: <20150414192357.GA6107@kroah.com> <20150414192429.GC26075@pd.tnic> <20150414193229.GB6107@kroah.com> <20150414194004.GG889@ZenIV.linux.org.uk> <20150414194804.GB7540@kroah.com> <20150414195336.GG14069@pd.tnic> <20150415084440.GF16381@kroah.com> <20150415090948.GA17347@kroah.com> <20150415123632.GJ889@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150415123632.GJ889@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2486 Lines: 48 On Wed, Apr 15, 2015 at 01:36:33PM +0100, Al Viro wrote: > al@duke:~/linux/trees/vfs$ git grep -n -w kdbus_node_idr_lock > ipc/kdbus/node.c:237:static DECLARE_RWSEM(kdbus_node_idr_lock); > ipc/kdbus/node.c:340: down_write(&kdbus_node_idr_lock); > ipc/kdbus/node.c:344: up_write(&kdbus_node_idr_lock); > ipc/kdbus/node.c:444: down_write(&kdbus_node_idr_lock); > ipc/kdbus/node.c:452: up_write(&kdbus_node_idr_lock); Heh, that's a leftover from an older version, I'll go fix that up to be a simple mutex, which is all that this is doing here anyway. > Do you see anything wrong with that? Or with things like that: > mutex_lock(&pos->lock); > v_pre = atomic_read(&pos->active); > if (v_pre >= 0) > atomic_add_return(KDBUS_NODE_BIAS, &pos->active); > else if (v_pre == KDBUS_NODE_NEW) > atomic_set(&pos->active, KDBUS_NODE_RELEASE_DIRECT); > mutex_unlock(&pos->lock); > What are the locking rules for ->active/->waitq/->lock? Are those the > outermost thing in the hierarchy? Or is that dependent on the node location? > It sure as hell is outside of (at least) ->mmap_sem (by way of > kdbus_conn_connect() establishing that ->active/->waitq is outside of > ->conn_rwlock, which due to kdbus_bus_broadcast() nests outside of anything > taken by kdbus_meta_proc_collect(), which includes ->mmap_sem) and that alone > brings in a lot... > > Document your goddamn locking, would you? It *IS* new code, and you, as you > say, had very few people working on it, so you don't have the excuses for > the mess existing in older parts of the tree. Fair enough, documenting the locking is a good thing, that will make reviewing this easier, I'll go work on that. > Locking complexity in there is easily as bad as that of VFS sans the RCU fun; > sure, I can spend a week and (hopefully) document it for you, but I would > really prefer if you guys had done that. And I *do* appreciate the comments > in node.c, but they are nowhere near enough. Thanks, it's hard to balance the comment/code level at times. And yes, it is complex and should be explained better, will work on that. greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/