Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754157Ab0AQRS6 (ORCPT ); Sun, 17 Jan 2010 12:18:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753756Ab0AQRS5 (ORCPT ); Sun, 17 Jan 2010 12:18:57 -0500 Received: from out01.mta.xmission.com ([166.70.13.231]:34104 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752267Ab0AQRS4 (ORCPT ); Sun, 17 Jan 2010 12:18:56 -0500 To: Ming Lei Cc: Greg KH , Linus Torvalds , KOSAKI Motohiro , Borislav Petkov , David Airlie , Linux Kernel Mailing List , Al Viro , Tejun Heo , Peter Zijlstra , Ingo Molnar , linux-pcmcia@lists.infradead.org, Dominik Brodowski Subject: Re: [PATCH] sysfs: Add lockdep annotations for the sysfs active reference References: <20091226094504.GA6214@liondog.tnic> <20091228092712.AA8C.A69D9226@jp.fujitsu.com> <4B3EB687.7000005@kernel.org> <20100118002647.35035e77@tom-lei> From: ebiederm@xmission.com (Eric W. Biederman) Date: Sun, 17 Jan 2010 09:18:34 -0800 In-Reply-To: <20100118002647.35035e77@tom-lei> (Ming Lei's message of "Mon\, 18 Jan 2010 00\:26\:47 +0800") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-XM-SPF: eid=;;;mid=;;;hst=in01.mta.xmission.com;;;ip=76.21.114.89;;;frm=ebiederm@xmission.com;;;spf=neutral X-SA-Exim-Connect-IP: 76.21.114.89 X-SA-Exim-Mail-From: ebiederm@xmission.com X-SA-Exim-Scanned: No (on in01.mta.xmission.com); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1726 Lines: 42 Ming Lei writes: > On Sat, 02 Jan 2010 13:37:12 -0800 > ebiederm@xmission.com (Eric W. Biederman) wrote: > >> >> Holding locks over device_del -> kobject_del -> sysfs_deactivate can >> cause deadlocks if those same locks are grabbed in sysfs show or store >> methods. >> >> The I model s_active count + completion as a sleeping read/write lock. >> I describe to lockdep sysfs_get_active as a read_trylock, >> sysfs_put_active as a read_unlock, and sysfs_deactivate as a >> write_lock and write_unlock pair. This seems to capture the essence >> for purposes of finding deadlocks, and in my testing gives finds real >> issues and ignores non-issues. >> >> This brings us back to holding locks over kobject_del is a problem >> that ideally we should find a way of addressing, but at least lockdep >> can tell us about the problems instead of requiring developers to >> debug rare strange system deadlocks, that happen when sysfs files are >> removed while being written to. > > The model has hit a possible deadlock in pcmcia, and the lockdep warning > comes when I unplug my wlan card from pcmcia slot. > > Looks like socket->skt_mutex is held in remove path, and it is also > grabbed in .stor method. Looking a little closer this is simultaneously a legitimate problem and also a false positive. This is only legitimate if you add/remove a cardbus bridge, plugged into another cardbus bridge, which I think is unlikely but physically possible. Eric -- 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/