From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750766AbWAaLVS (ORCPT ); Tue, 31 Jan 2006 06:21:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750767AbWAaLVS (ORCPT ); Tue, 31 Jan 2006 06:21:18 -0500 Received: from mx2.mail.elte.hu ([157.181.151.9]:47302 "EHLO mx2.mail.elte.hu") by vger.kernel.org with ESMTP id S1750766AbWAaLVS (ORCPT ); Tue, 31 Jan 2006 06:21:18 -0500 Date: Tue, 31 Jan 2006 12:21:54 +0100 From: Ingo Molnar To: "David S. Miller" Cc: herbert@gondor.apana.org.au, davem@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [lock validator] inet6_destroy_sock(): soft-safe -> soft-unsafe lock dependency Message-ID: <20060131112154.GA21099@elte.hu> References: <20060128152204.GA13940@elte.hu> <20060131102758.GA31460@gondor.apana.org.au> <20060131.024323.83813817.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060131.024323.83813817.davem@davemloft.net> User-Agent: Mutt/1.4.2.1i X-ELTE-SpamScore: -2.2 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-2.2 required=5.9 tests=ALL_TRUSTED,AWL autolearn=no SpamAssassin version=3.0.3 -2.8 ALL_TRUSTED Did not pass through any untrusted hosts 0.6 AWL AWL: From: address is in the auto white-list X-ELTE-VirusStatus: clean Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org * David S. Miller wrote: > From: Herbert Xu > Date: Tue, 31 Jan 2006 21:27:58 +1100 > > > tcp_close is only called from process context. The rule for sk_dst_lock > > is that it must also only be obtained in process context. On the other > > hand, it is true that sk_lock can be obtained in softirq context. > > > > In this particular case, sk_dst_lock is obtained by tcp_close with > > softirqs disabled. This is not a problem in itself since we're not > > trying to get sk_dst_lock from a real softirq context (as opposed to > > process context with softirq disabled). > > > > I believe this warning comes about because the validator creates a > > dependency between sk_lock and sk_dst_lock. It then infers from this > > dependency that in softirq contexts where sk_lock is obtained the code > > may also attempt to obtain sk_dst_lock. > > > > This inference is where the validator errs. sk_dst_lock is never > > (or should never be, and as far as I can see none of the traces show > > it to do so) obtained in a real softirq context. > > Herbert's analysis is correct. This unique locking strategy is used > by tcp_close() because at this point it knows that every single > reference to this socket in the system is gone once it takes the > socket lock with BH disabled. > > And that known invariant is why this is correct, and the locking > validator has no way to figure this out. ok, thanks for the analysis! I'll fix this with an explicit hint to the validator. Ingo