page out

Hi dear all,
If a function is called at DPC level , will this function be paged out
? thanks in advance .

Sorry , I mean the stack of such a function

2010/7/14 yushang :
> Hi dear all,
> If a function is called at DPC level , will this function be paged out
> ? thanks in advance .
>

IIRC it is guaranteed that running thread’s stack is present – paged in
(running == is executed on a given CPU). It may be paged out only when
thread is waiting/blocked.
As for the function code it’s totally different thing. Function code may
be paged out if it belongs to pageable section.
What kind of problem are you actually trying to solve here?

Kris

-----Original Message-----
From: yushang [mailto:xxxxx@gmail.com]
Posted At: Wednesday, July 14, 2010 11:38 AM
Posted To: ntdev
Conversation: page out
Subject: Re: page out

Sorry , I mean the stack of such a function

2010/7/14 yushang :
> Hi dear all,
> If a function is called at DPC level , will this function be paged out
> ? thanks in advance .
>

“Krzysztof Uchronski” wrote in message
news:xxxxx@ntdev…
>It may be paged out only when thread is waiting/blocked.

Just to clarify, it may only be paged out when the thread is waiting with a
WaitMode of UserMode (see KeWaitForXxx function prototypes).

Important distinction because lots of drivers put kernel events on their
stack and wait for them. Kernel events must be non-pageable, so we have to
be guaranteed that our kernel stacks won’t be paged out.

-scott


Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com

“Krzysztof Uchronski” wrote in message
news:xxxxx@ntdev…
> IIRC it is guaranteed that running thread’s stack is present – paged in
> (running == is executed on a given CPU). It may be paged out only when
> thread is waiting/blocked.
> As for the function code it’s totally different thing. Function code may
> be paged out if it belongs to pageable section.
> What kind of problem are you actually trying to solve here?
>
> Kris
>
> -----Original Message-----
> From: yushang [mailto:xxxxx@gmail.com]
> Posted At: Wednesday, July 14, 2010 11:38 AM
> Posted To: ntdev
> Conversation: page out
> Subject: Re: page out
>
> Sorry , I mean the stack of such a function
>
> 2010/7/14 yushang :
>> Hi dear all,
>> If a function is called at DPC level , will this function be paged out
>> ? thanks in advance .
>>
>
>

I’m writing a sync version of NdisRequest as follow

NDIS_STATUS
SyncNdisRequest(
IN NDIS_HANDLE NdisBindingHandle,
IN PSYNC_NDIS_REQUEST Request)
{
NDIS_STATUS Status;
NdisRequest( &Status , NdisBindingHandle , (PNDIS_REQUEST)Request );
if ( NDIS_STATUS_PENDING == Status )
{
NdisInitializeEvent( &Request->Event ); //this is wrong
NdisWaitEvent(&Request->Event , 0);
Status = Request->Status;
}
return Status;
}
got a bugcheck 0xa , finally I found I should put NdisInitializeEvent
before NdisRequest . many tanks.

What kind of problem are you actually trying to solve here?

ys wrote:

NDIS_STATUS SyncNdisRequest(
IN NDIS_HANDLE NdisBindingHandle,
IN PSYNC_NDIS_REQUEST Request)
{
NdisRequest( &Status ,
NdisBindingHandle ,
(PNDIS_REQUEST)Request );

if ( NDIS_STATUS_PENDING == Status )
{
NdisInitializeEvent( &Request->Event );
NdisWaitEvent(&Request->Event , 0);
Status = Request->Status;
}
}
return Status;

VOID
MyFwRequestCompleteHandler(
IN NDIS_HANDLE ProtocolBindingContext,
IN PNDIS_REQUEST NdisRequest,
IN NDIS_STATUS Status
)
{
PSYNC_NDIS_REQUEST SyncReq = (PSYNC_NDIS_REQUEST)NdisRequest;
SyncReq->Status = Status;
NdisSetEvent(&SyncReq->Event);
}

> If a function is called at DPC level , will this function be paged out

You are only allowed to call a function at DPC level if it is nonpaged (i.e. not subject to page-out at all).


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

The stack can be paged out only if the the thread enters the user-mode-initiated wait.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“yushang” wrote in message news:xxxxx@ntdev…
> Sorry , I mean the stack of such a function
>
> 2010/7/14 yushang :
>> Hi dear all,
>> If a function is called at DPC level , will this function be paged out
>> ? thanks in advance .
>>
>

> NDIS_STATUS

SyncNdisRequest(

The correct code:

NDIS_STATUS
SyncNdisRequest(
IN NDIS_HANDLE NdisBindingHandle,
IN PSYNC_NDIS_REQUEST Request)
{
NDIS_STATUS Status;
NdisInitializeEvent( &Request->Event );
NdisRequest( &Status , NdisBindingHandle , (PNDIS_REQUEST)Request );
if ( NDIS_STATUS_PENDING == Status )
{
NdisWaitEvent(&Request->Event , 0);
Status = Request->Status;
}
return Status;
}


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com