mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: ecc: improve CCM for nvgpu_ecc_free
This reduces the code complexity for nvgpu_ecc_free() by creating a helper function free_ecc_stat_count_array(). The TCC metric is reduced from 27 to 5. JIRA NVGPU-4094 Change-Id: I80c85fe56d253616817682278f4bef241c346d57 Signed-off-by: Philip Elcan <pelcan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2206518 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
16a07a66ec
commit
ef2d30328f
@@ -210,6 +210,21 @@ int nvgpu_ecc_counter_init_per_fbpa(struct gk20a *g,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* helper function that frees the count array if non-NULL. */
|
||||
static void free_ecc_stat_count_array(struct gk20a *g,
|
||||
struct nvgpu_ecc_stat **stat,
|
||||
u32 gpc_count)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
if (stat != NULL) {
|
||||
for (i = 0; i < gpc_count; i++) {
|
||||
nvgpu_kfree(g, stat[i]);
|
||||
}
|
||||
nvgpu_kfree(g, stat);
|
||||
}
|
||||
}
|
||||
|
||||
/* release all ecc_stat */
|
||||
void nvgpu_ecc_free(struct gk20a *g)
|
||||
{
|
||||
@@ -224,112 +239,51 @@ void nvgpu_ecc_free(struct gk20a *g)
|
||||
|
||||
gpc_count = nvgpu_gr_config_get_gpc_count(gr_config);
|
||||
|
||||
for (i = 0; i < gpc_count; i++) {
|
||||
if (ecc->gr.sm_lrf_ecc_single_err_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_lrf_ecc_single_err_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_lrf_ecc_double_err_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_lrf_ecc_double_err_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_shm_ecc_sec_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_shm_ecc_sec_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_shm_ecc_sed_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_shm_ecc_sed_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_shm_ecc_ded_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_shm_ecc_ded_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.tex_ecc_total_sec_pipe0_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.tex_ecc_total_sec_pipe0_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.tex_ecc_total_ded_pipe0_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.tex_ecc_total_ded_pipe0_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.tex_unique_ecc_sec_pipe0_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.tex_unique_ecc_sec_pipe0_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.tex_unique_ecc_ded_pipe0_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.tex_unique_ecc_ded_pipe0_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.tex_ecc_total_sec_pipe1_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.tex_ecc_total_sec_pipe1_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.tex_ecc_total_ded_pipe1_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.tex_ecc_total_ded_pipe1_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.tex_unique_ecc_sec_pipe1_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.tex_unique_ecc_sec_pipe1_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.tex_unique_ecc_ded_pipe1_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.tex_unique_ecc_ded_pipe1_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_l1_tag_ecc_corrected_err_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_l1_tag_ecc_corrected_err_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_l1_tag_ecc_uncorrected_err_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_l1_tag_ecc_uncorrected_err_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_cbu_ecc_corrected_err_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_cbu_ecc_corrected_err_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_cbu_ecc_uncorrected_err_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_cbu_ecc_uncorrected_err_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_l1_data_ecc_corrected_err_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_l1_data_ecc_corrected_err_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_l1_data_ecc_uncorrected_err_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_l1_data_ecc_uncorrected_err_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_icache_ecc_corrected_err_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_icache_ecc_corrected_err_count[i]);
|
||||
}
|
||||
|
||||
if (ecc->gr.sm_icache_ecc_uncorrected_err_count != NULL) {
|
||||
nvgpu_kfree(g, ecc->gr.sm_icache_ecc_uncorrected_err_count[i]);
|
||||
}
|
||||
}
|
||||
nvgpu_kfree(g, ecc->gr.sm_lrf_ecc_single_err_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_lrf_ecc_double_err_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_shm_ecc_sec_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_shm_ecc_sed_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_shm_ecc_ded_count);
|
||||
nvgpu_kfree(g, ecc->gr.tex_ecc_total_sec_pipe0_count);
|
||||
nvgpu_kfree(g, ecc->gr.tex_ecc_total_ded_pipe0_count);
|
||||
nvgpu_kfree(g, ecc->gr.tex_unique_ecc_sec_pipe0_count);
|
||||
nvgpu_kfree(g, ecc->gr.tex_unique_ecc_ded_pipe0_count);
|
||||
nvgpu_kfree(g, ecc->gr.tex_ecc_total_sec_pipe1_count);
|
||||
nvgpu_kfree(g, ecc->gr.tex_ecc_total_ded_pipe1_count);
|
||||
nvgpu_kfree(g, ecc->gr.tex_unique_ecc_sec_pipe1_count);
|
||||
nvgpu_kfree(g, ecc->gr.tex_unique_ecc_ded_pipe1_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_l1_tag_ecc_corrected_err_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_l1_tag_ecc_uncorrected_err_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_cbu_ecc_corrected_err_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_cbu_ecc_uncorrected_err_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_l1_data_ecc_corrected_err_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_l1_data_ecc_uncorrected_err_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_icache_ecc_corrected_err_count);
|
||||
nvgpu_kfree(g, ecc->gr.sm_icache_ecc_uncorrected_err_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.sm_lrf_ecc_single_err_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.sm_lrf_ecc_double_err_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.sm_shm_ecc_sec_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.sm_shm_ecc_sed_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.sm_shm_ecc_ded_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.tex_ecc_total_sec_pipe0_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.tex_ecc_total_ded_pipe0_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.tex_unique_ecc_sec_pipe0_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.tex_unique_ecc_ded_pipe0_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.tex_ecc_total_sec_pipe1_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.tex_ecc_total_ded_pipe1_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.tex_unique_ecc_sec_pipe1_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.tex_unique_ecc_ded_pipe1_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.sm_l1_tag_ecc_corrected_err_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g,
|
||||
ecc->gr.sm_l1_tag_ecc_uncorrected_err_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.sm_cbu_ecc_corrected_err_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.sm_cbu_ecc_uncorrected_err_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.sm_l1_data_ecc_corrected_err_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g,
|
||||
ecc->gr.sm_l1_data_ecc_uncorrected_err_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g, ecc->gr.sm_icache_ecc_corrected_err_count,
|
||||
gpc_count);
|
||||
free_ecc_stat_count_array(g,
|
||||
ecc->gr.sm_icache_ecc_uncorrected_err_count,
|
||||
gpc_count);
|
||||
|
||||
nvgpu_kfree(g, ecc->gr.gcc_l15_ecc_corrected_err_count);
|
||||
nvgpu_kfree(g, ecc->gr.gcc_l15_ecc_uncorrected_err_count);
|
||||
|
||||
Reference in New Issue
Block a user