Contiguous memory

Hello,

I need to download Fw to the driver. The Fw size is 384K. I need contiguous
memory and so I call
MmAllocateContiguousMemory. This succeeds at Driver initialization but
fails during normal operations(due to fragmentation) I might need to do Fw
download at anytime not necessarily at driver init. Is there a way to go
about doing this??

Thanks
Daniel


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 think you answered your own question. If you need a large (for some value
of large) contiguous buffer for use during normal operations you had better
allocate it in DriverEntry and hold on to it until you are unloaded.

Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
603 321 1032
WindowsNT Windows 2000 Consulting Services

-----Original Message-----
From: Daniel Pradeep [mailto:xxxxx@broadlogic.com]
Sent: Wednesday, March 07, 2001 4:44 PM
To: NT Developers Interest List
Subject: [ntdev] Contiguous memory

Hello,

I need to download Fw to the driver. The Fw size is 384K. I need contiguous
memory and so I call
MmAllocateContiguousMemory. This succeeds at Driver initialization but
fails during normal operations(due to fragmentation) I might need to do Fw
download at anytime not necessarily at driver init. Is there a way to go
about doing this??

Thanks
Daniel


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

Performance gets a hit. So I would like to know whether there is some other
way of circumventing this problem.

-----Original Message-----
From: Roddy, Mark [mailto:xxxxx@stratus.com]
Sent: Wednesday, March 07, 2001 1:50 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Contiguous memory

I think you answered your own question. If you need a large (for some value
of large) contiguous buffer for use during normal operations you had better
allocate it in DriverEntry and hold on to it until you are unloaded.

Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
603 321 1032
WindowsNT Windows 2000 Consulting Services

-----Original Message-----
From: Daniel Pradeep [mailto:xxxxx@broadlogic.com]
Sent: Wednesday, March 07, 2001 4:44 PM
To: NT Developers Interest List
Subject: [ntdev] Contiguous memory

Hello,

I need to download Fw to the driver. The Fw size is 384K. I need contiguous
memory and so I call
MmAllocateContiguousMemory. This succeeds at Driver initialization but
fails during normal operations(due to fragmentation) I might need to do Fw
download at anytime not necessarily at driver init. Is there a way to go
about doing this??

Thanks
Daniel


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@broadlogic.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

If your system performance is measurably sensitive to a 384K allocation,
your system is way under-resourced.
Phil
* Philip D. Barila | (503) 264-8386
* Intel Corp. | Not speaking for Intel

-----Original Message-----
From: Daniel Pradeep [mailto:xxxxx@broadlogic.com]
Sent: Wednesday, March 07, 2001 2:01 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Contiguous memory

Performance gets a hit. So I would like to know whether there is some other
way of circumventing this problem.

-----Original Message-----
From: Roddy, Mark [mailto:xxxxx@stratus.com]
Sent: Wednesday, March 07, 2001 1:50 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Contiguous memory

I think you answered your own question. If you need a large (for some value
of large) contiguous buffer for use during normal operations you had better
allocate it in DriverEntry and hold on to it until you are unloaded.

Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
603 321 1032
WindowsNT Windows 2000 Consulting Services

-----Original Message-----
From: Daniel Pradeep [mailto:xxxxx@broadlogic.com]
Sent: Wednesday, March 07, 2001 4:44 PM
To: NT Developers Interest List
Subject: [ntdev] Contiguous memory

Hello,

I need to download Fw to the driver. The Fw size is 384K. I need contiguous
memory and so I call
MmAllocateContiguousMemory. This succeeds at Driver initialization but
fails during normal operations(due to fragmentation) I might need to do Fw
download at anytime not necessarily at driver init. Is there a way to go
about doing this??

Thanks
Daniel


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@broadlogic.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@intel.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

It’s traditional to write firmware in packets, so that only a 4/16/32KB buffer is
required temporarily.
Any driver that grabs 384KB at DriverEntry and does not release (on the off-chance
a firmware update may be requested), of course, deserves to roast in purgatory.

Regards,

Paul Bunn, UltraBac.com, 425-644-6000
Microsoft MVP - WindowsNT/2000
http://www.ultrabac.com

-----Original Message-----
From: Daniel Pradeep [mailto:xxxxx@broadlogic.com]
Sent: Wednesday, March 07, 2001 1:44 PM
To: NT Developers Interest List
Subject: [ntdev] Contiguous memory

Hello,

I need to download Fw to the driver. The Fw size is 384K. I need contiguous
memory and so I call
MmAllocateContiguousMemory. This succeeds at Driver initialization but
fails during normal operations(due to fragmentation) I might need to do Fw
download at anytime not necessarily at driver init. Is there a way to go
about doing this??


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

While I agree with your sentiments, I took the original request at face
value: the hardware requires a contiguous physical memory allocation for its
firmware update, firmware updates must occur while the device is
operational, not just at initialization. Given these constraints the fellow
will have to allocate his contiguous buffer at DriverEntry, or he will be
forced to reboot his system in order to update his firmware. If there is
some other solution to this problem I’d like to know what it is.
MmDefragmentAndThenAllocateContiguousBuffer()?

