mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 11:04:51 +03:00
gpu: nvgpu: skip destroy if vidmem not initialized
The vidmem shall be destroyed only if it has been initialized. If not skipped, it accesses mutexes which are in invalid state. This results in BUG like: BUG: spinlock bad magic on CPU#0, rmmod/1560 Also, destroy vidmem bootstrap allocator which is set up in nvgpu_vidmem_init(). Bug 1987855 Change-Id: I68e91422a54b40feeb9071158b797828e2391303 Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1730535 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Tejal Kudav
parent
d84e822128
commit
f9da1781f6
@@ -39,6 +39,14 @@
|
||||
void nvgpu_vidmem_destroy(struct gk20a *g)
|
||||
{
|
||||
struct nvgpu_timeout timeout;
|
||||
size_t size;
|
||||
|
||||
size = g->ops.mm.get_vidmem_size ?
|
||||
g->ops.mm.get_vidmem_size(g) : 0;
|
||||
|
||||
/* Nothing to destroy if no vidmem */
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
nvgpu_timeout_init(g, &timeout, 100, NVGPU_TIMER_RETRY_TIMER);
|
||||
|
||||
@@ -73,6 +81,9 @@ void nvgpu_vidmem_destroy(struct gk20a *g)
|
||||
|
||||
if (nvgpu_alloc_initialized(&g->mm.vidmem.allocator))
|
||||
nvgpu_alloc_destroy(&g->mm.vidmem.allocator);
|
||||
|
||||
if (nvgpu_alloc_initialized(&g->mm.vidmem.bootstrap_allocator))
|
||||
nvgpu_alloc_destroy(&g->mm.vidmem.bootstrap_allocator);
|
||||
}
|
||||
|
||||
static int __nvgpu_vidmem_do_clear_all(struct gk20a *g)
|
||||
@@ -297,15 +308,16 @@ static int nvgpu_vidmem_clear_pending_allocs_thr(void *mm_ptr)
|
||||
int nvgpu_vidmem_init(struct mm_gk20a *mm)
|
||||
{
|
||||
struct gk20a *g = mm->g;
|
||||
size_t size = g->ops.mm.get_vidmem_size ?
|
||||
g->ops.mm.get_vidmem_size(g) : 0;
|
||||
u64 bootstrap_base, bootstrap_size, base;
|
||||
u64 default_page_size = SZ_64K;
|
||||
size_t size;
|
||||
int err;
|
||||
|
||||
static struct nvgpu_alloc_carveout wpr_co =
|
||||
NVGPU_CARVEOUT("wpr-region", 0, SZ_16M);
|
||||
|
||||
size = g->ops.mm.get_vidmem_size ?
|
||||
g->ops.mm.get_vidmem_size(g) : 0;
|
||||
if (!size)
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user