IRQL in WINDOWS2000

I am developing a Win2k Driver for a PCI device…

I have a case wherein one routine in my driver waits on a WAIT_OBJECT…
this thread gets WakeUP(i.e. Wait Object is signalled) in my Interrupt
Service Routine(typically in DPCForISR)…

The problem is, sometimes I found that the initial routine was waiting on
the WAit_Object => is fine but system suddenly bugChecks when the
interrupt is generated… i am sure that there no illegal operation in the
ISR… moreover the system bug checks even before the ISR is invoked…
& the Debugger displays “PAGE FAULT IN NON_PAGED AREA IRQL = 9(i.e. my
device’s IRQL)”…

The Code seems to be working if i make the initial function as
NON_PAGEABLE… but some how I couldn’t make out the reason for this…
is this really required??
Also my ISR & DPC are marked as Non Pageable => is that really required
too.???

Kindly send me some suggestions,
Thanx,
SP.

When you say ISR, do you mean DPC ? You cannot call APIs like KeSetEvent
from IRQL > DISPATCH_LEVEL (typical ISR levels). If you get this bugcheck
look at the first parameter. This gives the address that caused the fault.
You can then find if its your code or data. Your event could be in paged
area this could be the problem.


Nar Ganapathy
Windows Core OS group
This posting is provided “AS IS” with no warranties, and confers no rights.

“Shailesh” wrote in message news:xxxxx@ntdev…
>
> I am developing a Win2k Driver for a PCI device…
>
> I have a case wherein one routine in my driver waits on a WAIT_OBJECT…
> this thread gets WakeUP(i.e. Wait Object is signalled) in my Interrupt
> Service Routine(typically in DPCForISR)…
>
> The problem is, sometimes I found that the initial routine was waiting on
> the WAit_Object => is fine but system suddenly bugChecks when the
> interrupt is generated… i am sure that there no illegal operation in the
> ISR… moreover the system bug checks even before the ISR is invoked…
> & the Debugger displays “PAGE FAULT IN NON_PAGED AREA IRQL = 9(i.e. my
> device’s IRQL)”…
>
> The Code seems to be working if i make the initial function as
> NON_PAGEABLE… but some how I couldn’t make out the reason for this…
> is this really required??
> Also my ISR & DPC are marked as Non Pageable => is that really required
> too.???
>
> Kindly send me some suggestions,
> Thanx,
> SP.
>
>

You have described the problem sufficiently here, but in general it is a
really good idea if you can post the bug check with parameters, and perhaps
a callstack when posting a problem of this type.

Sounds like your wait object is in pageable memory. This would be a
problem. You cannot block any thread executing at IRQL >= DISPATCH_LEVEL,
which would include both your ISR and your DpcForIsr. Thus if your wait
object memory is paged out and you attempt to access this wait object in
your Isr or DpcForIsr, the system will attempt to block your thread while it
pages in the wait object memory. As soon as this occurs your system will
crash.

The reason this is so, is the operating system’s dispatching/scheduling
code, (the code that determines the proper thread to run next in a
preempting environment), runs at DISPATCH_LEVEL. As such there is no
preemption at this IRQL level or greater. With no preemption, there can be
no blocking.

Your Isr will always run at DIRQL and thus cannot be pageable. Your DPC
will run at DISPATCH_LEVEL thus cannot be pageable. The initial function
might possibly be able to be pageable, depending on the function and how it
is called. The wait object memory, if accessed by threads at

=DISPATCH_LEVEL definitely cannot be pageable and probably should be in
your device extension.


Bill McKenzie
Windows DDK MVP
OSR - Windows System Software Development, Training, and Consulting

“Shailesh” wrote in message news:xxxxx@ntdev…
>
> I am developing a Win2k Driver for a PCI device…
>
> I have a case wherein one routine in my driver waits on a WAIT_OBJECT…
> this thread gets WakeUP(i.e. Wait Object is signalled) in my Interrupt
> Service Routine(typically in DPCForISR)…
>
> The problem is, sometimes I found that the initial routine was waiting on
> the WAit_Object => is fine but system suddenly bugChecks when the
> interrupt is generated… i am sure that there no illegal operation in the
> ISR… moreover the system bug checks even before the ISR is invoked…
> & the Debugger displays “PAGE FAULT IN NON_PAGED AREA IRQL = 9(i.e. my
> device’s IRQL)”…
>
> The Code seems to be working if i make the initial function as
> NON_PAGEABLE… but some how I couldn’t make out the reason for this…
> is this really required??
> Also my ISR & DPC are marked as Non Pageable => is that really required
> too.???
>
> Kindly send me some suggestions,
> Thanx,
> SP.
>
>

