Date: Mon, 21 Jul 1997 15:21:06 -0700 (PDT) From: Vinay Bannai <vinay@agni.nuko.com> To: se@freebsd.org (Stefan Esser) Cc: freebsd-hackers@freebsd.org Subject: Re: Kernel panic in driver probe() routine Message-ID: <199707212221.PAA03602@agni.nuko.com> In-Reply-To: <19970722000635.41795@mi.uni-koeln.de> from "Stefan Esser" at "Jul 22, 97 00:06:35 am"
next in thread | previous in thread | raw e-mail | index | archive | help
According to Stefan Esser: > On Jul 21, Vinay Bannai <vinay@agni.nuko.com> wrote: > > Actually it was in my attach() routine. Here it is: > > I am freeing up my memory towards the end under the label fail > > Ahhh, yes, I see ... > > But you are freeing memory not obtained through a call to > malloc(), and that is generally considered a bad thing :) > > > if (!pci_map_mem(config_id, CYCLONE_PCI_MMRR_REG, > > (vm_offset_t *)&vaddr, (vm_offset_t *)&paddr)) { > > printf("cyclone%d: couldn't map memory\n", unit); > > goto fail; > > > fail: > > if (vaddr) > > free((void *)vaddr, M_DEVBUF); > > 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 :-) Vinay -- Vinay Bannai E-mail: vinay@agni.nuko.com (408)-526-0280 x 275 (Work) http://agni.nuko.com/~vinay
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707212221.PAA03602>