Skip to contentSkip to conversation

Can I get 200M contiguous physical memory?

DISCUSSION Jason Luo 7 participants 10 messages Mar 10, 2005 – Mar 11, 2005

lore
Share & tools
lore

Jason Luo

author
#0 lore raw

Hi,

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

thanks!
Jason

#1 lore raw
Quoted 2 lines · Jason Luo

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?

author
#2 lore raw

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?

Quoted 8 lines · Chris Wedgwood
Quoted 2 lines · Jason Luo

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?

#3 lore raw
Quoted 5 lines · Jason Luo

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)

#4 lore raw

From: "Arjan van de Ven" <[email protected]>
To: "Jason Luo" <[email protected]>

Quoted 5 lines
Quoted 2 lines

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.)

#5 lore raw
Quoted 8 lines · Nate Edel

From: "Arjan van de Ven" <[email protected]>
To: "Jason Luo" <[email protected]>

Quoted 5 lines
Quoted 2 lines

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)

Quoted 6 lines

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.

#6 lore raw
In reply to Nate Edel
Quoted 8 lines · Nate Edel

From: "Arjan van de Ven" <[email protected]>
To: "Jason Luo" <[email protected]>

Quoted 5 lines
Quoted 2 lines

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)

Quoted 6 lines

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.

#7 lore raw
In reply to Jason Luo
Quoted 2 lines · Jason Luo

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?

Quoted 1 line

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?

Quoted 2 lines

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?

#8 lore raw
In reply to Jason Luo
Quoted 2 lines · Jason Luo

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

Signature · 1 line
I thought the only thing the internet was good for was porn.  -- Futurama
#9 lore raw
Quoted 11 lines · Mario Holbe
Quoted 2 lines · Jason Luo

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.

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