gpu: nvgpu: check ch_timedout for poll/restart

poll_timeouts and timeout_restart_all_channels should
only handle channels that have not been recovered/aborted.
Check ch_timedout status of the channel to make sure
channel is still alive to be used. A channel reference
could still be available even if it is recovered but not
closed.

Bug 2404865

Change-Id: I016c8b9952ef1d4c349c2a2a2ca55cb81326d380
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929339
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Seema Khowala
2018-10-17 14:40:59 -07:00
committed by mobile promotions
parent 88cff206ae
commit def687d4df

View File

@@ -1378,6 +1378,11 @@ u32 nvgpu_get_gp_free_count(struct channel_gk20a *c)
static void __gk20a_channel_timeout_start(struct channel_gk20a *ch)
{
if (gk20a_channel_check_timedout(ch)) {
ch->timeout.running = false;
return;
}
ch->timeout.gp_get = ch->g->ops.fifo.userd_gp_get(ch->g, ch);
ch->timeout.pb_get = ch->g->ops.fifo.userd_pb_get(ch->g, ch);
ch->timeout.running = true;
@@ -1475,17 +1480,16 @@ void gk20a_channel_timeout_restart_all_channels(struct gk20a *g)
for (chid = 0; chid < f->num_channels; chid++) {
struct channel_gk20a *ch = &f->channel[chid];
if (gk20a_channel_get(ch) == NULL) {
continue;
if (gk20a_channel_get(ch) != NULL) {
if (!gk20a_channel_check_timedout(ch)) {
nvgpu_raw_spinlock_acquire(&ch->timeout.lock);
if (ch->timeout.running) {
__gk20a_channel_timeout_start(ch);
}
nvgpu_raw_spinlock_release(&ch->timeout.lock);
}
gk20a_channel_put(ch);
}
nvgpu_raw_spinlock_acquire(&ch->timeout.lock);
if (ch->timeout.running) {
__gk20a_channel_timeout_start(ch);
}
nvgpu_raw_spinlock_release(&ch->timeout.lock);
gk20a_channel_put(ch);
}
}
@@ -1509,6 +1513,12 @@ static void gk20a_channel_timeout_handler(struct channel_gk20a *ch)
nvgpu_log_fn(g, " ");
if (gk20a_channel_check_timedout(ch)) {
/* channel is already recovered */
gk20a_channel_timeout_stop(ch);
return;
}
/* Get status but keep timer running */
nvgpu_raw_spinlock_acquire(&ch->timeout.lock);
gp_get = ch->timeout.gp_get;
@@ -1579,7 +1589,9 @@ static void gk20a_channel_poll_timeouts(struct gk20a *g)
struct channel_gk20a *ch = &g->fifo.channel[chid];
if (gk20a_channel_get(ch) != NULL) {
gk20a_channel_timeout_check(ch);
if (!gk20a_channel_check_timedout(ch)) {
gk20a_channel_timeout_check(ch);
}
gk20a_channel_put(ch);
}
}