From owner-freebsd-hackers Fri Mar 7 06:45:04 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id GAA16985 for hackers-outgoing; Fri, 7 Mar 1997 06:45:04 -0800 (PST) Received: from bmcgover-pc.cisco.com (bmcgover-pc.cisco.com [171.69.104.147]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id GAA16963 for ; Fri, 7 Mar 1997 06:45:00 -0800 (PST) Received: from bmcgover-pc.cisco.com (localhost.cisco.com [127.0.0.1]) by bmcgover-pc.cisco.com (8.8.5/8.8.2) with ESMTP id JAA01671 for ; Fri, 7 Mar 1997 09:44:22 -0500 (EST) Message-Id: <199703071444.JAA01671@bmcgover-pc.cisco.com> To: hackers@freebsd.org Subject: Memory/buffer questions... Date: Fri, 07 Mar 1997 09:44:22 -0500 From: Brian McGovern Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk *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