Hey,
I am sending memory from my application to my device driver. These blocks
are used to transfer audio data back and forth. My driver is working well,
but under load test after a day or so i get BSOD. I calloc the buffers in
my app only once at startup. I send the buffers to the driver using
overlapped io with an IOCTL. I don’t complete the request in my driver
until the driver is finished with the buffer (i keep the request in a
queue). I get the buffer address in my driver using
WdfRequestRetrieveOutputBuffer. The buffer can be used at DISPATCH level so
I suspect I am getting the BSOD because this is paged memory I am sending to
my driver (i have no idea why it runs so long and does not have this issue,
luck of the draw). I changed to:
WdfRequestRetrieveOutputWdmMdl(Request, &pMdl);
__try
{
MmProbeAndLockPages( pMdl, KernelMode, IoModifyAccess);
pagesLocked = TRUE;
pvUserData = MmGetSystemAddressForMdlSafe(pMdl, NormalPagePriority);
}
To try and lock the memory in my driver while I am using it so it will be
non-paged. The docs on these function are not really clear on whether they
accomplish what I am trying to do? Or if there is a better way of making
this work.
After I am finished with the buffer I call MmUnlockPages() to unlock the
memory. If I am sending data to my driver it works great, but if I send an
output buffer to the driver for receiving audio data into my app I get BSOD
when I complete the request attached to the memory after I am finished with
the memory and ready to send it back up to the app. Can someone explain the
best way to send and receive memory to my driver that I can use at DISPATCH
level? Or explain what I am doing wrong?
Thanks,
Greg
Greg Coleson wrote:
To try and lock the memory in my driver while I am using it so it
will be non-paged. The docs on these function are not really clear
on whether they accomplish what I am trying to do? Or if there is
a better way of making this work.
Why aren’t you using METHOD_BUFFERED IOCTLs in this case?
METHOD_OUT_DIRECT.
I didn’t want the extra overhead of the extra copy.
wrote in message news:xxxxx@ntdev…
> Greg Coleson wrote:
>
>> To try and lock the memory in my driver while I am using it so it
>> will be non-paged. The docs on these function are not really clear
>> on whether they accomplish what I am trying to do? Or if there is
>> a better way of making this work.
>
> Why aren’t you using METHOD_BUFFERED IOCTLs in this case?
>
Why are you calling MmProbeAndLockPages on an MDL that has already been
constructed?
You can just use WdfRequestRetrieveOutputMemory. That would be much simpler.
On Thu, Feb 14, 2008 at 12:18 PM, Greg Coleson wrote:
> Hey,
>
> I am sending memory from my application to my device driver. These blocks
> are used to transfer audio data back and forth. My driver is working
> well,
> but under load test after a day or so i get BSOD. I calloc the buffers in
> my app only once at startup. I send the buffers to the driver using
> overlapped io with an IOCTL. I don’t complete the request in my driver
> until the driver is finished with the buffer (i keep the request in a
> queue). I get the buffer address in my driver using
> WdfRequestRetrieveOutputBuffer. The buffer can be used at DISPATCH level
> so
> I suspect I am getting the BSOD because this is paged memory I am sending
> to
> my driver (i have no idea why it runs so long and does not have this
> issue,
> luck of the draw). I changed to:
>
> WdfRequestRetrieveOutputWdmMdl(Request, &pMdl);
> __try
>
> {
>
> MmProbeAndLockPages( pMdl, KernelMode, IoModifyAccess);
>
> pagesLocked = TRUE;
>
> pvUserData = MmGetSystemAddressForMdlSafe(pMdl, NormalPagePriority);
>
> }
>
> To try and lock the memory in my driver while I am using it so it will be
> non-paged. The docs on these function are not really clear on whether
> they
> accomplish what I am trying to do? Or if there is a better way of making
> this work.
>
> After I am finished with the buffer I call MmUnlockPages() to unlock the
> memory. If I am sending data to my driver it works great, but if I send
> an
> output buffer to the driver for receiving audio data into my app I get
> BSOD
> when I complete the request attached to the memory after I am finished
> with
> the memory and ready to send it back up to the app. Can someone explain
> the
> best way to send and receive memory to my driver that I can use at
> DISPATCH
> level? Or explain what I am doing wrong?
>
> Thanks,
>
> Greg
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
–
Mark Roddy
I am trying to get memory that I can use at DISPATCH level. The routines that work on memory retrieved from WdfRequestRetrieveOutputMemory can only be used at IRQL <= APC_LEVEL.
“Mark Roddy” wrote in message news:xxxxx@ntdev…
Why are you calling MmProbeAndLockPages on an MDL that has already been constructed?
You can just use WdfRequestRetrieveOutputMemory. That would be much simpler.
On Thu, Feb 14, 2008 at 12:18 PM, Greg Coleson wrote:
Hey,
I am sending memory from my application to my device driver. These blocks
are used to transfer audio data back and forth. My driver is working well,
but under load test after a day or so i get BSOD. I calloc the buffers in
my app only once at startup. I send the buffers to the driver using
overlapped io with an IOCTL. I don’t complete the request in my driver
until the driver is finished with the buffer (i keep the request in a
queue). I get the buffer address in my driver using
WdfRequestRetrieveOutputBuffer. The buffer can be used at DISPATCH level so
I suspect I am getting the BSOD because this is paged memory I am sending to
my driver (i have no idea why it runs so long and does not have this issue,
luck of the draw). I changed to:
WdfRequestRetrieveOutputWdmMdl(Request, &pMdl);
__try
{
MmProbeAndLockPages( pMdl, KernelMode, IoModifyAccess);
pagesLocked = TRUE;
pvUserData = MmGetSystemAddressForMdlSafe(pMdl, NormalPagePriority);
}
To try and lock the memory in my driver while I am using it so it will be
non-paged. The docs on these function are not really clear on whether they
accomplish what I am trying to do? Or if there is a better way of making
this work.
After I am finished with the buffer I call MmUnlockPages() to unlock the
memory. If I am sending data to my driver it works great, but if I send an
output buffer to the driver for receiving audio data into my app I get BSOD
when I complete the request attached to the memory after I am finished with
the memory and ready to send it back up to the app. Can someone explain the
best way to send and receive memory to my driver that I can use at DISPATCH
level? Or explain what I am doing wrong?
Thanks,
Greg
—
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
–
Mark Roddy
Back to first principles: The buffer you get when you call WdfRequestRetrieveOutputBuffer is NOT pageable. You can refer to it at IRQL DISPATCH_LEVEL. That’s the whole point.
If you have a bug, it’s something else…
Peter
OSR
thanks for clearing that up. I could not find in the docs where it
explicitly says that.
wrote in message news:xxxxx@ntdev…
>
>
> Back to first principles: The buffer you get when you call
> WdfRequestRetrieveOutputBuffer is NOT pageable. You can refer to it at
> IRQL DISPATCH_LEVEL. That’s the whole point.
>
> If you have a bug, it’s something else…
>
> Peter
> OSR
>
>