summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-09-26 09:38:19 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-04 06:37:17 -0400
commit33f475d6d871a0edfa7e02da9ba1706bfb362192 (patch)
tree68a1135137377d10b530e7401c8910275c153fe4
parent3cd0603c4218ee33eb1e5a36322b25d369ed487b (diff)
gpu: nvgpu: kill TSG if channel has NEXT set while closing
Currently if channel has NEXT bit set while closing the channel we just print an error and continue channel unbind sequence from TSG But since channel with NEXT set is active killing it can potentially corrupt the TSG context and cause unpredictable errors on remaining channels/TSG Hence fix this by killing whole TSG context if channel being closed has NEXT bit set if gk20a_fifo_tsg_unbind_channel() API returns error, kill the TSG otherwise continue with channel unbind sequence Bug 200327095 Change-Id: I2abf1a3db8ba6f105b6ca86e78006c7b2a7726cc Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1568566 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c8
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c14
2 files changed, 17 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index 8e78b95e..9eb2204d 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -1918,9 +1918,11 @@ int gk20a_fifo_tsg_unbind_channel_verify_status(struct channel_gk20a *ch)
1918 if (g->ops.fifo.tsg_verify_status_faulted) 1918 if (g->ops.fifo.tsg_verify_status_faulted)
1919 g->ops.fifo.tsg_verify_status_faulted(ch); 1919 g->ops.fifo.tsg_verify_status_faulted(ch);
1920 1920
1921 if (gk20a_fifo_channel_status_is_next(g, ch->chid)) 1921 if (gk20a_fifo_channel_status_is_next(g, ch->chid)) {
1922 nvgpu_err(g, "Channel %d to be removed from TSG has NEXT set!", 1922 nvgpu_err(g, "Channel %d to be removed from TSG %d has NEXT set!",
1923 ch->chid); 1923 ch->chid, ch->tsgid);
1924 return -EINVAL;
1925 }
1924 1926
1925 return 0; 1927 return 0;
1926} 1928}
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index e285f96c..6c1c2955 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -150,8 +150,18 @@ int gk20a_tsg_unbind_channel(struct channel_gk20a *ch)
150 int err; 150 int err;
151 151
152 err = gk20a_fifo_tsg_unbind_channel(ch); 152 err = gk20a_fifo_tsg_unbind_channel(ch);
153 if (err) 153 if (err) {
154 return err; 154 nvgpu_err(g, "Channel %d unbind failed, tearing down TSG %d",
155 ch->chid, tsg->tsgid);
156
157 gk20a_fifo_abort_tsg(ch->g, ch->tsgid, true);
158 /* If channel unbind fails, channel is still part of runlist */
159 channel_gk20a_update_runlist(ch, false);
160
161 down_write(&tsg->ch_list_lock);
162 nvgpu_list_del(&ch->ch_entry);
163 up_write(&tsg->ch_list_lock);
164 }
155 165
156 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); 166 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release);
157 ch->tsgid = NVGPU_INVALID_TSG_ID; 167 ch->tsgid = NVGPU_INVALID_TSG_ID;