Re: PreFast and NDISUIO
From: Arne Ludwig (arne_at_citde.net)
Date: 11/02/04
- Next message: patrick: "Understanding virtual/private bytes gap"
- Previous message: Arkady Frenkel: "Re: GetThreadTimes..."
- In reply to: Arne Ludwig: "PreFast and NDISUIO"
- Next in thread: Doron Holan [MS]: "Re: PreFast and NDISUIO"
- Reply: Doron Holan [MS]: "Re: PreFast and NDISUIO"
- Messages sorted by: [ date ] [ thread ]
Date: 2 Nov 2004 04:40:43 -0800
I apparently misinterpreted what PreFast said. I found this in a
Microsoft document:
The following notes refer to the circled numbers in the sample code:
1. Remove the IRP from the pending structure before releasing the
cancel spin lock to prevent any other thread from trying to dequeue
it.
2. Release the cancel spin lock. The I/O Manager acquires the cancel
spin lock before it calls the Cancel routine; the Cancel routine must
release the lock.
3. Complete the IRP. A driver must never call IoCompleteRequest while
it holds the cancel spin lock.
and in another Microsoft document:
Calling IoCompleteRequest to complete an IRP constitutes a call
outside the driver. A deadlock could occur in the system if your
cancel routine completes the IRP while the kernel is holding the
cancel spinlock for you. So the cancel routine has to release the
global cancel spinlock first, then complete the cancelled IRP.
However, the original question still stands (slightly modified):
Why did Microsoft release the spinlock right at the beginning of the
cancel routine instead of after releasing the local lock and before
completing the IRP?
arne@citde.net (Arne Ludwig) wrote in message news:<84bdcc66.0411010055.49f5858b@posting.google.com>...
> We modified the DDK NDISUIO driver and I ran PreFast with driver
> enhancements from the Server 2003 Beta DDK on it. PreFast complained
> about some original Microsoft code that releases the cancel spinlock
> before the IRP was completed. I then moved the release down to after
> the complete and the driver still seems to work, but I wonder why
> Microsoft did it in the first place. Of course performancewise it is
> always best to release the spinlock as soon as possible.
>
> Was it allowed in this particular case and PreFast was wrong?
- Next message: patrick: "Understanding virtual/private bytes gap"
- Previous message: Arkady Frenkel: "Re: GetThreadTimes..."
- In reply to: Arne Ludwig: "PreFast and NDISUIO"
- Next in thread: Doron Holan [MS]: "Re: PreFast and NDISUIO"
- Reply: Doron Holan [MS]: "Re: PreFast and NDISUIO"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|