Possible confusing WDK help information.

Within Windows Driver Kit: Kernel-Mode Driver Architecture
Managing Hardware Priorities you say:

Even while running at IRQL PASSIVE_LEVEL, pageable driver code must not call
KeSetEvent, KeReleaseSemaphore, or KeReleaseMutex with the input Wait
parameter set to TRUE. Such a call can cause a fatal page fault.

If you read about the WAIT parameter it is ok to be TRUE if the IRQL <=
APC_LEVEL and you follow with a WAIT call. I would assume when you say:
Such a call CAN cause a fatal page fault if the WAIT is TRUE and IRQL <=
APC_LEVEL and you do not follow with a Wait call.

-William Michael Jones “Mike”

The key here is pageable code combined with IRQL. If you pass TRUE for
Wait, the IRQL that the call returns at is dispatch level. In between
the call with Wait as TRUE and the KeWaitForXxx call, the pageable code
could be evicted to the page file and then you are touching paged out
code at dispatch (and you bluescreen). By passing a Wait of FALSE, the
IRQL does not change when the call returns to your driver which is why
it is OK to pass Wait=FALSE at passive level.

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of William Michael
Jones
Sent: Tuesday, February 20, 2007 9:40 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Possible confusing WDK help information.

Within Windows Driver Kit: Kernel-Mode Driver Architecture
Managing Hardware Priorities you say:

Even while running at IRQL PASSIVE_LEVEL, pageable driver code must not
call
KeSetEvent, KeReleaseSemaphore, or KeReleaseMutex with the input Wait
parameter set to TRUE. Such a call can cause a fatal page fault.

If you read about the WAIT parameter it is ok to be TRUE if the IRQL <=
APC_LEVEL and you follow with a WAIT call. I would assume when you say:

Such a call CAN cause a fatal page fault if the WAIT is TRUE and IRQL <=

APC_LEVEL and you do not follow with a Wait call.

-William Michael Jones “Mike”


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks d

“William Michael Jones” wrote in message
news:xxxxx@ntdev…
> Within Windows Driver Kit: Kernel-Mode Driver Architecture
> Managing Hardware Priorities you say:
>
> Even while running at IRQL PASSIVE_LEVEL, pageable driver code must not
> call KeSetEvent, KeReleaseSemaphore, or KeReleaseMutex with the input Wait
> parameter set to TRUE. Such a call can cause a fatal page fault.
>
> If you read about the WAIT parameter it is ok to be TRUE if the IRQL <=
> APC_LEVEL and you follow with a WAIT call. I would assume when you say:
> Such a call CAN cause a fatal page fault if the WAIT is TRUE and IRQL <=
> APC_LEVEL and you do not follow with a Wait call.
>
> -William Michael Jones “Mike”
>
>
>
>
>