Previous Next

Handling Overlapped I/O Operations

The DpcForIsr or CustomDpc routine of a driver that overlaps operations on its device cannot rely on a one-to-one correspondence between requests input to the StartIo routine and the ISR’s calls to IoRequestDpc or KeInsertQueueDpc. Such a driver’s DpcForIsr or CustomDpc cannot necessarily use the input pointers to the IRP and ISR-supplied context, or the CurrentIrp pointer in the target device object, to complete only that IRP.

At any given moment, the same DPC object cannot be queued twice. If an ISR calls IoRequestDpc or KeInsertQueueDpc more than once before the corresponding DpcForIsr or CustomDpc executes, the DPC routine runs only once when the IRQL on a processor falls below DISPATCH_LEVEL. On the other hand, if the ISR calls IoRequestDpc or KeInsertQueueDpc while the corresponding DpcForIsr or CustomDpc is running on another processor, the DPC routine can run on two processors concurrently.

Therefore, any driver that overlaps interrupt-driven I/O operations on its device must have the following: