Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Oct 2009 12:26:31 -0700
From:      Harsha Srinath <inpcb.harsha@gmail.com>
To:        net@freebsd.org, freebsd-current@freebsd.org
Subject:   Page fault in IFNET_WLOCK_ASSERT [if.c and pccbb.c]
Message-ID:  <e1b1c5880910111226o65e0d1a9va975f4cd837271bb@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e1b1c5880910111226o65e0d1a9va975f4cd837271bb>