gpu: nvgpu: update channel TSG unbind fail paths

On tsg.unbind_channel hal failure, channel teardown was being done
again that was done already as part of the function
nvgpu_tsg_unbind_channel_common.

Just abort the TSG and return err in that case. Also, decrement
the TSG ch_count in the fail path.

Bug 3677982

Change-Id: I466f2b2c693d43ed64dc531b08bf740bf00f28a6
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2749970
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
This commit is contained in:
Sagar Kamble
2022-07-24 07:26:26 +05:30
committed by mobile promotions
parent 9bc405dbbd
commit 7085934303
2 changed files with 5 additions and 3 deletions

View File

@@ -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);

View File

@@ -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