diff options
author | Kirill Artamonov <kartamonov@nvidia.com> | 2014-05-16 18:09:07 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:09:23 -0400 |
commit | 9cbddec84d375eabf392a10fade0718bf5f0ea60 (patch) | |
tree | 63bc31e9f49fe8daca60adbe74d22af857eb2de2 | |
parent | 88ca9b50f6a1f62986dad4c72f023a5f757b967f (diff) |
gpu: nvgpu: fix pte memory leak
Force cleanup of all GMMU PTEs when releasing vm.
bug 1514178
Signed-off-by: Kirill Artamonov <kartamonov@nvidia.com>
Change-Id: Ice1ff837ca4decbdec2d4a78ea5eb64bfeefc0db
Reviewed-on: http://git-master/r/411198
(cherry picked from commit e14ee5646554fd6cd812f4e7edf220c40116d722)
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/411895
Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
Tested-by: Ishwarya Balaji Gururajan <igururajan@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 1d6cdb53..9de589f9 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -2013,6 +2013,7 @@ static void gk20a_vm_remove_support(struct vm_gk20a *vm) | |||
2013 | struct mapped_buffer_node *mapped_buffer; | 2013 | struct mapped_buffer_node *mapped_buffer; |
2014 | struct vm_reserved_va_node *va_node, *va_node_tmp; | 2014 | struct vm_reserved_va_node *va_node, *va_node_tmp; |
2015 | struct rb_node *node; | 2015 | struct rb_node *node; |
2016 | int i; | ||
2016 | 2017 | ||
2017 | gk20a_dbg_fn(""); | 2018 | gk20a_dbg_fn(""); |
2018 | mutex_lock(&vm->update_gmmu_lock); | 2019 | mutex_lock(&vm->update_gmmu_lock); |
@@ -2035,8 +2036,25 @@ static void gk20a_vm_remove_support(struct vm_gk20a *vm) | |||
2035 | kfree(va_node); | 2036 | kfree(va_node); |
2036 | } | 2037 | } |
2037 | 2038 | ||
2038 | /* TBD: unmapping all buffers above may not actually free | 2039 | /* unmapping all buffers above may not actually free |
2039 | * all vm ptes. jettison them here for certain... */ | 2040 | * all vm ptes. jettison them here for certain... */ |
2041 | for (i = 0; i < vm->pdes.num_pdes; i++) { | ||
2042 | struct page_table_gk20a *pte = | ||
2043 | &vm->pdes.ptes[gmmu_page_size_small][i]; | ||
2044 | if (pte->ref) { | ||
2045 | free_gmmu_pages(vm, pte->ref, pte->sgt, | ||
2046 | vm->mm->page_table_sizing[gmmu_page_size_small].order, | ||
2047 | pte->size); | ||
2048 | pte->ref = NULL; | ||
2049 | } | ||
2050 | pte = &vm->pdes.ptes[gmmu_page_size_big][i]; | ||
2051 | if (pte->ref) { | ||
2052 | free_gmmu_pages(vm, pte->ref, pte->sgt, | ||
2053 | vm->mm->page_table_sizing[gmmu_page_size_big].order, | ||
2054 | pte->size); | ||
2055 | pte->ref = NULL; | ||
2056 | } | ||
2057 | } | ||
2040 | 2058 | ||
2041 | unmap_gmmu_pages(vm->pdes.ref, vm->pdes.sgt, vm->pdes.kv); | 2059 | unmap_gmmu_pages(vm->pdes.ref, vm->pdes.sgt, vm->pdes.kv); |
2042 | free_gmmu_pages(vm, vm->pdes.ref, vm->pdes.sgt, 0, vm->pdes.size); | 2060 | free_gmmu_pages(vm, vm->pdes.ref, vm->pdes.sgt, 0, vm->pdes.size); |