Hi All,
I have a query regarding spinlocks and releasing them. It goes…
Is it possible to call KeReleaseSpinlock() on a spinlock that has been
acquired using KeAcquireSpinlockAtDpcLevel()?
From the doco you can’t do it the converse way i.e
KeReleaseSpinLockAtDpcLevel() if the spinlock was acquired via
KeAquireSpinLock()…
From from Peter and Tony’s book (pg:146, they state “Executive Spin Locks
that were acquired with the function KeAquireSpinLockAtDpcLevel() must be
released using the function KeReleaseSpinLockFromDpcLevel().” In the next
paragraph “The only difference between the two is that after releasing the
spin lock, KeReleaseSpinLockFromDpcLevel() stays at IRQL DISAPTCH_LEVEL,
whereas…” That says to me that you could indeed use KeReleaseSpinlock()
for a spin lock acquired at Dpc Level.
So to add to the original question is there anything else/side effects that
will occur if you release a spin lcok with KeReleaseSpinLock() from a spin
lock that was aquired using the KeAquireSpinLockAtDpcLevel()?
Note: have tested this so far and haven’t had any problems, butI have not
tested it in a “real world” environment…
Regards,
Ian
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> Is it possible to call KeReleaseSpinlock() on a spinlock that has been
acquired using KeAcquireSpinlockAtDpcLevel()?
Dangerous. This can mean to lower the IRQL which was not raised by you.
The reverse:
-
acquire using KeAcquireSpinLock
-
release by KeReleaseSpinLockToDpcLevel
-
then call KeLowerIrql some later
-
seems to be OK.
Max
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Thursday, December 20, 2001 5:28 PM
Subject: [ntdev] Re: Query regarding KeReleaseSpinlock()
> > Is it possible to call KeReleaseSpinlock() on a spinlock that has been
> > acquired using KeAcquireSpinlockAtDpcLevel()?
>
> Dangerous. This can mean to lower the IRQL which was not raised by you.
This, like the example below, only requires that you know what you are doing,
such as in releasing locks out of order.
Its quite reasonable to Acquire lock 1, Acquire lock 2 at DPC, release lock 1 at DPC,
release lock 2 using the IRQL from the first acquire.
-DH
> The reverse:
>
> - acquire using KeAcquireSpinLock
> - release by KeReleaseSpinLockToDpcLevel
> - then call KeLowerIrql some later
>
> - seems to be OK.
>
> Max
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@syssoftsol.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com