Tech Support > Microsoft Windows > Drivers > To lock, or not to lock, pages...
To lock, or not to lock, pages...
Posted by Ed Averill on September 1st, 2005


Ok, I inherited a basic Windows USB driver that handles pushing data across a
couple of bulk pipes. This driver works fine under Win2K, but eventually
crashes XP/SP2 with a page fault error...

Now, this driver takes a large user buffer and chops it up into nice
USB-able sized blocks. It allocates a MDL and then re-uses it over and over
again, freeing it once the entire transfer has been shoved across the bulk
pipe. Never does it try to MmProbeAndLockPages(), which I found odd.. but it
works under Win2K..

So my question is: should I put in MmProbeAndLockPages() for the user
buffer? And if so, before or after IoBuildPartialMdl() (I think before since
the user buffer needs to be resident, right)?

I'm somewhat clueless, so apologies if this is a dim question. I'm reading
all the docs I can get my hands on!

Posted by Maxim S. Shatskih on September 1st, 2005


They are mutually exclusive.

MmProbeAndLockPages means - MDL is based on pageable buffer. IoBuildPartialMdl
means - MDL is based on another MDL.

Sorry, these things are mutually exclusive. The third variant is MDL based on
nonpaged buffer - MmBuildMdlForNonPagedPool. Note that this also works for
memory-mapped devices like video framebuffers.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com



Posted by Doron Holan [MS] on September 2nd, 2005


you might be running out of PTEs. look at MmPrepareMdlForReuse and see if
that applies. the bulkusb sample demonstrates how to use it.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Ed Averill" <Ed Averill@discussions.microsoft.com> wrote in message
news:7C9E330F-07E8-4A6F-AB67-6E36C2A83635@microsoft.com...


Posted by Gary G. Little on September 2nd, 2005


Edward!!!! How the heck are ya!! We are in Minnesota now, where are you?

Gary
glittle@mn.rr.com
gary.g.little@seagate.com

"Ed Averill" wrote:


Similar Posts