7.2.4  StartIo Routines in Higher-Level NT Drivers

Any higher-level NT driver can have a StartIo routine at the driver writer’s discretion. However, such a driver is unlikely to be interoperable with existing lower-level drivers and is likely to exhibit poor performance characteristics.

A StartIo routine in a higher-level NT driver has the following effects:

·Incoming IRPs can be queued by calling IoStartPacket from the driver’s Dispatch routine(s) and IoStartNextPacket from its IoCompletion routine(s), thereby causing IRPs to be processed one at a time through the StartIo routine.

·The driver’s I/O throughput could become appreciably slower during periods of heavy I/O demand, because its StartIo routine can become a bottleneck.

·Such a driver’s StartIo routine calls IoCallDriver with each IRP at IRQL DISPATCH_LEVEL, thereby causing all lower-level drivers’ Dispatch routines also to run at IRQL DISPATCH_LEVEL. This restricts the set of support routines that lower drivers can call in their Dispatch routines. Because most NT driver writers assume their drivers’ Dispatch routines run at IRQL < DISPATCH_LEVEL, such a higher-level driver is unlikely to be interoperable with many existing lower-level drivers.

·Such a StartIo routine reduces overall system throughput because it and the Dispatch routines of all lower-level drivers in its chain are run at raised IRQL.

For more information about the IRQLs at which standard driver routines are run, see Chapter 16. For specific information about any particular standard routine, see the pertinent chapter among Chapters 5 through 15.

None of the system’s higher-level NT drivers has a StartIo routine, because it can slow IRP processing for the driver itself, for all drivers above and below it, and for the system overall.

Most higher-level NT drivers simply send IRPs to the underlying device driver(s) from their Dispatch routines, as described in Chapter 6, and do any necessary clean-up processing in their IoCompletion routines. For more information about IoCompletion routines, see Chapter 13.

However, higher-level NT drivers can set up internal queues for IRPs that request particular kinds of operations or set up internal queues to hold IRPs bound for a set of heterogeneous underlying devices like the NT SCSI port driver, as mentioned in Section 7.1.