2005-03-10 08:10:22

by Jason Luo

[permalink] [raw]
Subject: Can I get 200M contiguous physical memory?

Hi,

Now, I am writing a driver, which need 200M contiguous physical
memory? can do? how to do it?

thanks!
Jason


2005-03-10 08:18:52

by Chris Wedgwood

[permalink] [raw]
Subject: Re: Can I get 200M contiguous physical memory?

On Thu, Mar 10, 2005 at 04:10:18PM +0800, Jason Luo wrote:

> Now, I am writing a driver, which need 200M contiguous physical
> memory? can do? how to do it?

Not easily no. Do you really need this? What kind of hardware is
this?

2005-03-10 08:49:23

by Jason Luo

[permalink] [raw]
Subject: Re: Can I get 200M contiguous physical memory?

thanks!
A data acquisition card. In DMA mode, the card need 200M contiguous
memory for DMA.
it's driver in windows can do it. so custom ask us to support it.
are there a way although it'is unpopular?

On Thu, 10 Mar 2005 00:16:34 -0800, Chris Wedgwood <[email protected]> wrote:
> On Thu, Mar 10, 2005 at 04:10:18PM +0800, Jason Luo wrote:
>
> > Now, I am writing a driver, which need 200M contiguous physical
> > memory? can do? how to do it?
>
> Not easily no. Do you really need this? What kind of hardware is
> this?
>

2005-03-10 08:57:24

by Arjan van de Ven

[permalink] [raw]
Subject: Re: Can I get 200M contiguous physical memory?

On Thu, 2005-03-10 at 16:49 +0800, Jason Luo wrote:
> thanks!
> A data acquisition card. In DMA mode, the card need 200M contiguous
> memory for DMA.
> it's driver in windows can do it. so custom ask us to support it.
> are there a way although it'is unpopular?

not really unless your card can do scatter gather...


(or want to reserve memory at the boot commandline and then do really
really evil hacks)

2005-03-10 09:01:12

by Chris Wedgwood

[permalink] [raw]
Subject: Re: Can I get 200M contiguous physical memory?

On Thu, Mar 10, 2005 at 04:49:20PM +0800, Jason Luo wrote:

> A data acquisition card. In DMA mode, the card need 200M contiguous
> memory for DMA.

ick? it can't do scatter-gather or anything sane?

> it's driver in windows can do it.

windows can get 200MB of memory on a running system relaibly? does it
swap like mad when you do this?

> so custom ask us to support it. are there a way although it'is
> unpopular?

you could allocate the memory at boot-time just for the driver, hacky
but would work

there are a couple of patches/methods for doing this. i think a
search for bigphysarea on google might help?

2005-03-10 09:11:25

by Mario 'BitKoenig' Holbe

[permalink] [raw]
Subject: Re: Can I get 200M contiguous physical memory?

Jason Luo <[email protected]> wrote:
> Now, I am writing a driver, which need 200M contiguous physical
> memory? can do? how to do it?

The ftape utils have a tool called swapout which tries to 'free'
large chunks of memory which then can be allocated by the ftape
module loaded subsequently.
I don't know if this approach does also work with *such* large
chunks like yours.


regards,
Mario
--
I thought the only thing the internet was good for was porn. -- Futurama

2005-03-10 19:16:35

by Nate Edel

[permalink] [raw]
Subject: Re: Can I get 200M contiguous physical memory?

From: "Arjan van de Ven" <[email protected]>
To: "Jason Luo" <[email protected]>
>> A data acquisition card. In DMA mode, the card need 200M contiguous
>> memory for DMA.
>
> (or want to reserve memory at the boot commandline and then do really
> really evil hacks)

Such as booting the machine with "mem=(real memory - 200)M" and then
just doing an ioremap of the top 200M of memory.

It's not the most elegant way of doing things given that it requires
user intervention at boot time, but I'm not sure it counts as a "really
evil hack." Code-wise it's very simple - there's sample code in a
couple of the in-RAM MTD(*) drivers you can use as a model. I'm not sure
if this method will translate easily to non-x86 platforms if that's an
issue.

(* /drivers/mtd/devices/slram.c and /drivers/mtd/devices/mtdram.c ; I'm
not sure which of these is more up to date.)

