From owner-freebsd-net@FreeBSD.ORG Sun Oct 11 19:40:20 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 7F4B0106566B; Sun, 11 Oct 2009 19:40:20 +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 544F88FC15; Sun, 11 Oct 2009 19:40:20 +0000 (UTC) Received: by pzk2 with SMTP id 2so38269pzk.27 for ; Sun, 11 Oct 2009 12:40:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=/RxWVwFUS5owVd6Ri/CahM5jQC4e/TygkwtAoUYCTao=; b=p72suf6ilsuy079BhTbe053MNHk6wLwXav5det3prOxxt6cS5vYTpwRA12vHSfJbuB mRp4TxqFIjsXGgYG3eVXu6MyufnXm+tpH409449odE/sM7hhfj1vxXBKmPdMnG0AMVU9 kvW9aQPbuNDh7Kl/9+yIkQ1u+wXeB9Lmq4SDE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=uW9vyJ4nMyUbaWixyxCSF4R+Dr7JwMQGmzU3zhAU1rC/zVUn2PKrqop3E1hXTVwGAJ Bhxy99PQv1vwBGi45fdiq3vtsnSTfATjmphFbr8s4E5kW6aqFW7gbrVDNL7iULLl5LlY BXYaoEGPwWV4cDEY+hqpRNJfXfW9H7Dt8kiIU= MIME-Version: 1.0 Received: by 10.141.1.12 with SMTP id d12mr336935rvi.268.1255289192721; Sun, 11 Oct 2009 12:26:32 -0700 (PDT) Date: Sun, 11 Oct 2009 12:26:31 -0700 Message-ID: From: Harsha Srinath To: net@freebsd.org, freebsd-current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: 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: Sun, 11 Oct 2009 19:40:20 -0000 Hi all, I'm running an updated HEAD kernel and got a page fault in ifindex_alloc_locked() in if.c. I figured that the problem was caused by the (pluggable) network card of my laptop and found that during the initialization of the interface, cb_event_thread() takes the giant lock and up the call chain in if_alloc(), we call IFNET_WLOCK() and assert on the RW locks in ifindex_alloc_locked(). It is in the asset macro IFNET_WLOCK_ASSERT() I see the page fault. I looked up some recent related changes and noticed the following comment in one of the check-ins in- http://svn.freebsd.org/viewvc/base/head/sys/net/if.c "Break out allocation of new ifindex values from if_alloc() and if_vmove(), and centralize in a single function ifindex_alloc(). Assert the IFNET_WLOCK, and add missing IFNET_WLOCK in if_alloc(). This does not close all known races in this code." So I think I have hit one of those fault conditions. Apparently the giant lock code was removed and added back recently - http://svn.freebsd.org/viewvc/base/head/sys/dev/pccbb/pccbb.c I believe that the root cause is that ifnet_rw is a non sleepable exclusive RW lock and we have taken the exclusive sleep mutex Giant before that. Any pointers and suggestions are welcome. Many thanks, Harsha