Hi.
I need to allocate a a large buffer ( 128 MB) of
shared memory in my WDM.
As of now, I call DeviceIoControl to allocate memory
in the driver and to send back the usermode address to
the application.
In DeviceIoControl, I call ExAllocatePool and allocate
128 MB from paged memory. I am calling IoAllocateMdl
but it fails. I read in some mailing lists that
IoAllocateMdl may not work for memory > 64 KB.
- Is there any workaround for this ??
After calling IoAllocateMdl, I am calling
MmProbeAndLockPages and MmMapLockedPages and passing
the resulting user mode address to the application.
-
Can I read access this buffer in ISR although it is
allocated in paged memory ??
-
If not, then can I allocate this much memory from
Non paged pool ?? I tried to allocate but got an
error.
My machine has 523MB RAM.
Thanks in advance.
Regards
Madhu
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>I read in some mailing lists that
IoAllocateMdl may not work for memory > 64 KB.
- Is there any workaround for this ??
MDLs are limited to ‘a little bit less than 64MB’ not 64KB. You have some
other problem.
Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
603 321 1032
WindowsNT Windows 2000 Consulting Services
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Hi,
Why would you need 128m of contiguous mem ?
I can’t argue, this is really handy, but you can alway make up a mechanism
that will allocate and handle multiple buffers of smaller size. Actually,
the rumor has it that you can’t allocate more then 64m in one call.
Regards,
Stas
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Madhu
Sent: Thursday, May 03, 2001 8:34 PM
To: NT Developers Interest List
Subject: [ntdev] Shared Memory Allocation
m
Hi.
I need to allocate a a large buffer ( 128 MB) of
shared memory in my WDM.
As of now, I call DeviceIoControl to allocate memory
in the driver and to send back the usermode address to
the application.
In DeviceIoControl, I call ExAllocatePool and allocate
128 MB from paged memory. I am calling IoAllocateMdl
but it fails. I read in some mailing lists that
IoAllocateMdl may not work for memory > 64 KB.
- Is there any workaround for this ??
After calling IoAllocateMdl, I am calling
MmProbeAndLockPages and MmMapLockedPages and passing
the resulting user mode address to the application.
-
Can I read access this buffer in ISR although it is
allocated in paged memory ??
-
If not, then can I allocate this much memory from
Non paged pool ?? I tried to allocate but got an
error.
My machine has 523MB RAM.
Thanks in advance.
Regards
Madhu
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
You are currently subscribed to ntdev as: xxxxx@powernetsys.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Hi,
I have a realtime device which transfers large amount
of data. I need to read the data from device into this
shared memory buffer and later read this buffer in the
application.
As of now, I am creating my own MDL by calling:
- MmSizeOfMdl() to get the size of MDL
- ExAllocatePool() to allocate MDL in nonpaged pool
and
- MmInitializeMdl() to initialize the MDL.
After that I call the other functions,
MmProbeAndLockPages() and MmMapLockedPages(). This
seems to be working fine.
Regds
Madhu
— stas wrote:
> Hi,
> Why would you need 128m of contiguous mem ?
> I can’t argue, this is really handy, but you can
> alway make up a mechanism
> that will allocate and handle multiple buffers of
> smaller size. Actually,
> the rumor has it that you can’t allocate more then
> 64m in one call.
> Regards,
> Stas
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of
> Madhu
> Sent: Thursday, May 03, 2001 8:34 PM
> To: NT Developers Interest List
> Subject: [ntdev] Shared Memory Allocation
> m
>
> Hi.
>
> I need to allocate a a large buffer ( 128 MB) of
> shared memory in my WDM.
>
> As of now, I call DeviceIoControl to allocate memory
> in the driver and to send back the usermode address
> to
> the application.
> In DeviceIoControl, I call ExAllocatePool and
> allocate
> 128 MB from paged memory. I am calling IoAllocateMdl
> but it fails. I read in some mailing lists that
> IoAllocateMdl may not work for memory > 64 KB.
>
> 1. Is there any workaround for this ??
>
> After calling IoAllocateMdl, I am calling
> MmProbeAndLockPages and MmMapLockedPages and passing
> the resulting user mode address to the application.
>
> 2. Can I read access this buffer in ISR although it
> is
> allocated in paged memory ??
>
> 3. If not, then can I allocate this much memory from
> Non paged pool ?? I tried to allocate but got an
> error.
>
> My machine has 523MB RAM.
>
> Thanks in advance.
> Regards
> Madhu
>
>
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great
> prices
> http://auctions.yahoo.com/
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@powernetsys.com
> To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Hi,
With all do respect to the realtimeness of your device my question is still
in tact. Why do you need 128m of contiguous nonpaged mem ?
What is the size of one chunk of the data you are getting from your device ?
What is the data reception speed ?
Regards,
Stas
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Madhu
Sent: Monday, May 07, 2001 5:14 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared Memory Allocation
Hi,
I have a realtime device which transfers large amount
of data. I need to read the data from device into this
shared memory buffer and later read this buffer in the
application.
As of now, I am creating my own MDL by calling:
- MmSizeOfMdl() to get the size of MDL
- ExAllocatePool() to allocate MDL in nonpaged pool
and
- MmInitializeMdl() to initialize the MDL.
After that I call the other functions,
MmProbeAndLockPages() and MmMapLockedPages(). This
seems to be working fine.
Regds
Madhu
— stas wrote:
> Hi,
> Why would you need 128m of contiguous mem ?
> I can’t argue, this is really handy, but you can
> alway make up a mechanism
> that will allocate and handle multiple buffers of
> smaller size. Actually,
> the rumor has it that you can’t allocate more then
> 64m in one call.
> Regards,
> Stas
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of
> Madhu
> Sent: Thursday, May 03, 2001 8:34 PM
> To: NT Developers Interest List
> Subject: [ntdev] Shared Memory Allocation
> m
>
> Hi.
>
> I need to allocate a a large buffer ( 128 MB) of
> shared memory in my WDM.
>
> As of now, I call DeviceIoControl to allocate memory
> in the driver and to send back the usermode address
> to
> the application.
> In DeviceIoControl, I call ExAllocatePool and
> allocate
> 128 MB from paged memory. I am calling IoAllocateMdl
> but it fails. I read in some mailing lists that
> IoAllocateMdl may not work for memory > 64 KB.
>
> 1. Is there any workaround for this ??
>
> After calling IoAllocateMdl, I am calling
> MmProbeAndLockPages and MmMapLockedPages and passing
> the resulting user mode address to the application.
>
> 2. Can I read access this buffer in ISR although it
> is
> allocated in paged memory ??
>
> 3. If not, then can I allocate this much memory from
> Non paged pool ?? I tried to allocate but got an
> error.
>
> My machine has 523MB RAM.
>
> Thanks in advance.
> Regards
> Madhu
>
>
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great
> prices
> http://auctions.yahoo.com/
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@powernetsys.com
> To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
—
You are currently subscribed to ntdev as: xxxxx@powernetsys.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> As of now, I am creating my own MDL by calling:
- MmSizeOfMdl() to get the size of MDL
- ExAllocatePool() to allocate MDL in nonpaged pool
and
- MmInitializeMdl() to initialize the MDL.
Wrong.
Use IoAllocateMdl/MmBuildMdlForNonPagedPool instead.
Max
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Hi
But IoAllocateMdl() failed when I tried to allocate an
MDL to describe a buffer of 128Mb. So I had to create
my own MDL.
Madhu
— “Maxim S. Shatskih”
wrote:
> > As of now, I am creating my own MDL by calling:
> > 1. MmSizeOfMdl() to get the size of MDL
> > 2. ExAllocatePool() to allocate MDL in nonpaged
> pool
> > and
> > 3. MmInitializeMdl() to initialize the MDL.
>
> Wrong.
> Use IoAllocateMdl/MmBuildMdlForNonPagedPool instead.
>
> Max
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Madhu,
In 32bit Windows, MDL’s use a ‘CSHORT’ variable for the size, which includes
an array of pages. Therefore an MDL itself can at most be 64k, describing
approximately (64k/sizeof(PFN_NUMBER) pages * page_size) bytes. I haven’t
done the math, but I’d bet you a quarter that’s less than 128M on X86
platforms.
-Tim
Timothy A. Johns — xxxxx@driverdev.com
Driver Development Corporation — 800.841.0092
Bring Up Your Hardware — Fast. www.driverdev.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Madhu
Sent: Monday, May 07, 2001 10:02 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared Memory Allocation
Hi
But IoAllocateMdl() failed when I tried to allocate an
MDL to describe a buffer of 128Mb. So I had to create
my own MDL.
Madhu
— “Maxim S. Shatskih”
> wrote:
> > > As of now, I am creating my own MDL by calling:
> > > 1. MmSizeOfMdl() to get the size of MDL
> > > 2. ExAllocatePool() to allocate MDL in nonpaged
> > pool
> > > and
> > > 3. MmInitializeMdl() to initialize the MDL.
> >
> > Wrong.
> > Use IoAllocateMdl/MmBuildMdlForNonPagedPool instead.
> >
> > Max
> >
> >
> > —
> > You are currently subscribed to ntdev as:
> > xxxxx@yahoo.com
> > To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>
> —
> You are currently subscribed to ntdev as: xxxxx@driverdev.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> As of now, I am creating my own MDL by calling:
- MmSizeOfMdl() to get the size of MDL
- ExAllocatePool() to allocate MDL in nonpaged pool
and
- MmInitializeMdl() to initialize the MDL.
xxxxx@storagecraft.com said:
Wrong. Use IoAllocateMdl/MmBuildMdlForNonPagedPool instead.
This sort of thing work for memory created by AllocateCommonBuffer?
I thought the original author was trying to get memory that the
hardware can access and share with the application.
Steve Williams “The woods are lovely, dark and deep.
xxxxx@icarus.com But I have promises to keep,
xxxxx@picturel.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep.”
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
He is trying to work around the size field limitation on the MDL. As far as
is known, this field is only used by IoAllocateMdl, so the theory is that if
you really, really, need a big MDL then you build your own without using
IoAllocateMdl. So far the theory has not been falsified, although it is a
HACK and is subject to breakage with any service pack or new release of NT.
I personally would go for the set of legal smaller MDLs myself, but for some
specific dedicated pseudo-realtime applications, this may not be good
enough.
Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
603 321 1032
WindowsNT Windows 2000 Consulting Services
-----Original Message-----
From: Timothy A. Johns [mailto:xxxxx@driverdev.com]
Sent: Monday, May 07, 2001 2:30 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared Memory Allocation
Madhu,
In 32bit Windows, MDL’s use a ‘CSHORT’ variable for the size, which includes
an array of pages. Therefore an MDL itself can at most be 64k, describing
approximately (64k/sizeof(PFN_NUMBER) pages * page_size) bytes. I haven’t
done the math, but I’d bet you a quarter that’s less than 128M on X86
platforms.
-Tim
Timothy A. Johns — xxxxx@driverdev.com
Driver Development Corporation — 800.841.0092
Bring Up Your Hardware — Fast. www.driverdev.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Madhu
Sent: Monday, May 07, 2001 10:02 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared Memory Allocation
Hi
But IoAllocateMdl() failed when I tried to allocate an
MDL to describe a buffer of 128Mb. So I had to create
my own MDL.
Madhu
— “Maxim S. Shatskih”
> wrote:
> > > As of now, I am creating my own MDL by calling:
> > > 1. MmSizeOfMdl() to get the size of MDL
> > > 2. ExAllocatePool() to allocate MDL in nonpaged
> > pool
> > > and
> > > 3. MmInitializeMdl() to initialize the MDL.
> >
> > Wrong.
> > Use IoAllocateMdl/MmBuildMdlForNonPagedPool instead.
> >
> > Max
> >
> >
> > —
> > You are currently subscribed to ntdev as:
> > xxxxx@yahoo.com
> > To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>
> —
> You are currently subscribed to ntdev as: xxxxx@driverdev.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
—
You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
xxxxx@powernetsys.com said:
With all do respect to the realtimeness of your device my question is
still in tact. Why do you need 128m of contiguous nonpaged mem ?
One reason I can imagine is if the person wants to make a buffer that
the hardware can read-write and applications can also access by mapping.
The only way I know to map preallocated memory into an application is
ZwMapViewOfSection, which can only map physically contiguous memory.
(You create a handle for the “PhysicalMemory” device and map that.)
Another reason could be “broken” hardware, although nowadays it is
absurd to have a high-performance widget that doesn’t do scatter-
gather bus mastering. However, AMCC based devices tend to be thusly
absurd.
Steve Williams “The woods are lovely, dark and deep.
xxxxx@icarus.com But I have promises to keep,
xxxxx@picturel.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep.”
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
When you say a set of legal small MDLs, do you mean
that I need to do these things ?
-
ExAllocatePool ( allocate a large block).
-
Begin loop:
a. IoAllocateMdl allocating MDL for sa 64 MB at a
time.
b. MmProbeandLockPages locking each section.
c. MmMapLockedPages to give usermode address.
EndLoop
Store the user mode addresses of all blocks in array
and give back array to user.
— “Roddy, Mark” wrote:
> He is trying to work around the size field
> limitation on the MDL. As far as
> is known, this field is only used by IoAllocateMdl,
> so the theory is that if
> you really, really, need a big MDL then you build
> your own without using
> IoAllocateMdl. So far the theory has not been
> falsified, although it is a
> HACK and is subject to breakage with any service
> pack or new release of NT.
>
> I personally would go for the set of legal smaller
> MDLs myself, but for some
> specific dedicated pseudo-realtime applications,
> this may not be good
> enough.
>
> Mark Roddy
> xxxxx@hollistech.com
> www.hollistech.com
> 603 321 1032
> WindowsNT Windows 2000 Consulting Services
>
>
>
> -----Original Message-----
> From: Timothy A. Johns [mailto:xxxxx@driverdev.com]
> Sent: Monday, May 07, 2001 2:30 PM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Shared Memory Allocation
>
>
> Madhu,
>
> In 32bit Windows, MDL’s use a ‘CSHORT’ variable for
> the size, which includes
> an array of pages. Therefore an MDL itself can at
> most be 64k, describing
> approximately (64k/sizeof(PFN_NUMBER) pages *
> page_size) bytes. I haven’t
> done the math, but I’d bet you a quarter that’s less
> than 128M on X86
> platforms.
>
> -Tim
>
> Timothy A. Johns — xxxxx@driverdev.com
> Driver Development Corporation — 800.841.0092
> Bring Up Your Hardware — Fast. www.driverdev.com
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf
> Of Madhu
> > Sent: Monday, May 07, 2001 10:02 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] RE: Shared Memory Allocation
> >
> >
> > Hi
> >
> > But IoAllocateMdl() failed when I tried to
> allocate an
> > MDL to describe a buffer of 128Mb. So I had to
> create
> > my own MDL.
> >
> > Madhu
> > — “Maxim S. Shatskih”
> > wrote:
> > > > As of now, I am creating my own MDL by
> calling:
> > > > 1. MmSizeOfMdl() to get the size of MDL
> > > > 2. ExAllocatePool() to allocate MDL in
> nonpaged
> > > pool
> > > > and
> > > > 3. MmInitializeMdl() to initialize the MDL.
> > >
> > > Wrong.
> > > Use IoAllocateMdl/MmBuildMdlForNonPagedPool
> instead.
> > >
> > > Max
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
> > > xxxxx@yahoo.com
> > > To unsubscribe send a blank email to
> > leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
> >
> >
> > Do You Yahoo!?
> > Yahoo! Auctions - buy the things you want at great
> prices
> > http://auctions.yahoo.com/
> >
> > —
> > You are currently subscribed to ntdev as:
> xxxxx@driverdev.com
> > To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@stratus.com
> To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com