mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
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>
This commit is contained in:
committed by
Dan Willemsen
parent
e4654ebb01
commit
97e6847cb1
@@ -116,6 +116,8 @@ struct gk20a_dmabuf_priv {
|
||||
struct list_head states;
|
||||
};
|
||||
|
||||
static void gk20a_vm_remove_support_nofree(struct vm_gk20a *vm);
|
||||
|
||||
static void gk20a_mm_delete_priv(void *_priv)
|
||||
{
|
||||
struct gk20a_buffer_state *s, *s_tmp;
|
||||
@@ -278,7 +280,7 @@ static void gk20a_remove_mm_support(struct mm_gk20a *mm)
|
||||
inst_block->cpuva = NULL;
|
||||
inst_block->iova = 0;
|
||||
|
||||
gk20a_vm_remove_support(vm);
|
||||
gk20a_vm_remove_support_nofree(vm);
|
||||
}
|
||||
|
||||
int gk20a_init_mm_setup_sw(struct gk20a *g)
|
||||
@@ -2076,7 +2078,7 @@ void gk20a_vm_unmap(struct vm_gk20a *vm, u64 offset)
|
||||
mutex_unlock(&vm->update_gmmu_lock);
|
||||
}
|
||||
|
||||
void gk20a_vm_remove_support(struct vm_gk20a *vm)
|
||||
static void gk20a_vm_remove_support_nofree(struct vm_gk20a *vm)
|
||||
{
|
||||
struct gk20a *g = vm->mm->g;
|
||||
struct mapped_buffer_node *mapped_buffer;
|
||||
@@ -2140,7 +2142,11 @@ void gk20a_vm_remove_support(struct vm_gk20a *vm)
|
||||
if (vm->zero_page_cpuva)
|
||||
dma_free_coherent(&g->dev->dev, vm->big_page_size,
|
||||
vm->zero_page_cpuva, vm->zero_page_iova);
|
||||
}
|
||||
|
||||
void gk20a_vm_remove_support(struct vm_gk20a *vm)
|
||||
{
|
||||
gk20a_vm_remove_support_nofree(vm);
|
||||
/* vm is not used anymore. release it. */
|
||||
kfree(vm);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user