Subject: Re: splx() optimization [was Re: SMP re-eetrancy in "bottom half" drivers]
To: Bill Studenmund <wrstuden@netbsd.org>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 06/17/2005 19:11:55
--Apple-Mail-6--980404993
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed


On Jun 8, 2005, at 12:04 AM, Bill Studenmund wrote:

>> What I want is "make the subsystems that run in those IPLs truly SMP-
>> safe".  That way we get actual performance.
>>
>
> In the long run, I think everyone wants that.

...and in the furtherance of that goal, here is the first step.  I  
have a bunch of changes in my local tree that provide some foundation  
for this, but they rely on this semantics change (which I don't  
expect to be all that controversial).

-- thorpej


--Apple-Mail-6--980404993
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	x-mac-type=54455854;
	x-unix-mode=0755;
	x-mac-creator=74747874;
	name="spl-semantics-patch.txt"
Content-Disposition: attachment;
	filename=spl-semantics-patch.txt

Index: spl.9
===================================================================
RCS file: /cvsroot/src/share/man/man9/spl.9,v
retrieving revision 1.22
diff -u -p -r1.22 spl.9
--- spl.9	31 Oct 2004 07:01:34 -0000	1.22
+++ spl.9	18 Jun 2005 02:11:00 -0000
@@ -1,6 +1,6 @@
 .\"	$NetBSD: spl.9,v 1.22 2004/10/31 07:01:34 yamt Exp $
 .\"
-.\" Copyright (c) 2000, 2001 Jason R. Thorpe.  All rights reserved.
+.\" Copyright (c) 2000, 2001, 2005 Jason R. Thorpe.  All rights reserved.
 .\" Copyright (c) 1997 Michael Long.
 .\" Copyright (c) 1997 Jonathan Stone.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 13, 2001
+.Dd June 17, 2005
 .Dt SPL 9
 .Os
 .Sh NAME
@@ -85,30 +85,18 @@
 .Ft void
 .Fn splx "int s"
 .Sh DESCRIPTION
-These functions raise and lower the system priority level.
+These functions raise and lower the system interrupt priority level.
 They are used by kernel code to block interrupts in critical
-sections, in order to protect data structures (much like
+sections in order to protect data structures (much like
 a locking primitive) or to ensure uninterrupted access to
 hardware devices which are sensitive to timing.
 .Pp
-Interrupt priorities are not arranged in a strict hierarchy, although
-interrupt hardware sometimes is.
-For this reason the priorities listed here are arranged from
-.Dq highest
-to
-.Dq lowest .
-In other words, if a platform's hardware interrupts are arranged in
-a hierarchical manner, a priority level should also block all of the
-levels listed below it.
-.Pp
-Note that a strict hierarchy is not required.
-For example,
-.Fn splnet
-is not required to block disk controller interrupts, as they
-do not access the same data structures.
-However, the priorities are presented as a hierarchy in order to
-minimize data loss due to blocked interrupts, or interrupts not being
-serviced in a timely fashion.
+Interrupt priority levels are arranged in a strict hierarchy such that
+raising priority to any given level blocks the interrupts at that level
+as well as all interrupts at lower levels.
+This arrangement is required in order to avoid deadlocks in a multiprocessor
+system where locks might be acquired in interrupt handlers; these locks must
+always be acquired in the same order.
 .Pp
 A
 .Nm
@@ -298,3 +286,6 @@ was replaced by
 and code which abused the semantics of
 .Fn splimp
 was changed to not mix interrupt priority levels.
+.Pp
+Interrupt priority levels were defined to have a strict hierarchy in
+.Nx 4.0 .

--Apple-Mail-6--980404993--