diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2014-10-22 10:33:36 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:12:05 -0400 |
commit | 97e6847cb1f52fc59701dcc4d9e53caf3faacb64 (patch) | |
tree | e7900f9001a733669c06a4f79fa708165d6ce6bc | |
parent | e4654ebb01c49d91b7cad89a9fd30d21457eeb23 (diff) |
gpu: nvgpu: don't kfree vm's inside other structs
Trying to kfree pmu.vm or bar1.vm is not allowed, since they are not
directly allocated. Separate the vm kfree from the actual vm support
removal, so that they can be done individually.
Change-Id: I7628f546b94e0de909371ce315e4cb065e5ef953
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/592112
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 0e005f7c..8f2d4079 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -116,6 +116,8 @@ struct gk20a_dmabuf_priv { | |||
116 | struct list_head states; | 116 | struct list_head states; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | static void gk20a_vm_remove_support_nofree(struct vm_gk20a *vm); | ||
120 | |||
119 | static void gk20a_mm_delete_priv(void *_priv) | 121 | static void gk20a_mm_delete_priv(void *_priv) |
120 | { | 122 | { |
121 | struct gk20a_buffer_state *s, *s_tmp; | 123 | struct gk20a_buffer_state *s, *s_tmp; |
@@ -278,7 +280,7 @@ static void gk20a_remove_mm_support(struct mm_gk20a *mm) | |||
278 | inst_block->cpuva = NULL; | 280 | inst_block->cpuva = NULL; |
279 | inst_block->iova = 0; | 281 | inst_block->iova = 0; |
280 | 282 | ||
281 | gk20a_vm_remove_support(vm); | 283 | gk20a_vm_remove_support_nofree(vm); |
282 | } | 284 | } |
283 | 285 | ||
284 | int gk20a_init_mm_setup_sw(struct gk20a *g) | 286 | int gk20a_init_mm_setup_sw(struct gk20a *g) |
@@ -2076,7 +2078,7 @@ void gk20a_vm_unmap(struct vm_gk20a *vm, u64 offset) | |||
2076 | mutex_unlock(&vm->update_gmmu_lock); | 2078 | mutex_unlock(&vm->update_gmmu_lock); |
2077 | } | 2079 | } |
2078 | 2080 | ||
2079 | void gk20a_vm_remove_support(struct vm_gk20a *vm) | 2081 | static void gk20a_vm_remove_support_nofree(struct vm_gk20a *vm) |
2080 | { | 2082 | { |
2081 | struct gk20a *g = vm->mm->g; | 2083 | struct gk20a *g = vm->mm->g; |
2082 | struct mapped_buffer_node *mapped_buffer; | 2084 | struct mapped_buffer_node *mapped_buffer; |
@@ -2140,7 +2142,11 @@ void gk20a_vm_remove_support(struct vm_gk20a *vm) | |||
2140 | if (vm->zero_page_cpuva) | 2142 | if (vm->zero_page_cpuva) |
2141 | dma_free_coherent(&g->dev->dev, vm->big_page_size, | 2143 | dma_free_coherent(&g->dev->dev, vm->big_page_size, |
2142 | vm->zero_page_cpuva, vm->zero_page_iova); | 2144 | vm->zero_page_cpuva, vm->zero_page_iova); |
2145 | } | ||
2143 | 2146 | ||
2147 | void gk20a_vm_remove_support(struct vm_gk20a *vm) | ||
2148 | { | ||
2149 | gk20a_vm_remove_support_nofree(vm); | ||
2144 | /* vm is not used anymore. release it. */ | 2150 | /* vm is not used anymore. release it. */ |
2145 | kfree(vm); | 2151 | kfree(vm); |
2146 | } | 2152 | } |