wait objects cannot ever be pagable. They can be allocated on the
thread stack but only if the thread is doing kernel-mode waits
(user-mode waits would allow the stack to be paged out while the thread
was blocked which would screw up the wait lists).

-p

-----Original Message-----
From: Bill McKenzie [mailto:xxxxx@osr.com]
Sent: Monday, August 26, 2002 9:23 AM
To: NT Developers Interest List
Subject: [ntdev] Re: IRQL in WINDOWS2000

You have described the problem sufficiently here, but in general it is a
really good idea if you can post the bug check with parameters, and
perhaps a callstack when posting a problem of this type.

Sounds like your wait object is in pageable memory. This would be a
problem. You cannot block any thread executing at IRQL >=
DISPATCH_LEVEL, which would include both your ISR and your DpcForIsr.
Thus if your wait object memory is paged out and you attempt to access
this wait object in your Isr or DpcForIsr, the system will attempt to
block your thread while it pages in the wait object memory. As soon as
this occurs your system will crash.

The reason this is so, is the operating system’s dispatching/scheduling
code, (the code that determines the proper thread to run next in a
preempting environment), runs at DISPATCH_LEVEL. As such there is no
preemption at this IRQL level or greater. With no preemption, there can
be no blocking.

Your Isr will always run at DIRQL and thus cannot be pageable. Your DPC
will run at DISPATCH_LEVEL thus cannot be pageable. The initial
function might possibly be able to be pageable, depending on the
function and how it is called. The wait object memory, if accessed by
threads at

=DISPATCH_LEVEL definitely cannot be pageable and probably should be in
your device extension.


Bill McKenzie
Windows DDK MVP
OSR - Windows System Software Development, Training, and Consulting

“Shailesh” wrote in message
news:xxxxx@ntdev…
>
> I am developing a Win2k Driver for a PCI device…
>
> I have a case wherein one routine in my driver waits on a
> WAIT_OBJECT… this thread gets WakeUP(i.e. Wait Object is signalled)
> in my Interrupt Service Routine(typically in DPCForISR)…
>
> The problem is, sometimes I found that the initial routine was waiting

> on the WAit_Object => is fine but system suddenly bugChecks when the
> interrupt is generated… i am sure that there no illegal operation in
> the ISR… moreover the system bug checks even before the ISR is
> invoked… & the Debugger displays “PAGE FAULT IN NON_PAGED AREA IRQL
> = 9(i.e. my device’s IRQL)”…
>
> The Code seems to be working if i make the initial function as
> NON_PAGEABLE… but some how I couldn’t make out the reason for this…
> is this really required?? Also my ISR & DPC are marked as Non Pageable

> => is that really required too.???
>
> Kindly send me some suggestions,
> Thanx,
> SP.
>
>


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%

Please check out if you are using "pageable memory " for the wait objects, if
this is so, it will not work as ISR , that is called at DIRQL , will page out
and might result in Bug-check…

Rakesh Shrivastava

On Monday 26 August 2002 08:48 pm, you wrote:

I am developing a Win2k Driver for a PCI device…

I have a case wherein one routine in my driver waits on a WAIT_OBJECT…
this thread gets WakeUP(i.e. Wait Object is signalled) in my Interrupt
Service Routine(typically in DPCForISR)…

The problem is, sometimes I found that the initial routine was waiting on
the WAit_Object => is fine but system suddenly bugChecks when the
interrupt is generated… i am sure that there no illegal operation in the
ISR… moreover the system bug checks even before the ISR is invoked…
& the Debugger displays “PAGE FAULT IN NON_PAGED AREA IRQL = 9(i.e. my
device’s IRQL)”…

The Code seems to be working if i make the initial function as
NON_PAGEABLE… but some how I couldn’t make out the reason for this…
is this really required??
Also my ISR & DPC are marked as Non Pageable => is that really required
too.???

Kindly send me some suggestions,
Thanx,
SP.


You are currently subscribed to ntdev as: xxxxx@dcmtech.co.in
To unsubscribe send a blank email to %%email.unsub%%