Add more ram. Whatever the performance was before the static allocation will
be restored (and then some) by tossing another stick of SDRAM onto the
platform.

Ship the device with the additional memory :slight_smile:

Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
603 321 1032
WindowsNT Windows 2000 Consulting Services

-----Original Message-----
From: Paul Bunn [mailto:xxxxx@UltraBac.com]
Sent: Wednesday, March 07, 2001 5:11 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Contiguous memory

It’s traditional to write firmware in packets, so that only a 4/16/32KB
buffer is
required temporarily.
Any driver that grabs 384KB at DriverEntry and does not release (on the
off-chance
a firmware update may be requested), of course, deserves to roast in
purgatory.

Regards,

Paul Bunn, UltraBac.com, 425-644-6000
Microsoft MVP - WindowsNT/2000
http://www.ultrabac.com

-----Original Message-----
From: Daniel Pradeep [mailto:xxxxx@broadlogic.com]
Sent: Wednesday, March 07, 2001 1:44 PM
To: NT Developers Interest List
Subject: [ntdev] Contiguous memory

Hello,

I need to download Fw to the driver. The Fw size is 384K. I need contiguous
memory and so I call
MmAllocateContiguousMemory. This succeeds at Driver initialization but
fails during normal operations(due to fragmentation) I might need to do Fw
download at anytime not necessarily at driver init. Is there a way to go
about doing this??


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

> From: “Roddy, Mark”
>
> If you need a large (for some value
> of large) contiguous buffer for use during normal operations you had better
> allocate it in DriverEntry and hold on to it until you are unloaded.

I’m interested in “some value of large”. What is the biggest
physically contiguous buffer I can allocate? I guess that
these buffers come from non-paged pool, and I understand that
the maximum size of non-paged pool for IA-32 is 256 MB. If so,
this must be the hard limit, and the practical limit will be
considerably less (since I suppose I’ll have to let other
software use a bit of it!). Does the actual size of non-paged
pool vary with physical memory size, and is there some way
to configure it? Given a system with a reasonable amount of
physical memory (say 2 GB and up) would I have a hope of
getting a 10 MB contiguous buffer?

On IA-64 the limit on non-paged pool is 128 GB, so I assume
my chances of allocating a contiguous buffer in the tens of
MB would be much higher here, assuming a reasonable amount of
physical memory in the system. Is the pool size configurable
in Windows 64?


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

J. J. :

The way I did it when I had to solve the same problem was to reserve memory
at boot time using
the BOOT.INI parameter /MAXMEM:n to get contiguous memory before it got
fragmented.
Then, in the kernel code I mapped that memory to have a kernel (and a user
as well) virtual address for it. You can have as much memory as the page
tables space allow for it. 10MB is
OK. This assumes that you know how much memory is in the system.

George

At 05:18 PM 3/7/01 -0800, you wrote:

> From: “Roddy, Mark”
> >
> > If you need a large (for some value
> > of large) contiguous buffer for use during normal operations you had better
> > allocate it in DriverEntry and hold on to it until you are unloaded.
>
>I’m interested in “some value of large”. What is the biggest
>physically contiguous buffer I can allocate? I guess that
>these buffers come from non-paged pool, and I understand that
>the maximum size of non-paged pool for IA-32 is 256 MB. If so,
>this must be the hard limit, and the practical limit will be
>considerably less (since I suppose I’ll have to let other
>software use a bit of it!). Does the actual size of non-paged
>pool vary with physical memory size, and is there some way
>to configure it? Given a system with a reasonable amount of
>physical memory (say 2 GB and up) would I have a hope of
>getting a 10 MB contiguous buffer?
>
>On IA-64 the limit on non-paged pool is 128 GB, so I assume
>my chances of allocating a contiguous buffer in the tens of
>MB would be much higher here, assuming a reasonable amount of
>physical memory in the system. Is the pool size configurable
>in Windows 64?
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@brd.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

>I’m interested in “some value of large”. What is the biggest

physically contiguous buffer I can allocate?

The “rule of thumb” I sometimes like is: if every driver or application did
what you plan to do, would you feel annoyed. This is a rearrangement of
“don’t do anything that effects another developer, unless you would not
mind the same thing affecting what your doing”.

You also have to be aware of what your target machines are. If your target
is an embedded system and you have total control over everything, you can
do things that are unthinkable for a general purpose PC being used by your
accountant. Cost of your device is also a factor. If your selling a
$200,000 mass spectrometer, requiring the target system to have 512 MByte
of RAM might be a trivial factor. Requiring the target system of your $29
USB gizmo to have 512 MByte of RAM will not make people happy, unless your
hardware is so wonderful all it’s equal competitors cost $1000.

So the answer is: it depends.

  • Jan

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

