From 4654d9abd176043e69d548d53d516e78e4054d9e Mon Sep 17 00:00:00 2001 From: Seema Khowala Date: Fri, 4 May 2018 10:29:14 -0700 Subject: gpu: nvgpu: runlist_lock released before preempt timeout recovery Release runlist_lock and then initiate recovery if preempt timed out. Also do not issue preempt if ch, tsg or runlist id is invalid. tsgid could be invalid for below call trace gk20a_prepare_poweroff->gk20a_channel_suspend-> *_fifo_preempt_channel->*_fifo_preempt_tsg Bug 2065990 Bug 2043838 Change-Id: Ia1e3c134f06743e1258254a4a6f7256831706185 Signed-off-by: Seema Khowala Reviewed-on: https://git-master.nvidia.com/r/1662656 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gv11b/fifo_gv11b.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/gv11b/fifo_gv11b.c') diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c index 9843c7de..30e03092 100644 --- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c @@ -757,6 +757,9 @@ int gv11b_fifo_preempt_channel(struct gk20a *g, u32 chid) struct fifo_gk20a *f = &g->fifo; u32 tsgid; + if (chid == FIFO_INVAL_CHANNEL_ID) + return 0; + tsgid = f->channel[chid].tsgid; nvgpu_log_info(g, "chid:%d tsgid:%d", chid, tsgid); @@ -813,10 +816,14 @@ int gv11b_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) u32 mutex_ret = 0; u32 runlist_id; - nvgpu_log_fn(g, "%d", tsgid); + nvgpu_log_fn(g, "tsgid: %d", tsgid); + if (tsgid == FIFO_INVAL_TSG_ID) + return 0; runlist_id = f->tsg[tsgid].runlist_id; - nvgpu_log_fn(g, "runlist_id %d", runlist_id); + nvgpu_log_fn(g, "runlist_id: %d", runlist_id); + if (runlist_id == FIFO_INVAL_RUNLIST_ID) + return 0; nvgpu_mutex_acquire(&f->runlist_info[runlist_id].runlist_lock); @@ -829,6 +836,9 @@ int gv11b_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) nvgpu_mutex_release(&f->runlist_info[runlist_id].runlist_lock); + if (ret) + gk20a_fifo_preempt_timeout_rc(g, tsgid, true); + return ret; } @@ -888,7 +898,7 @@ static int __locked_fifo_preempt_ch_tsg(struct gk20a *g, u32 id, timeout_rc_type); if (ret && (timeout_rc_type == PREEMPT_TIMEOUT_RC)) - __locked_fifo_preempt_timeout_rc(g, id, id_type); + gk20a_fifo_preempt_timeout_rc(g, id, id_type); return ret; } -- cgit v1.2.2