gpu: nvgpu: guard ecc sysfs remove with NVGPU_DISABLE_ECC_STATS

Following error is seen on unloading nvgpu on platforms with
NVGPU_DISABLE_ECC_STATS set to true.

[ 3712.384639] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 3712.388479] pc : sysfs_remove_file_ns+0x28/0x50
[ 3712.389119] lr : sysfs_remove_file_ns+0x28/0x50
...
[ 3712.400640]  sysfs_remove_file_ns+0x28/0x50
[ 3712.401280]  device_remove_file+0x34/0x50
[ 3712.414720]  nvgpu_ecc_sysfs_remove+0x74/0xc0 [nvgpu]
[ 3712.428800]  nvgpu_ecc_remove_support+0x38/0x80 [nvgpu]
[ 3712.442240]  nvgpu_put+0xb8/0x160 [nvgpu]
[ 3712.456319]  nvgpu_pci_remove+0x168/0x250 [nvgpu]
[ 3712.456959]  pci_device_remove+0x4c/0x100

This is happening as ecc sysfs files are not created, however
their removal is attempted. Add NVGPU_DISABLE_ECC_STATS check
for ecc sysfs removal.

Bug 3495440

Change-Id: I9726cf43a740c2b591ca39bdc572e8f4ff5684d3
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2891876
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-by: Martin Radev <mradev@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Sagar Kamble
2023-04-21 01:18:49 +00:00
committed by mobile promotions
parent b54cb9fd97
commit 4ee71f9852

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -162,7 +162,9 @@ void nvgpu_ecc_remove_support(struct gk20a *g)
} }
#ifdef CONFIG_NVGPU_SYSFS #ifdef CONFIG_NVGPU_SYSFS
if (!nvgpu_is_enabled(g, NVGPU_DISABLE_ECC_STATS)) {
nvgpu_ecc_sysfs_remove(g); nvgpu_ecc_sysfs_remove(g);
}
#endif #endif
nvgpu_ecc_free(g); nvgpu_ecc_free(g);