From 33d1e22230726a2176e72567a95bfceb6062a017 Mon Sep 17 00:00:00 2001 From: Seema Khowala Date: Wed, 28 Feb 2018 12:25:13 -0800 Subject: gpu: nvgpu: clean up memory leaks in gr init This is to resolve memory leak after modifying tpc_fs_mask sysfs which sets gr.sw_ready to false and forces gr to re-initialize. echo 1 > /sys/devices/gpu.0/force_idle echo 5 > /sys/devices/gpu.0/tpc_fs_mask echo 0 > /sys/devices/gpu.0/force_idle Bug 200393029 Change-Id: I76299f53fc87823071c672ec682c3eb51f72f513 Signed-off-by: Seema Khowala Reviewed-on: https://git-master.nvidia.com/r/1666018 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/ltc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/common/ltc.c') diff --git a/drivers/gpu/nvgpu/common/ltc.c b/drivers/gpu/nvgpu/common/ltc.c index 006e2ed2..024c2e49 100644 --- a/drivers/gpu/nvgpu/common/ltc.c +++ b/drivers/gpu/nvgpu/common/ltc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -22,6 +22,7 @@ #include #include +#include #include "gk20a/gk20a.h" #include "gk20a/gr_gk20a.h" @@ -54,6 +55,9 @@ int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size) struct gr_gk20a *gr = &g->gr; unsigned long flags = 0; + if (nvgpu_mem_is_valid(&gr->compbit_store.mem)) + return 0; + if (!nvgpu_iommuable(g)) flags = NVGPU_DMA_FORCE_CONTIGUOUS; -- cgit v1.2.2