No need to guess, now that the WDF Sources are on GitHub. The ultimate function called when you call WdfSpinLockAcquire:
Acquires_lock(this->m_Lock)
__drv_maxIRQL(DISPATCH_LEVEL)
__drv_setsIRQL(DISPATCH_LEVEL)
FORCEINLINE
VOID
MxLockNoDynam::Acquire(
__out __drv_deref(__drv_savesIRQL) KIRQL * OldIrql
)
{
ASSERT_DBGFLAG_INITIALIZED;
KeAcquireSpinLock(&m_Lock, OldIrql);
}
It’s also interesting to note that WDF Verifier will break on attempts to acquire the Interrupt Spin Lock by calling WdfSpinLockAcquire. THAT’s certainly nice:
VOID
WDFEXPORT(WdfSpinLockAcquire)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
__in
__drv_savesIRQL
Requires_lock_not_held(Curr)
Acquires_lock(Curr)
WDFSPINLOCK SpinLock
)
{
DDI_ENTRY();
PFX_DRIVER_GLOBALS pFxDriverGlobals;
FxSpinLock* pLock;
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals),
SpinLock,
FX_TYPE_SPIN_LOCK,
(PVOID*) &pLock,
&pFxDriverGlobals);
if (pLock->IsInterruptLock()) {
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGERROR,
"WDFSPINLOCK %p is associated with an interrupt, "
“cannot be used for normal sync operations”,
SpinLock);
FxVerifierDbgBreakPoint(pFxDriverGlobals);
return;
}
pLock->AcquireLock(
pFxDriverGlobals->FxVerifierLock ? _ReturnAddress() : NULL);
}
It allows you to have multiple ISRs share the same synchronization domain. S’pose you want to share the interrupt spin lock among multiple devices. That is, there’s some underlying shared state that EVERY device of yours uses, that you might need to access.
It’s a rare, and mostly aberrant, requirement. But you do see it.
Peter
OSR
@OSRDrivers