summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/pmu/pmu.c
diff options
context:
space:
mode:
authorDeepak Goyal <dgoyal@nvidia.com>2017-10-23 02:16:09 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-25 07:23:57 -0400
commitc61e21c868246faf7a9ffc812590941fc362af17 (patch)
treecacc1639bcdc48766047dc65a715c67c51682612 /drivers/gpu/nvgpu/common/pmu/pmu.c
parent539c8bff4b501a4ca999290454a210f5d17ba516 (diff)
gpu: nvgpu: Fix race in PMU state transitions.
PMU response(intr callback for messages) can run faster than the kthread posting commands to PMU. This causes the PMU message callback to skip important pmu state change(which happens just after the PMU command is posted). Solution: State change should be triggered from only inside the intr callback. Other places can only update the pmu_state variable. This change also adds error check to print in case command post fails. JIRA GPUT19X-20 Change-Id: Ib0a4275440455342a898c93ea9d86c5822e039a7 Signed-off-by: Deepak Goyal <dgoyal@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1583577 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/pmu/pmu.c')
-rw-r--r--drivers/gpu/nvgpu/common/pmu/pmu.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/pmu/pmu.c b/drivers/gpu/nvgpu/common/pmu/pmu.c
index 95b57e22..3447f40d 100644
--- a/drivers/gpu/nvgpu/common/pmu/pmu.c
+++ b/drivers/gpu/nvgpu/common/pmu/pmu.c
@@ -367,7 +367,7 @@ static void pmu_setup_hw_enable_elpg(struct gk20a *g)
367 nvgpu_log_fn(g, " "); 367 nvgpu_log_fn(g, " ");
368 368
369 pmu->initialized = true; 369 pmu->initialized = true;
370 nvgpu_pmu_state_change(g, PMU_STATE_STARTED, true); 370 nvgpu_pmu_state_change(g, PMU_STATE_STARTED, false);
371 371
372 if (nvgpu_is_enabled(g, NVGPU_PMU_ZBC_SAVE)) { 372 if (nvgpu_is_enabled(g, NVGPU_PMU_ZBC_SAVE)) {
373 /* Save zbc table after PMU is initialized. */ 373 /* Save zbc table after PMU is initialized. */
@@ -448,8 +448,6 @@ static int nvgpu_pg_init_task(void *arg)
448 case PMU_STATE_LOADING_ZBC: 448 case PMU_STATE_LOADING_ZBC:
449 nvgpu_pmu_dbg(g, "loaded zbc"); 449 nvgpu_pmu_dbg(g, "loaded zbc");
450 pmu_setup_hw_enable_elpg(g); 450 pmu_setup_hw_enable_elpg(g);
451 break;
452 case PMU_STATE_STARTED:
453 nvgpu_pmu_dbg(g, "PMU booted, thread exiting"); 451 nvgpu_pmu_dbg(g, "PMU booted, thread exiting");
454 return 0; 452 return 0;
455 default: 453 default: