10.1.3  SynchCritSection Routine Performance Requirements

Like an ISR, a SynchCritSection routine must execute as quickly as possible, doing only what is necessary to set up device registers or update context data, before returning control to the routine that called KeSynchronizeExecution.

NT device driver writers should consider the following a design and implementation guideline

Because it is run at DIRQL, any SynchCritSection routine must return control as quickly as possible.

Because KeSynchronizeExecution holds a device driver’s interrupt spin lock while its SynchCritSection routine runs, the driver’s ISR cannot get any work done until the SynchCritSection routine returns control.

Each NT device driver should be designed to minimize the time it spends running at DIRQL for each IRP it processes on the device.

On return from KeSynchronizeExecution, the caller’s IRQL is restored.