Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Mar 1997 09:44:22 -0500
From:      Brian McGovern <bmcgover@cisco.com>
To:        hackers@freebsd.org
Subject:   Memory/buffer questions...
Message-ID:  <199703071444.JAA01671@bmcgover-pc.cisco.com>

next in thread | raw e-mail | index | archive | help
*sigh* "Light begins to dawn over Marble Head". 

Ok. Next rounds of questions. Dynamic memory allocation from within a kernel.
I remember reading somewhere in one of my driver books that doing dynamic
memory allocation in a kernel is bad, supposedly because there is only
so much space from which to pull the resources. However, after looking at
several drivers, it appears that they call malloc (relatively) freely. I didn't
however, look to see how much they're trying to use.

The reason I want to dynamically allocate space is that I'll be working on
a driver for a card that can do 460K/s. The firmware on the card will usually
allocate a buffer of 2-4Kb, allowing for an interrupt latency (according
to the docs) of 40-85 ms. 

What the board is capable of doing however, is to allocate memory in the
kernel, and then doing DMA from the card right to the ram using bus
mastering. What I'm thinking of doing is using a default 2-4Kb buffer,
but put it in the host, and then allow kernel options to resize the buffers
(so if someone is getting hosed performace, they could possibly kick it up
to 8K, etc).

With that in mind, I think my questions are:

1.) Is this even possible (ie - is the passage I read defunct, or is there
really a limit as to the amount of memory that can be dynamically allocated).

2.) I would need to have this memory space accesable from devices on the PCI
bus. Is there any special steps I'll need to take to map this memory to 
someplace special? How about to make sure it stays locked in to physical memory
so DMA can occur? Fortunately, since the processor on the board will do it
once properly configured, I can safely say that I won't have to do much mucking
with the Intel DMA chip, so long as the conditions are met so the card can see
it.

		-Brian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703071444.JAA01671>