summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c10
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c11
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 4458430b..f60a92b4 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -1142,6 +1142,7 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g,
1142{ 1142{
1143 struct fifo_gk20a *f = &g->fifo; 1143 struct fifo_gk20a *f = &g->fifo;
1144 struct channel_gk20a *ch; 1144 struct channel_gk20a *ch;
1145 struct gk20a_event_id_data *event_id_data, *event_id_data_temp;
1145 1146
1146 /* compatibility with existing code */ 1147 /* compatibility with existing code */
1147 if (!gk20a_fifo_is_valid_runlist_id(g, runlist_id)) { 1148 if (!gk20a_fifo_is_valid_runlist_id(g, runlist_id)) {
@@ -1182,6 +1183,15 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g,
1182 ch->pid = current->pid; 1183 ch->pid = current->pid;
1183 ch->tgid = current->tgid; /* process granularity for FECS traces */ 1184 ch->tgid = current->tgid; /* process granularity for FECS traces */
1184 1185
1186 /* unhook all events created on this channel */
1187 mutex_lock(&ch->event_id_list_lock);
1188 list_for_each_entry_safe(event_id_data, event_id_data_temp,
1189 &ch->event_id_list,
1190 event_id_node) {
1191 list_del_init(&event_id_data->event_id_node);
1192 }
1193 mutex_unlock(&ch->event_id_list_lock);
1194
1185 /* By default, channel is regular (non-TSG) channel */ 1195 /* By default, channel is regular (non-TSG) channel */
1186 ch->tsgid = NVGPU_INVALID_TSG_ID; 1196 ch->tsgid = NVGPU_INVALID_TSG_ID;
1187 1197
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index 3e83cd06..716388ec 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -451,6 +451,7 @@ void gk20a_tsg_release(struct kref *ref)
451{ 451{
452 struct tsg_gk20a *tsg = container_of(ref, struct tsg_gk20a, refcount); 452 struct tsg_gk20a *tsg = container_of(ref, struct tsg_gk20a, refcount);
453 struct gk20a *g = tsg->g; 453 struct gk20a *g = tsg->g;
454 struct gk20a_event_id_data *event_id_data, *event_id_data_temp;
454 455
455 if (tsg->tsg_gr_ctx) { 456 if (tsg->tsg_gr_ctx) {
456 gr_gk20a_free_tsg_gr_ctx(tsg); 457 gr_gk20a_free_tsg_gr_ctx(tsg);
@@ -462,6 +463,16 @@ void gk20a_tsg_release(struct kref *ref)
462 } 463 }
463 464
464 gk20a_sched_ctrl_tsg_removed(g, tsg); 465 gk20a_sched_ctrl_tsg_removed(g, tsg);
466
467 /* unhook all events created on this TSG */
468 mutex_lock(&tsg->event_id_list_lock);
469 list_for_each_entry_safe(event_id_data, event_id_data_temp,
470 &tsg->event_id_list,
471 event_id_node) {
472 list_del_init(&event_id_data->event_id_node);
473 }
474 mutex_unlock(&tsg->event_id_list_lock);
475
465 release_used_tsg(&g->fifo, tsg); 476 release_used_tsg(&g->fifo, tsg);
466 477
467 tsg->runlist_id = ~0; 478 tsg->runlist_id = ~0;