diff --git a/drivers/gpu/nvgpu/common/fifo/tsg.c b/drivers/gpu/nvgpu/common/fifo/tsg.c index 09e1cedb7..40e30191e 100644 --- a/drivers/gpu/nvgpu/common/fifo/tsg.c +++ b/drivers/gpu/nvgpu/common/fifo/tsg.c @@ -347,13 +347,13 @@ int nvgpu_tsg_unbind_channel(struct nvgpu_tsg *tsg, struct nvgpu_channel *ch, */ (void) nvgpu_channel_mark_error(g, ch); nvgpu_err(g, "unbind hal failed, err=%d", err); - goto fail; + nvgpu_tsg_abort(g, tsg, true); } } nvgpu_ref_put(&tsg->refcount, nvgpu_tsg_release); - return 0; + return err; fail_common: if (g->ops.tsg.unbind_channel != NULL) { @@ -362,7 +362,7 @@ fail_common: nvgpu_err(g, "unbind hal failed, err=%d", unbind_err); } } -fail: + nvgpu_err(g, "Channel %d unbind failed, tearing down TSG %d", ch->chid, tsg->tsgid); @@ -399,6 +399,7 @@ fail: nvgpu_rwsem_down_write(&tsg->ch_list_lock); nvgpu_list_del(&ch->ch_entry); ch->tsgid = NVGPU_INVALID_TSG_ID; + tsg->ch_count = nvgpu_safe_sub_u32(tsg->ch_count, 1U); nvgpu_rwsem_up_write(&tsg->ch_list_lock); nvgpu_ref_put(&tsg->refcount, nvgpu_tsg_release); diff --git a/drivers/gpu/nvgpu/include/nvgpu/tsg.h b/drivers/gpu/nvgpu/include/nvgpu/tsg.h index 8f8a6edf8..36f907cd7 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/tsg.h +++ b/drivers/gpu/nvgpu/include/nvgpu/tsg.h @@ -456,6 +456,7 @@ struct nvgpu_tsg *nvgpu_tsg_check_and_get_from_id(struct gk20a *g, u32 tsgid); * - Call #nvgpu_channel_update_runlist to remove the channel from the runlist. * - Acquire #nvgpu_tsg.ch_list_lock of the tsg and delete channel from * #nvgpu_tsg.ch_list. + * - Remove channel from TSG's channel list. * - Set #nvgpu_channel.tsgid to #NVGPU_INVALID_TSG_ID * - Release #nvgpu_tsg.ch_list_lock of the tsg. * Call non NULL HAL to unbind channel from the tsg. This HAL is vgpu specific