NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: kern/56826: Kernel memory leak with Nvidia GPU



with Taylor's new kmem probes and a little investigation i've
narrowed down at least two leaks i believe.

nvkm_mem_new_host() has two paths that allocate "struct nvkm_mem
*mem":  one that copies a dmamap from the caller via ioctl-like
arguments, or, one that creates one freshly.  both of them are
setup to use the same dtor via nvkm_mem_dma.dtor, set to
nvkm_mem_dtor() which only does something if "mem->mem" is non
NULL.  however, only the second path sets "mem->mem", so this
dtor call does not free the allocation, and we leak it.

a simple hack to free is triggering crashes so it's not quite as
simple as it may appear here.

the second leak appears to be the second path, which does a whole
bus_dma setup phase:  bus_dmamem_alloc(), bus_dmamap_create(),
bus_dmamap_load_raw().  however, there's no bus_dmamap_destroy()
that isn't in this setup error path, so, allocations created here
are also leaking i believe (i haven't confirmed this yet.)

for the second one, i'm wondering why we'd be doing create and
destroy so frequently -- shouldn't set up a busdma in device
init, and then using it, and destroy in device tear down?


.mrg.


Home | Main Index | Thread Index | Old Index