Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 1997 18:13:49 -0700
From:      David Greenman <dg@root.com>
To:        Vinay Bannai <vinay@agni.nuko.com>
Cc:        se@FreeBSD.ORG (Stefan Esser), freebsd-hackers@FreeBSD.ORG
Subject:   Re: Kernel panic in driver probe() routine 
Message-ID:  <199707220113.SAA08327@implode.root.com>
In-Reply-To: Your message of "Mon, 21 Jul 1997 15:21:06 PDT." <199707212221.PAA03602@agni.nuko.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
>> 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



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