From ae3ba04955966f371447dfa96d05564418882021 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 30 Jul 2014 19:50:22 +0530 Subject: gpu: nvgpu: verify runnable channel count in TSG In runlist we first write channel count in TSG entry and then follow those many channel entries If no. of channel entries does not match to count then it is considered as error To detect this, add a counter while adding channel entries and give warning if channel count does not match with this counter bug 1470692 Change-Id: I4bbfd9b696fbfafa25dffb27979373f057a7f35a Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/449228 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 2089482a..73de3607 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -1701,6 +1701,7 @@ static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, struct channel_gk20a *ch = NULL; struct tsg_gk20a *tsg = NULL; u32 count = 0; + u32 count_channels_in_tsg; runlist = &f->runlist_info[runlist_id]; /* valid channel, add/remove it from active list. @@ -1784,6 +1785,7 @@ static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, count++; /* add runnable channels bound to this TSG */ + count_channels_in_tsg = 0; mutex_lock(&tsg->ch_list_lock); list_for_each_entry(ch, &tsg->ch_list, ch_entry) { if (!test_bit(ch->hw_chid, @@ -1796,8 +1798,12 @@ static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, runlist_entry[1] = 0; runlist_entry += 2; count++; + count_channels_in_tsg++; } mutex_unlock(&tsg->ch_list_lock); + + WARN_ON(tsg->num_active_channels != + count_channels_in_tsg); } mutex_unlock(&f->tsg_inuse_mutex); } else /* suspend to remove all channels */ -- cgit v1.2.2