- Elevated Irql
- Posted by dave on September 1st, 2004
Hello:
I have a helper routine in my drv
and I want this routine to finish its
work without being interrupted by
any dispatchs.
I'm planning to use KSPIN_LOCK.
Q1: Can I be sure that this routine
will not be interrupted when
I/O manager call some of
dispatcher routine which are
passive level ?
Q2: From my helper routine I
call another one.
Should I use the same
KSPIN_LOCK by aquire it
in the first and releasing in second ?
Or should I use another KSPIN_LOCK ?
Thanks in advance:
dave
- Posted by Mark Roddy on September 2nd, 2004
In article <78ABAAE6-1254-4A24-9FD5-80EC9B7331C7@microsoft.com>,
dave@discussions.microsoft.com says...
You can use the same spinlock, but your problem and solution are so
vaguely stated that it really isn't clear what you are trying to do.
The general reason for using a lock of any sort is to protect shared
data structures from concurrent write access that can result in
incorrect program behavior. It sounds like you might simply be trying to
prevent concurrency and interruptibility in general. This is not a good
idea.
Dispatch routines - as in DispatchCreate DispatchClose etc. are not
interrupt sources at all. They represent external calls into your driver
from other programs and processes.
A spinlock might be overkill depending on your actual code structure.
Try to not call out of your driver while holding a spinlock, or any lock
for that matter.
--
=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
markr@hollistech.com
- Posted by Maxim S. Shatskih on September 2nd, 2004
Why do you need this? Maybe design a code in a way so that the routine will
work even if being preempted or interrupted?
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
"dave" <dave@discussions.microsoft.com> wrote in message
news:78ABAAE6-1254-4A24-9FD5-80EC9B7331C7@microsoft.com...
- Posted by Robby Tanner on September 2nd, 2004
"dave" <dave@discussions.microsoft.com> wrote in message
news:78ABAAE6-1254-4A24-9FD5-80EC9B7331C7@microsoft.com...
I believe that the short answer is no. You have to design with that in
mind. See the DDK help file under:
KERNEL-MODE DRIVER ARCHITECTURE | INTRODUCTION TO WINDOWS DRIVERS | DESIGN
GOALS FOR KERNEL-MODE DRIVERS, specifically the sections "Always Preemptible
and Always Interruptible" and "Multiprocessor Safe".
For one, this might not be necessary. As Maxim has pointed out, if you
rethink your design a bit, you're probably better off. I'm not sure you can
accomplish what you've outlined in the method you want to.
The good news is, there is a well-defined mechanism to support pre-emptive,
multi-processor conerns. The bad news is, you'll have to learn how to use
them.
Regards,
Rob