Specifications
Completing an I/O Request and Handling Timeouts
8.2 Timeout Handling Routines
1. It obtains both the fork lock and the device lock associated with the device
unit to synchronize access to its fork database and device database. It raises
IPL to device IPL as a result of obtaining the device lock.
2. It raises IPL on the local processor to IPL$_POWER to block local power
failure servicing.
3. It disables expected interrupts and timeouts on the device by clearing bits
in the status field of the device’s UCB (UCB$V_INT and UCB$V_TIM in
UCB$L_STS).
4. It sets the device-timeout bit in the UCB status field (UCB$V_TIMOUT in
UCB$L_STS).
5. It lowers IPL to hardware device interrupt IPL (UCB$B_DIPL).
6. It restores the saved R3 and R4 of the driver’s fork process from the UCB
fork block (UCB$L_FR3 and UCB$L_FR4).
7. It restores R5 (address of the UCB fork block).
8. It transfers control to the driver’s timeout handling routine, which is
contained in UCB$PS_TOUTROUT.
The driver’s timeout handling routine executes in the following context:
• R5 contains the address of the UCB for the device that timed out.
• Only system address space may be accessed.
• The processor is running in kernel mode.
• The processor is running on the kernel stack.
• The processor holds both fork lock and device lock.
• IPL is at hardware device interrupt level.
A timeout handling routine returns control to the software timer interrupt service
routine by issuing an RET instruction. The driver’s fork process eventually
regains control, with R3 and R4 restored from UCB$Q_FR3 and UCB$Q_FR4.
Certain timeout handling routines may find it useful to fork to execute low
priority code or to accomplish certain tasks, such as the restarting of an I/O
request (see Section 8.2.1). If a driver uses this method, its interrupt service
routine should check the interrupt-expected bit (UCB$V_INT) before handling the
interrupt. The operating system clears this bit before it calls the driver’s timeout
handling routine. This allows the routine to determine whether device-timeout
processing is in progress at fork IPL.
During recovery from a power failure, the operating system forces a device
timeout by altering the timeout field (UCB$L_DUETIM) of a UCB if that device’s
UCB records that the unit is waiting for an interrupt or timeout (UCB$V_INT
and UCB$V_TIM set in UCB$L_STS). The timeout handling routine can perceive
that recovery from a power failure is occurring by examining the power bit
(UCB$V_POWER in UCB$L_STS) in the UCB.
A timeout handling routine usually performs one of three functions:
• It retries the I/O operation unless a retry count is exhausted.
• It aborts the I/O request, returning status (for instance, SS$_TIMEOUT) in
R0.
8–4










