mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: get VM reference for TSG
We store a reference to common address space of channels in struct tsg_gk20a without increasing the refcount This could result in freeing the address space even when some channel in TSG needs it or when we need to free common gr_ctx Fix this by getting ref using gk20a_vm_get() when we store the VM reference. We drop this reference with gk20a_vm_put() when closing the TSG Bug 1470692 Change-Id: Ifc1f29d32cd721810bfbb5a4db96095770318c17 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/495668 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
Dan Willemsen
parent
b81e9a2431
commit
8095b3cf9c
@@ -2830,10 +2830,13 @@ int gk20a_alloc_obj_ctx(struct channel_gk20a *c,
|
||||
} else {
|
||||
if (!tsg->tsg_gr_ctx) {
|
||||
tsg->vm = c->vm;
|
||||
gk20a_vm_get(tsg->vm);
|
||||
err = gr_gk20a_alloc_tsg_gr_ctx(g, tsg);
|
||||
if (err) {
|
||||
gk20a_err(dev_from_gk20a(g),
|
||||
"fail to allocate TSG gr ctx buffer");
|
||||
gk20a_vm_put(tsg->vm);
|
||||
tsg->vm = NULL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,8 +161,10 @@ static void gk20a_tsg_release(struct kref *ref)
|
||||
gr_gk20a_free_tsg_gr_ctx(tsg);
|
||||
tsg->tsg_gr_ctx = NULL;
|
||||
}
|
||||
if (tsg->vm)
|
||||
if (tsg->vm) {
|
||||
gk20a_vm_put(tsg->vm);
|
||||
tsg->vm = NULL;
|
||||
}
|
||||
|
||||
release_used_tsg(&g->fifo, tsg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user