From 2ca20e14ba1358b1ca32329bfb16a98de631642e Mon Sep 17 00:00:00 2001 From: Leonid Moiseichuk Date: Fri, 29 Jan 2016 13:00:11 +0200 Subject: gpu: nvgpu: cs_data should not be forgotten During poweron/off sequence cyclestats should not remove cs_data and produce leak. Bug 200144583 Change-Id: Ibe1ea7d41d5ba9f79a46ead788a84bed29f37ec6 Signed-off-by: Leonid Moiseichuk Reviewed-on: http://git-master/r/999983 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom Reviewed-on: http://git-master/r/1001882 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Seshendra Gadagottu Tested-by: Seshendra Gadagottu --- drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c | 3 ++- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c index 34910152..3fb003bf 100644 --- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c @@ -1,7 +1,7 @@ /* * GK20A Cycle stats snapshots support (subsystem for gr_gk20a). * - * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -757,4 +757,5 @@ void gr_gk20a_free_cyclestats_snapshot_data(struct gk20a *g) mutex_lock(&gr->cs_lock); css_gr_free_shared_data(gr); mutex_unlock(&gr->cs_lock); + mutex_destroy(&gr->cs_lock); } diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 542a6c02..dbaa520d 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -4441,6 +4441,10 @@ static int gk20a_init_gr_setup_sw(struct gk20a *g) mutex_init(&gr->ctx_mutex); spin_lock_init(&gr->ch_tlb_lock); +#if defined(CONFIG_GK20A_CYCLE_STATS) + mutex_init(&g->gr.cs_lock); +#endif + gr->remove_support = gk20a_remove_gr_support; gr->sw_ready = true; @@ -4507,11 +4511,6 @@ int gk20a_init_gr_support(struct gk20a *g) gk20a_dbg_fn(""); -#if defined(CONFIG_GK20A_CYCLE_STATS) - mutex_init(&g->gr.cs_lock); - g->gr.cs_data = NULL; -#endif - /* this is required before gr_gk20a_init_ctx_state */ mutex_init(&g->gr.fecs_mutex); -- cgit v1.2.2