gpu: nvgpu: stop ELPG init thread during unload

ELPG initialization thread creation can fail when the process is killed.
That leads to driver resume failure.

That thread was stopped on suspend and re-created on resume. To avoid
the issue above, don't stop the ELPG thread in suspend and let the
first created thread handle the ELPG state transitions always.
And stop the ELPG thread during unload.

bug 3345977
bug 200685277

Change-Id: I8952edf8d1664ed258f238e265002e716d1bf5c2
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2573763
(cherry picked from commit f4571194b0)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2574436
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sagar Kamble
2021-08-11 14:54:22 +05:30
committed by mobile promotions
parent ce8548ec05
commit 5fb06d03ca
2 changed files with 9 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2017-2021, 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"),
@@ -130,6 +130,10 @@ static int nvgpu_init_task_pg_init(struct gk20a *g)
nvgpu_log_fn(g, " ");
if (nvgpu_thread_is_running(&pmu->pg_init.state_task)) {
return 0;
}
nvgpu_cond_init(&pmu->pg_init.wq);
snprintf(thread_name, sizeof(thread_name),
@@ -525,13 +529,13 @@ static int nvgpu_pg_init_task(void *arg)
case PMU_STATE_LOADING_ZBC:
nvgpu_pmu_dbg(g, "loaded zbc");
pmu_setup_hw_enable_elpg(g);
nvgpu_pmu_dbg(g, "PMU booted, thread exiting");
nvgpu_pmu_dbg(g, "PMU booted");
gk20a_gr_wait_initialized(g);
nvgpu_cg_elcg_enable_no_wait(g);
return 0;
break;
default:
nvgpu_pmu_dbg(g, "invalid state");
break;
@@ -560,8 +564,6 @@ int nvgpu_pmu_destroy(struct gk20a *g)
return 0;
}
nvgpu_kill_task_pg_init(g);
nvgpu_pmu_get_pg_stats(g,
PMU_PG_ELPG_ENGINE_ID_GRAPHICS, &pg_stat_data);

View File

@@ -1651,6 +1651,8 @@ static void nvgpu_remove_pmu_support(struct nvgpu_pmu *pmu)
nvgpu_dma_unmap_free(vm, &pmu->super_surface_buf);
nvgpu_kill_task_pg_init(g);
nvgpu_mutex_destroy(&pmu->elpg_mutex);
nvgpu_mutex_destroy(&pmu->pg_mutex);
nvgpu_mutex_destroy(&pmu->isr_mutex);