Tech Support > Microsoft Windows > Drivers > Mapping multiple physical/system address virtual buffers into a single user-space virtual range.
Mapping multiple physical/system address virtual buffers into a single user-space virtual range.
Posted by Maxim S. Shatskih on August 4th, 2006


No. The OS just locks the pages _of the user buffer_ to the MDL and provide you
with this MDL.

Correct. IoBuildPartialMdl is your friend.

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


Posted by Maxim S. Shatskih on August 4th, 2006


Correct, and I don't think RegMon is intended for _production_ servers. It is a
lab tool.

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


Posted by Don Burn on August 4th, 2006


And of course RegMon no longer does this for OS'es Microsoft supports.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply



"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:eaviji$btm$1@news.mtu.ru...


Posted by grishka@gmail.com on August 4th, 2006


Then again. I have a pointer to kernel-mode buffers that were NOT
allocated by me. The PCI device fills those buffers using its DMA. I
can't copy the data from the buffers because it takes too much CPU. I
must have these buffers merged into continuous address space for fast
sequential processing by user-mode application. I don't mind using
"extreme hacking" if there's no standard way to do this. My options?

Maxim S. Shatskih wrote:

Posted by grishka@gmail.com on August 4th, 2006


Sorry, I just missed your reply. Thanks very much for your help!
Maxim S. Shatskih wrote:

Posted by Alexander Grigoriev on August 4th, 2006


And what you do with that amount of data?
Is it really PCI or modern PCI-X? PCI theoretically cannot handle >133MB/s,
unless you have 64 bit, 66MHz, which gives you only 4 times as much.

<grishka@gmail.com> wrote in message
news:1154693345.963482.31520@p79g2000cwp.googlegro ups.com...


Posted by grishka@gmail.com on August 4th, 2006


It's not PCI-X (currently), but I'm definitely getting close to 1
GBit/sec, so maybe it's really 64/66 one.

Alexander Grigoriev wrote:

Posted by Maxim S. Shatskih on August 4th, 2006


Why contiguous? Map several buffers to the user space, and reference them by
pointer array. Is it bad?

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


Posted by Maxim S. Shatskih on August 4th, 2006


Note about IoBuildPartialMdl.

Having the VirtualAddress parameter in this call is some strange design
idea by MS. The correct value for this parameter is:

(PUCHAR)(MmGetMdlVirtualAddress(MasterMdl)) + Offset

This allows you to make a part by usual offset/length pair.

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

<grishka@gmail.com> wrote in message
news:1154701130.401524.159130@p79g2000cwp.googlegr oups.com...

Posted by Pavel A. on August 4th, 2006


"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message news:eb073d$f7s$1@news.mtu.ru...
But the offset must be page aligned? you can't glue together
two memory blocks less than a page, without a hole between?

--PA



Posted by Maxim S. Shatskih on August 4th, 2006


No. I'm not about glueing together, I'm about separating and making sub-range
descriptor from a range descriptor.

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


Posted by Alexander Grigoriev on August 5th, 2006


So it's 1 Gbit/s (128 MB/s) not 1 GB/s?

<grishka@gmail.com> wrote in message
news:1154713914.142853.62810@m73g2000cwd.googlegro ups.com...


Posted by grishka@gmail.com on August 5th, 2006


No, this won't work because the user-mode application must output the
data directly to a third device as a single, coninuous block.
Maxim S. Shatskih wrote:

Posted by grishka@gmail.com on August 5th, 2006


Right.

Alexander Grigoriev wrote:

Posted by Maxim S. Shatskih on August 5th, 2006


Can you get rid of the "opaque driver" in the middle, it seems to be mis
designed? I'm just amazed what stack is it, with _such_ perf requirements and
mis-designed "opaque drivers".
What is the third device? Can WriteFileGather help for it?
If I would know something about the stack itself - then I will possible
have some more ideas.

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

<grishka@gmail.com> wrote in message
news:1154761238.211422.298730@i42g2000cwa.googlegr oups.com...

Posted by grishka@gmail.com on August 5th, 2006


No, that's the whole point! The driver in question is not
"misdesigned". Its a completely legal driver for the PCI device.
Getting incoming data from such a driver in a standard way, however,
requires copying that data, which is prohibitive for the performance
reasons I stated. Replacing this driver by mine solves the problem, but
then the replacement driver is device-specific, which is a huge
disadvantage.
to its memory.
In short, I must build a straight path from getting data from the input
device to putting it to the output device without the CPU being
involved in copying.


Maxim S. Shatskih wrote:

Posted by grishka@gmail.com on August 5th, 2006


I understand that the "glueing" I need is achieved by splitting the
user-mode virtual range. Each request is completing with the
corresponding part filled and I end up with a contiguous buffer filled
by the contents of several system-space buffers. Right?

Maxim S. Shatskih wrote:

Posted by Maxim S. Shatskih on August 5th, 2006


For me, being correct it terms of Windows use - and more, so, no hackery with
opaque drivers - overweights the "device-speficic" problem.

Your decision.

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


Posted by Maxim S. Shatskih on August 5th, 2006


Yes.

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


Posted by Alexander Grigoriev on August 6th, 2006


The driver+device is "misdesigned" in a sense that instead of the right
approach of using client-provided buffers it is using its own internal
buffers (lack of S/G or large address support in the device?), thus forcing
the client to do weird kludges to exchange data.

<grishka@gmail.com> wrote in message
news:1154776355.561436.205930@i3g2000cwc.googlegro ups.com...