*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->NetBSD man pages -> spl (9)              
Title
Content
Arch
Section
 

SPL(9)

Contents


NAME    [Toc]    [Back]

     spl, spl0, splbio, splclock, splhigh, splvm, spllock, spllowersoftclock,
     splnet, splsched, splserial, splsoftclock, splsoftnet, splsoftserial,
     splstatclock, spltty, splvm, splx - modify system interrupt priority
     level

SYNOPSIS    [Toc]    [Back]

     #include <machine/intr.h>

     int
     splhigh(void);

     int
     spllock(void);

     int
     splserial(void);

     int
     splsched(void);

     int
     splclock(void);

     int
     splstatclock(void);

     int
     splvm(void);

     int
     spltty(void);

     int
     splsoftserial(void);

     int
     splnet(void);

     int
     splbio(void);

     int
     splsoftnet(void);

     int
     splsoftclock(void);

     void
     spllowersoftclock(void);

     void
     spl0(void);

     void
     splx(int s);

DESCRIPTION    [Toc]    [Back]

     These functions raise and lower the system priority level.  They are used
     by kernel code to block interrupts in critical 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.

     Interrupt priorities are not arranged in a strict hierarchy, although
     interrupt hardware sometimes is.  For this reason the priorities listed
     here are arranged from ``highest'' to ``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.

     Note that a strict hierarchy is not required.  For example, 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.

     A spl function exists for each distinct priority level which can exist in
     the system, as well as for some special priority levels that are designed
     to be used in conjunction with multiprocessor-safe locking primitives.
     These levels may be divided into two main types: hard and soft.  Hard
     interrupts are generated by hardware devices.  Soft interrupts are a way
     of deferring hardware interrupts to do more expensive processing at a
     lower interrupt priority, and are explicitly scheduled by the higherlevel
 interrupt handler.  The most common use of this is in the networking
 code, where network interface drivers defer the more expensive TCP/IP
     processing in order to avoid dropping additional incoming packets.  Software
 interrupts are further described by softintr(9).

     In order of highest to lowest priority, the priority-raising functions
     are:

     splhigh()        blocks all hard and soft interrupts.  It is used for
                      code that cannot tolerate any interrupts, like hardware
                      context switching code and the ddb(4) in-kernel debugger.


     spllock()        blocks all hard and soft interrupts that can acquire a
                      simple lock.  This is provided as a distinct level from
                      splhigh() as some platforms may need to make use of
                      extremely high priority interrupts while locks are spinning,
 which would be blocked by splhigh().

     splserial()      blocks hard interrupts from serial interfaces
                      (IPL_SERIAL).  Code running at this level may not access
                      the tty subsystem.  Generally, all code run at this
                      level must schedule additional processing to run in a
                      software interrupt.  Note that code running at this priority
 is not blocked by splvm() (described below), and
                      is therefore prohibited from using the kernel memory
                      allocators.

     splsched()       blocks all hard and soft interrupts that may access
                      scheduler data structures.  Code running at or above
                      this level may not call sleep(), tsleep(), ltsleep(), or
                      wakeup(), nor may it post signals.

     splclock()       blocks the hardware clock interrupt.  It is used by
                      hardclock() to update kernel and process times, and must
                      be used by any other code that accesses time-related
                      data, specifically the time and mono_time global variables.
  This level also protects the callout(9) data
                      structures, and nothing running at or above this level
                      may schedule, cancel, or otherwise access any calloutrelated
 data structures.

     splstatclock()   blocks the hardware statistics clock interrupt.  It is
                      used by statclock() to update kernel profiling and other
                      statistics, and must be used by any code that accesses
                      that data.  This is the clock that drives scheduling.
                      This level is identical to splclock() if there is no
                      separate statistics clock.

     splvm()          blocks hard interrupts from all devices that are allowed
                      to use the kernel malloc(9), or any virtual memory operations.
  That includes all disk, network, and tty device
                      interrupts.  The temptation to abuse the semantics of
                      splvm() should be avoided; if you feel as if you need to
                      block more than one class of interrupts at a time, use
                      software interrupts instead.

     spltty()         blocks hard and soft interrupts from TTY devices
                      (IPL_TTY).  This must also block soft serial interrupts.

     splsoftserial()  blocks soft interrupts generated by serial devices
                      (IPL_SOFTSERIAL).

     splnet()         blocks hard interrupts from network interfaces
                      (IPL_NET).

     splbio()         blocks hard interrupts from disks and other mass-storage
                      devices (IPL_BIO).

     splsoftnet()     blocks soft network interrupts (IPL_SOFTNET).  Soft
                      interrupts blocked by this priority are also blocked by
                      all of the priorities listed above.

     splsoftclock()   blocks soft clock interrupts.  This is the priority at
                      which the callout(9) facility runs.  Soft interrupts
                      blocked by this priority are also blocked by all of the
                      priorities listed above.  In particular, splsoftnet()
                      must be a higher priority than splsoftclock().

     Two functions lower the system priority level.  They are:

     spllowersoftclock()  unblocks all interrupts but the soft clock interrupt.


     spl0()               unblocks all interrupts.

     The splx() function restores the system priority level to the one encoded
     in s, which must be a value previously returned by one of the other spl
     functions.

     Note that the functions which lower the system priority level
     (spllowersoftclock(), spl0(), and splx()) do not return a value.  They
     should only be used in places where the system priority level is being
     decreased permanently.  It is inappropriate to attempt to use them where
     the system priority level is being decreased temporarily, and would need
     to be restored to a previous value before continuing.

HISTORY    [Toc]    [Back]

     Originally, splsoftclock() lowered the system priority level.  During the
     NetBSD 1.5 development cycle, spllowersoftclock() was introduced and the
     semantics of splsoftclock() were changed.

     The splimp() call was removed from the kernel between NetBSD 1.5 and
     NetBSD 1.6.  The function of splimp() was replaced by splvm() and code
     which abused the semantics of splimp() was changed to not mix interrupt
     priority levels.

BSD                             April 13, 2001                             BSD
[ Back ]
 Similar pages
Name OS Title
npri IRIX modify the scheduling priority of a process
kernel_isrthread Tru64 General: Starts a fixed priority kernel thread dedicated to interrupt service
rtprio FreeBSD examine or modify a process realtime or idle priority
rtprio FreeBSD execute, examine or modify a utility's or process's realtime or idletime scheduling priority
idprio FreeBSD execute, examine or modify a utility's or process's realtime or idletime scheduling priority
pthread_cond_signal_int_np Tru64 Wakes one thread that is waiting on the specified condition variable (called from interrupt level on...
pthread_cond_sig_preempt_int_np Tru64 Wakes one thread that is waiting on the specified condition variable (called from interrupt level on...
siginterrupt FreeBSD allow signals to interrupt system calls
siginterrupt Linux allow signals to interrupt system calls
siginterrupt NetBSD allow signals to interrupt system calls
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service