From owner-freebsd-net@FreeBSD.ORG Mon Oct 12 04:38:34 2009 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E89B21065670; Mon, 12 Oct 2009 04:38:33 +0000 (UTC) (envelope-from inpcb.harsha@gmail.com) Received: from mail-pz0-f104.google.com (mail-pz0-f104.google.com [209.85.222.104]) by mx1.freebsd.org (Postfix) with ESMTP id B00E58FC19; Mon, 12 Oct 2009 04:38:33 +0000 (UTC) Received: by pzk2 with SMTP id 2so56608pzk.27 for ; Sun, 11 Oct 2009 21:38:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=kg19ioURrVW8nlWRB8B7SDXkqF7azLwDeBAZWHD1rog=; b=AkhPO54KKrJMUDoxXDbWq7eQT8tGIY4wDD7ocCOTOgCLewTIH8W8bFCmcDQj6VcnDZ OmSKfg/c9T2nrWfLud/cBFpXKRFbR9RKmdbpw/6eImAvWC2RNMQqyYzJGmRYnQhLHOMm n1zpBRDLRf+hEuLbA0p99Tgy1DGMJoKZhuCYc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=CsesZlrKorw+PjmQVkxD7iXEMT9RU8W8SF0F0ASKAnnvN8flIBvhC8iFqhbFO5EBXl nkv+MhtJVb07zi28Vurv3p8CF4PVai75YzodaUNYl9G1/i3KMd0Z3tPKypAgQpYU8S5a EQ/b3D+Sm/E0lzafSeSyKRnwIa7Vb5+AFmXK0= MIME-Version: 1.0 Received: by 10.141.34.20 with SMTP id m20mr360036rvj.120.1255322313072; Sun, 11 Oct 2009 21:38:33 -0700 (PDT) In-Reply-To: References: Date: Sun, 11 Oct 2009 21:38:33 -0700 Message-ID: From: Harsha To: Robert Watson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org, net@freebsd.org Subject: Re: Page fault in IFNET_WLOCK_ASSERT [if.c and pccbb.c] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 04:38:34 -0000 Hi Robert, On Sun, Oct 11, 2009 at 1:30 PM, Robert Watson wrote: > Giant is a bit special in that the long-term sleep code in the kernel kno= ws > to drop it when sleeping, and re-acquire when waking up. =A0So, unlike al= l > other mutexes, it should be OK to hold it in this case, as Giant will sim= ply > get dropped if the kernel has to sleep waiting on a sleepable lock. =A0Th= is is > because, historically in FreeBSD 3.x/4.x, the kernel was protected by a > single spinlock, which would get released whenever the kernel stopped > executing, such as during an I/O sleep. =A0On the whole, Giant has disapp= eared > from the modern kernel, but where it is used, it retains those curious > historic properties. > > To break things down a bit further, IFNET_WLOCK is, itself, a bit special= : > notice that in FreeBSD 8, it's actually two locks, a sleep lock, and a > mutex, which must both be acquired exclusively to ensure mutual exclusion= . > if_alloc() and associated calls are also sleepable because they perform > potentially sleeping memory allocation (M_WAITOK), so it's an invariant o= f > any code calling interface allocation that it must be able to tolerate a > sleep. Thanks a lot for the clarification. I had assumed that the lock was non-sleepable looking at this log - Kernel page fault with the following non-sleepable locks held: exclusive rw ifnet_rw (ifnet_rw) r =3D 0 (0xc0f63464) locked @ /usr/src/sys/net/if.c:409 > Do you have a copy of the stack trace and fault information handy? =A0In = my > experience, a NULL pointer deref or other page fault in the locking code = for > a global lock is almost always corrupted thread state, perhaps due to > tripping over another thread having locked a corrupted/freed/uninitialize= d > lock. =A0We might be able to track that down by tracing other threads tha= t > were in execution at the time of the panic. I just tried the textdump feature and I think its an awesome tool. Here is ddb.txt- http://docs.google.com/View?id=3Ddddwnxfj_0dh4x58hc And msgbuf.txt- http://docs.google.com/View?id=3Ddddwnxfj_1cnmrb8fw For some reason the output of show alllocks is not written into ddb.txt, though I have increased the buffer size to 2MB. Thanks, Harsha