Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Aug 2010 15:15:59 -0600
From:      John Giacomoni <john.giacomoni@lineratesystems.com>
To:        freebsd-hackers@freebsd.org
Subject:   use of rwlocks safe in network stack?
Message-ID:  <5F142BAD-E8F5-46C4-9AF3-D5E7AEAD93A0@lineratesystems.com>

next in thread | raw e-mail | index | archive | help
Can someone help me understand how it is safe to process network packets =
from within a driver's interrupt context?
It looks to me like the network drivers (bce in particular) violate the =
rules laid out in locking (9).

In FreeBSD 7.3 the bce driver's RX interrupt can call up into the =
network stack (bce_intr -> bce_rx_intr -> if_input) which will grab =
INP_INFO_WLOCK (rw_wlock) when it hits the TCP layer.

pfslowtimo also acquires INP_INFO_LOCK.

Is this safe?  locking (9) says that acquiring a rw_wlock is not allowed =
in interrupt context and rw_wlock can "sleep" via mi_switch in the =
turnstile code.

Is this a locking order type rule?  and if so, is the rule being ignored =
because network stack is guaranteed to return in a finite amount of =
time?  Or is the bce interrupt a different type of interrupt than =
referred to in locking (9) ?

Thanks,

John Giacomoni






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5F142BAD-E8F5-46C4-9AF3-D5E7AEAD93A0>