From 0269339256dee0a8fcd2d6aa1180780039f22fab Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 12 Oct 2015 18:09:43 +0530 Subject: gpu: nvgpu: restart timer instead of cancel In gk20a_fifo_handle_sched_error(), we currently cancel the timeout on all the channels But this could cause us to miss one of stuck channel hence, instead of cancelling, restart the timeout of channel on which it is already active Bug 200133289 Change-Id: I40e7e0e5394911fc110ab6fde39592b885dfaf7d Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/816133 Reviewed-by: Ishan Mittal Tested-by: Ishan Mittal --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 17 +++++++++++++++-- drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 2 +- drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 6f0d7375..34b62ac4 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -1574,7 +1574,7 @@ static void gk20a_channel_timeout_stop(struct channel_gk20a *ch) mutex_unlock(&ch->timeout.lock); } -void gk20a_channel_timeout_stop_all_channels(struct gk20a *g) +void gk20a_channel_timeout_restart_all_channels(struct gk20a *g) { u32 chid; struct fifo_gk20a *f = &g->fifo; @@ -1583,7 +1583,20 @@ void gk20a_channel_timeout_stop_all_channels(struct gk20a *g) struct channel_gk20a *ch = &f->channel[chid]; if (gk20a_channel_get(ch)) { - gk20a_channel_timeout_stop(ch); + mutex_lock(&ch->timeout.lock); + if (!ch->timeout.initialized) { + mutex_unlock(&ch->timeout.lock); + gk20a_channel_put(ch); + continue; + } + mutex_unlock(&ch->timeout.lock); + + cancel_delayed_work_sync(&ch->timeout.wq); + if (!ch->has_timedout) + schedule_delayed_work(&ch->timeout.wq, + msecs_to_jiffies( + gk20a_get_channel_watchdog_timeout(ch))); + gk20a_channel_put(ch); } } diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index 280c50b1..3e18e053 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h @@ -256,5 +256,5 @@ void channel_gk20a_free_inst(struct gk20a *g, struct channel_gk20a *ch); int channel_gk20a_setup_ramfc(struct channel_gk20a *c, u64 gpfifo_base, u32 gpfifo_entries, u32 flags); void channel_gk20a_enable(struct channel_gk20a *ch); -void gk20a_channel_timeout_stop_all_channels(struct gk20a *g); +void gk20a_channel_timeout_restart_all_channels(struct gk20a *g); #endif /* CHANNEL_GK20A_H */ diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index ad7162fc..a035cd87 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -1450,7 +1450,7 @@ static bool gk20a_fifo_handle_sched_error(struct gk20a *g) struct channel_gk20a *ch = &f->channel[id]; if (is_tsg) { - gk20a_channel_timeout_stop_all_channels(g); + gk20a_channel_timeout_restart_all_channels(g); gk20a_fifo_recover(g, BIT(engine_id), id, true, true, true); ret = true; @@ -1472,7 +1472,7 @@ static bool gk20a_fifo_handle_sched_error(struct gk20a *g) * Cancel all channels' timeout since SCHED error might * trigger multiple watchdogs at a time */ - gk20a_channel_timeout_stop_all_channels(g); + gk20a_channel_timeout_restart_all_channels(g); gk20a_fifo_recover(g, BIT(engine_id), id, false, true, ch->timeout_debug_dump); ret = true; -- cgit v1.2.2