From 8f2cb85983c7cd0c913e6a06df16f929d58a10a9 Mon Sep 17 00:00:00 2001 From: Nitin Kumbhar Date: Thu, 31 May 2018 19:13:43 +0530 Subject: gpu: nvgpu: update ecc sysfs node handling Make ecc sysfs hash table per GPU by adding it as part of nvgpu_os_linux. Using a single hash table might give incorrect results as GPUs have same filenames and a filename is used as a key for a lookup. Add device_attribute as part of struct gk20a_ecc_stat. Using a single array of pointers of device attribute for an ecc_stat results in memory leak and incorrect stats if multiple GPUs are present on the system. This array of pointers will always hold info for GPU which created sysfs nodes last. Fix this by making device attribute array per ecc stat per GPU. Fix ecc stat removal to consider zero sub-units for a given number of hwunits. The multiplication with zero results in not removing any sysfs node at all. Bug 1987855 Change-Id: Ifcacc5623cede8decfe228c02d72786337cd0876 Signed-off-by: Nitin Kumbhar Reviewed-on: https://git-master.nvidia.com/r/1735989 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/ecc_gk20a.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/gpu/nvgpu/gk20a/ecc_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/ecc_gk20a.h b/drivers/gpu/nvgpu/gk20a/ecc_gk20a.h index af10f828..9c50a809 100644 --- a/drivers/gpu/nvgpu/gk20a/ecc_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/ecc_gk20a.h @@ -30,6 +30,7 @@ struct gk20a_ecc_stat { u32 count; #ifdef CONFIG_SYSFS struct hlist_node hash_node; + struct device_attribute *attr_array; #endif }; -- cgit v1.2.2