From owner-freebsd-hackers Mon Jul 21 18:11:39 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id SAA24641 for hackers-outgoing; Mon, 21 Jul 1997 18:11:39 -0700 (PDT) Received: from implode.root.com (implode.root.com [198.145.90.17]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id SAA24633; Mon, 21 Jul 1997 18:11:30 -0700 (PDT) Received: from implode.root.com (localhost [127.0.0.1]) by implode.root.com (8.8.5/8.8.5) with ESMTP id SAA08327; Mon, 21 Jul 1997 18:13:50 -0700 (PDT) Message-Id: <199707220113.SAA08327@implode.root.com> To: Vinay Bannai cc: se@FreeBSD.ORG (Stefan Esser), freebsd-hackers@FreeBSD.ORG Subject: Re: Kernel panic in driver probe() routine In-reply-to: Your message of "Mon, 21 Jul 1997 15:21:06 PDT." <199707212221.PAA03602@agni.nuko.com> From: David Greenman Reply-To: dg@root.com Date: Mon, 21 Jul 1997 18:13:49 -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> Here vmaddr did not point to a memory region allocated by >> malloc, but to one that got a virtual to physical mapping >> established by a call to pmap_mapdev (/sys/i386/i386/pmap.c). > >STefan, > >You are correct. I just looked at the code for pmap.c and it in turn calls >kern_alloc_pageable(). I don't exaclty understand all the stuff about maps >and submaps, but seems like the virtual memory is not coming from the >place where malloc() gets it!! ... >> You may want to ask David Greenman about how to release >> such a mapping. I didn't bother, since the page table entry >> created for the device consumes only 4 bytes per 4KB page >> you allocated, and the code to free the page table entries >> is likely to be much larger, except for large regions ... >> >> Regards, STefan > >Yup. I will just ignore it for the time being and bother DG later on when >I start running into DMA problems. :-) > >The PCI device that I am interfacing is capable of doing lot more things >(since it has got a i960 processor wiht 4M of RAM). But initially I want >to test by passing back and forth to the card some packets of fixed >size. Are there any guidelines as to how much memory I should allocate for >the Rx and Tx buffers? I am bad at picking numbers :-) You can free it by calling kmem_free(kernel_map, addr, size). This will remove the mapping and return the virtual address space back to the kernel. As Stefan said, for small allocations it isn't worth the trouble, but it is for large allocations. This is a little different from malloced memory where real (physical) memory is consumed and it is always desired to free it when it will no longer be used. -DG David Greenman Core-team/Principal Architect, The FreeBSD Project