2005-03-10 19:16:33

by Arjan van de Ven

[permalink] [raw]
Subject: Re: Can I get 200M contiguous physical memory?

On Thu, 2005-03-10 at 10:57 -0800, Nate Edel wrote:
> From: "Arjan van de Ven" <[email protected]>
> To: "Jason Luo" <[email protected]>
> >> A data acquisition card. In DMA mode, the card need 200M contiguous
> >> memory for DMA.
> >
> > (or want to reserve memory at the boot commandline and then do really
> > really evil hacks)
>
> Such as booting the machine with "mem=(real memory - 200)M" and then
> just doing an ioremap of the top 200M of memory.
>
> It's not the most elegant way of doing things given that it requires
> user intervention at boot time, but I'm not sure it counts as a "really
> evil hack."

it really gets evil if your machine has > 4Gb of ram... then things
really go weird with this.


2005-03-10 20:36:32

by linux-os (Dick Johnson)

[permalink] [raw]
Subject: Re: Can I get 200M contiguous physical memory?

On Thu, 10 Mar 2005, Nate Edel wrote:

> From: "Arjan van de Ven" <[email protected]>
> To: "Jason Luo" <[email protected]>
>>> A data acquisition card. In DMA mode, the card need 200M contiguous
>>> memory for DMA.
>>
>> (or want to reserve memory at the boot commandline and then do really
>> really evil hacks)
>
> Such as booting the machine with "mem=(real memory - 200)M" and then just
> doing an ioremap of the top 200M of memory.
>
> It's not the most elegant way of doing things given that it requires user
> intervention at boot time, but I'm not sure it counts as a "really evil
> hack." Code-wise it's very simple - there's sample code in a couple of the
> in-RAM MTD(*) drivers you can use as a model. I'm not sure if this method
> will translate easily to non-x86 platforms if that's an issue.
>
> (* /drivers/mtd/devices/slram.c and /drivers/mtd/devices/mtdram.c ; I'm not
> sure which of these is more up to date.)
> -

It doesn't require user-intervention either you can put a "mem="
statement in your boot configuration. Here's some GRUB stuff:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/hda1
# initrd /boot/initrd-version.img
#boot=/dev/hda
default=1
timeout=10
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
title Fedora Core (2.6.11)
root (hd0,0)
kernel /boot/vmlinuz-2.6.11 ro root=LABEL=/ mem=768m rhgb
initrd /boot/initrd-2.6.11.img

[SNIPPED...]

Also, You should NEVER require 200 MB of contiguous memory! The Bus-
Master controllers (all of them) provide for scatter-lists. You just
need to know how to program them. You just get the bus address of
every page in an allocated buffer. You just put those addresses in
the linked-list.

Even the old ISA DMA controller can only do 128k (64k words) at
a time. Therefore, you only need 128k of physical memory locked
down at any one time.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.10 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.

2005-03-11 02:25:31

by Robert Hancock

[permalink] [raw]
Subject: Re: Can I get 200M contiguous physical memory?

Chris Wedgwood wrote:
>>it's driver in windows can do it.
>
>
> windows can get 200MB of memory on a running system relaibly? does it
> swap like mad when you do this?

I'm guessing that driver isn't too likely to pass WHQL testing on
Windows either, whatever it's doing..

--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from [email protected]
Home Page: http://www.roberthancock.com/

2005-03-11 20:36:24

by Bill Davidsen

[permalink] [raw]
Subject: Re: Can I get 200M contiguous physical memory?

Mario Holbe wrote:
> Jason Luo <[email protected]> wrote:
>
>>Now, I am writing a driver, which need 200M contiguous physical
>>memory? can do? how to do it?
>
>
> The ftape utils have a tool called swapout which tries to 'free'
> large chunks of memory which then can be allocated by the ftape
> module loaded subsequently.
> I don't know if this approach does also work with *such* large
> chunks like yours.

Wasn't there a problem with a process having mlocked memory in the wrong
place and the application hanging? Or the kernel hanging? Or something.
Can't remember.

--
-bill davidsen ([email protected])
"The secret to procrastination is to put things off until the
last possible moment - but no longer" -me