diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2016-10-17 11:56:37 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-10-20 03:34:08 -0400 |
commit | 3c2656c8c6ebf7cef7376d3a28451249643121c4 (patch) | |
tree | 6cf1aa425137ad0ba4c580b5951daa1ec44d9baa /drivers/gpu/nvgpu/gk20a | |
parent | bec21f8c6d5793af0685d4f877da8a1d10716848 (diff) |
gpu: nvgpu: clear events from channel/TSG while closing
If User does not close the event fd created on channel/TSG,
it is possible that the event stays on channel/TSG
structure and reappears when channel/TSG is re-opened
This causes false failure when we try to enable some event
of channel/TSG since we do not allow enabling same event
twice on same channel/TSG
Fix this by removing all enabled events from channel/TSG
while closing it
Bug 200243092
Bug 1818654
Change-Id: I9d5ffc89f87cf4c44124f8015c2c2f0587ad2ef4
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1237723
(cherry picked from commit 2737a5c86cf5fbfe8a04f6a87764e8ecb9b30555)
Reviewed-on: http://git-master/r/1238266
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 10 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | 11 |
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; |