From c61e21c868246faf7a9ffc812590941fc362af17 Mon Sep 17 00:00:00 2001 From: Deepak Goyal Date: Mon, 23 Oct 2017 11:46:09 +0530 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1583577 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/pmu/pmu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/common/pmu/pmu.c') 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) nvgpu_log_fn(g, " "); pmu->initialized = true; - nvgpu_pmu_state_change(g, PMU_STATE_STARTED, true); + nvgpu_pmu_state_change(g, PMU_STATE_STARTED, false); if (nvgpu_is_enabled(g, NVGPU_PMU_ZBC_SAVE)) { /* Save zbc table after PMU is initialized. */ @@ -448,8 +448,6 @@ 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); - break; - case PMU_STATE_STARTED: nvgpu_pmu_dbg(g, "PMU booted, thread exiting"); return 0; default: -- cgit v1.2.2