Specifications
16-1
16
Chapter 16Special Considerations
16
16
16
This chapter describes the special factors that you must consider when developing a
device driver for a real-time production environment. It also provides an overview of the
security issues that affect development of a device driver for the PowerUX kernel.
Device Drivers and Real Time 16
The length of an interrupt routine is very important in a real-time system because an
interrupt routine cannot be preempted to execute a high-priority task. Lengthy interrupt
routines directly affect the process dispatch latency of the CPU to which the interrupt is
assigned. The length of time that interrupts are blocked by raising a processor’s interrupt
priority level (IPL) is also important to a real-time system. When interrupts are blocked,
the currently running process cannot be preempted. As a result, the process dispatch
latency on the CPU on which IPL is raised is affected. The term process dispatch latency
denotes the time that elapses from the occurrence of an external event, which is signified
by an interrupt, until the process that is waiting for that external event executes its first
instruction in user mode.
If you are using a device driver in a real-time production environment, you should
minimize the amount of work that is performed at interrupt level. Generally, a device’s
interrupt routine can interact with the device to perform the following types of tasks:
• Acknowledge the interrupt.
• Save data received from the device for subsequent transfer to a user.
• Initiate a device operation that was waiting for completion of the previous
operation.
A device’s interrupt routine should not perform the following types of tasks:
• Copy data from one internal buffer to another.
• Replenish internal buffers for the device.
• Replenish other resources used by the device.
Such tasks as these should be performed at program level. You can, for example, design a
device driver so that buffers for the device are allocated at program level and maintained
on a free list that is internal to the driver. When a process performs read or write
operations, the driver checks the free list to determine whether or not the number of
buffers available is sufficient for incoming interrupt traffic. The interrupt routine can thus
avoid making calls to such kernel buffer allocation routines as kmem_alloc(D3).
The most important consideration in designing a device driver for use in a real-time
production environment is the length of time that interrupts have to be blocked—interrupts