> From: Jan Bottorff
>
> >I’m interested in “some value of large”. What is the biggest
> >physically contiguous buffer I can allocate?
>
> The “rule of thumb” I sometimes like is: if every driver or application did
> what you plan to do, would you feel annoyed. This is a rearrangement of
> “don’t do anything that effects another developer, unless you would not
> mind the same thing affecting what your doing”.
>
> You also have to be aware of what your target machines are. If your target
> is an embedded system and you have total control over everything, you can
> do things that are unthinkable for a general purpose PC being used by your
> accountant. Cost of your device is also a factor. If your selling a
> $200,000 mass spectrometer, requiring the target system to have 512 MByte
> of RAM might be a trivial factor. Requiring the target system of your $29
> USB gizmo to have 512 MByte of RAM will not make people happy, unless your
> hardware is so wonderful all it’s equal competitors cost $1000.
>
> So the answer is: it depends.

I agree entirely with everything you say, and this is exactly why
I asked the questions I did and set the parameters I did. If I
allocate 10 MB when there’s only 10.1 MB available, that’s anti-
social; if I do it when there’s several GB available, no-one’s
going to notice. Unless I know how much is available in the
appropriate circumstances, I can’t sensibly decide.

So the questions are: what limits does the OS impose on the memory
available for allocation as physically contiguous buffers, for both
Windows 32 and Windows 64; and if I have a system with at least
2 GB of physical memory, is it unreasonable to allocate a 10 MB
contiguous buffer?


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

> From: George Blat
>
> The way I did it when I had to solve the same problem was to reserve memory
> at boot time using
> the BOOT.INI parameter /MAXMEM:n to get contiguous memory before it got
> fragmented.
> Then, in the kernel code I mapped that memory to have a kernel (and a user
> as well) virtual address for it. You can have as much memory as the page
> tables space allow for it. 10MB is
> OK. This assumes that you know how much memory is in the system.

Thanks, George. I’ve used schemes like this in the past, but I’d
like to stay within the “official” way of doing things this time
if possible. It gets messy to try to automatically deal with the
user adding or removing memory, for example.

By the way, does anyone know if 2000 or successor (IA32 and IA64)
support machines with physically discontiguous memory. That is,
physical address maps where there might be a GB of memory, then
a GB of nothing, then another GB of memory, and so on?


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

Hello
Are you using Dma to transfer the FW code. if you are using DMA then better to
allocate by using HalAllocateCommonBuffer(). it gives you contiguous mem… and
it return Phys addr, and ker virtual addr.

try this.

Daniel Pradeep wrote:

Hello,

I need to download Fw to the driver. The Fw size is 384K. I need contiguous
memory and so I call
MmAllocateContiguousMemory. This succeeds at Driver initialization but
fails during normal operations(due to fragmentation) I might need to do Fw
download at anytime not necessarily at driver init. Is there a way to go
about doing this??

Thanks
Daniel


You are currently subscribed to ntdev as: xxxxx@teil.soft.net
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Sunil Kumar Sahu.
System Development Group.
TATA ELXSI Ltd.
Whitefield Road, B’lore.
Ph No :- 8410148 /49 /50(ext 256)

******Engineering the Information Revolution******


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 know that NT 3.51 & NT 4.0 running on Mips architecture did actually
support machines with physically discontiguous memory. You just had to
report the memory layout properly in the platform firmware (I did it, it
worked :-). I am 99% sure that’s the same on Intel architecture as long as
you do things properly in your BIOS/firmware.

Pierre

On 03/07/01, ““J. J. Farrell” ” wrote:
> > From: George Blat
> >
> > The way I did it when I had to solve the same problem was to reserve memory
> > at boot time using
> > the BOOT.INI parameter /MAXMEM:n to get contiguous memory before it got
> > fragmented.
> > Then, in the kernel code I mapped that memory to have a kernel (and a user
> > as well) virtual address for it. You can have as much memory as the page
> > tables space allow for it. 10MB is
> > OK. This assumes that you know how much memory is in the system.
>
> Thanks, George. I’ve used schemes like this in the past, but I’d
> like to stay within the “official” way of doing things this time
> if possible. It gets messy to try to automatically deal with the
> user adding or removing memory, for example.
>
> By the way, does anyone know if 2000 or successor (IA32 and IA64)
> support machines with physically discontiguous memory. That is,
> physical address maps where there might be a GB of memory, then
> a GB of nothing, then another GB of memory, and so on?
>
>
> —
> 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


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

This kind of allocation would be best done at driver init but supply
a special driver to be loaded when firmware mods are to be enabled.

A current thread over on vuln-dev about hardware destroying virii
is relevant: enabling your firmware to be overwritten automatically
could allow something to write junk over it.

-----Original Message-----
From: Daniel Pradeep [mailto:xxxxx@broadlogic.com]
Sent: Wednesday, March 07, 2001 4:44 PM
To: NT Developers Interest List
Subject: [ntdev] Contiguous memory

Hello,

I need to download Fw to the driver. The Fw size is 384K. I need contiguous
memory and so I call
MmAllocateContiguousMemory. This succeeds at Driver initialization but
fails during normal operations(due to fragmentation) I might need to do Fw
download at anytime not necessarily at driver init. Is there a way to go
about doing this??

Thanks
Daniel


You are currently subscribed to ntdev as: xxxxx@FirstUSA.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