gpu: nvgpu: do tsg unbind hw state check only for multi-channel TSG

Host scheduler might be confused if more than one channels are present
in TSG and one of the unbound channel has NEXT set.

This is not so much of an issue if there is single channel in the TSG.
So don't fail unbind in that case. ctx_reload and engine_faulted check
can also be skipped for single channel TSG.

Bug 3144960

Change-Id: I85eb9025ea53706ce8fda6d9b4bcf6a15a300d17
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2442970
(cherry picked from commit ad4624aae3f109fc3c8c03653cb691e09f086930)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2445445
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sagar Kamble
2020-11-08 22:16:44 +05:30
committed by mobile promotions
parent 8cb168632b
commit 7bf2833f34

View File

@@ -2212,6 +2212,22 @@ int gk20a_fifo_tsg_unbind_channel_verify_status(struct channel_gk20a *ch)
return 0; return 0;
} }
static bool gk20a_fifo_tsg_is_multi_channel(struct tsg_gk20a *tsg)
{
bool ret = false;
nvgpu_rwsem_down_read(&tsg->ch_list_lock);
if (nvgpu_list_first_entry(&tsg->ch_list, channel_gk20a,
ch_entry) !=
nvgpu_list_last_entry(&tsg->ch_list, channel_gk20a,
ch_entry)) {
ret = true;
}
nvgpu_rwsem_up_read(&tsg->ch_list_lock);
return ret;
}
int gk20a_fifo_tsg_unbind_channel(struct channel_gk20a *ch) int gk20a_fifo_tsg_unbind_channel(struct channel_gk20a *ch)
{ {
struct gk20a *g = ch->g; struct gk20a *g = ch->g;
@@ -2237,7 +2253,12 @@ int gk20a_fifo_tsg_unbind_channel(struct channel_gk20a *ch)
goto fail_enable_tsg; goto fail_enable_tsg;
} }
if (g->ops.fifo.tsg_verify_channel_status && !tsg_timedout) { /*
* State validation is only necessary if there are multiple channels in
* the TSG.
*/
if (gk20a_fifo_tsg_is_multi_channel(tsg) &&
g->ops.fifo.tsg_verify_channel_status && !tsg_timedout) {
err = g->ops.fifo.tsg_verify_channel_status(ch); err = g->ops.fifo.tsg_verify_channel_status(ch);
if (err) { if (err) {
goto fail_enable_tsg; goto fail_enable_tsg;