summaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2015-03-06 09:33:43 -0500
committerTerje Bergstrom <tbergstrom@nvidia.com>2015-06-09 14:13:43 -0400
commit6085c90f499c642bc41a646b0efbdfe60e096c74 (patch)
tree0eaab99b228ce162ec3a44d0f8138b441f5a64f4 /include/trace
parenta41e5c41cadaa3d030a1f75b09328b8b1a440b69 (diff)
gpu: nvgpu: add per-channel refcounting
Add reference counting for channels, and wait for reference count to get to 0 in gk20a_channel_free() before actually freeing the channel. Also, change free channel tracking a bit by employing a list of free channels, which simplifies the procedure of finding available channels with reference counting. Each use of a channel must have a reference taken before use or held by the caller. Taking a reference of a wild channel pointer may fail, if the channel is either not opened or in a process of being closed. Also, add safeguards for protecting accidental use of closed channels, specifically, by setting ch->g = NULL in channel free. This will make it obvious if freed channel is attempted to be used. The last user of a channel might be the deferred interrupt handler, so wait for deferred interrupts to be processed twice in the channel free procedure: once for providing last notifications to the channel and once to make sure there are no stale pointers left after referencing to the channel has been denied. Finally, fix some races in channel and TSG force reset IOCTL path, by pausing the channel scheduler in gk20a_fifo_recover_ch() and gk20a_fifo_recover_tsg(), while the affected engines have been identified, the appropriate MMU faults triggered, and the MMU faults handled. In this case, make sure that the MMU fault does not attempt to query the hardware about the failing channel or TSG ids. This should make channel recovery more safe also in the regular (i.e., not in the interrupt handler) context. Bug 1530226 Bug 1597493 Bug 1625901 Bug 200076344 Bug 200071810 Change-Id: Ib274876908e18219c64ea41e50ca443df81d957b Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Signed-off-by: Sami Kiminki <skiminki@nvidia.com> Reviewed-on: http://git-master/r/448463 (cherry picked from commit 3f03aeae64ef2af4829e06f5f63062e8ebd21353) Reviewed-on: http://git-master/r/755147 Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/gk20a.h50
1 files changed, 46 insertions, 4 deletions
diff --git a/include/trace/events/gk20a.h b/include/trace/events/gk20a.h
index ad738f43..461ff6e8 100644
--- a/include/trace/events/gk20a.h
+++ b/include/trace/events/gk20a.h
@@ -140,12 +140,54 @@ DEFINE_EVENT(gk20a, gk20a_mm_g_elpg_flush_locked_done,
140 TP_ARGS(name) 140 TP_ARGS(name)
141); 141);
142 142
143TRACE_EVENT(gk20a_channel_update, 143DECLARE_EVENT_CLASS(gk20a_channel,
144 TP_PROTO(const void *channel), 144 TP_PROTO(int channel),
145 TP_ARGS(channel), 145 TP_ARGS(channel),
146 TP_STRUCT__entry(__field(const void *, channel)), 146 TP_STRUCT__entry(__field(int, channel)),
147 TP_fast_assign(__entry->channel = channel;), 147 TP_fast_assign(__entry->channel = channel;),
148 TP_printk("channel=%p", __entry->channel) 148 TP_printk("ch id %d", __entry->channel)
149);
150DEFINE_EVENT(gk20a_channel, gk20a_channel_update,
151 TP_PROTO(int channel),
152 TP_ARGS(channel)
153);
154DEFINE_EVENT(gk20a_channel, gk20a_free_channel,
155 TP_PROTO(int channel),
156 TP_ARGS(channel)
157);
158DEFINE_EVENT(gk20a_channel, gk20a_open_new_channel,
159 TP_PROTO(int channel),
160 TP_ARGS(channel)
161);
162DEFINE_EVENT(gk20a_channel, gk20a_release_used_channel,
163 TP_PROTO(int channel),
164 TP_ARGS(channel)
165);
166
167DECLARE_EVENT_CLASS(gk20a_channel_getput,
168 TP_PROTO(int channel, const char *caller),
169 TP_ARGS(channel, caller),
170 TP_STRUCT__entry(
171 __field(int, channel)
172 __field(const char *, caller)
173 ),
174 TP_fast_assign(
175 __entry->channel = channel;
176 __entry->caller = caller;
177 ),
178 TP_printk("channel %d caller %s", __entry->channel, __entry->caller)
179);
180DEFINE_EVENT(gk20a_channel_getput, gk20a_channel_get,
181 TP_PROTO(int channel, const char *caller),
182 TP_ARGS(channel, caller)
183);
184DEFINE_EVENT(gk20a_channel_getput, gk20a_channel_put,
185 TP_PROTO(int channel, const char *caller),
186 TP_ARGS(channel, caller)
187);
188DEFINE_EVENT(gk20a_channel_getput, gk20a_channel_put_nofree,
189 TP_PROTO(int channel, const char *caller),
190 TP_ARGS(channel, caller)
149); 191);
150 192
151TRACE_EVENT(gk20a_push_cmdbuf, 193TRACE_EVENT(gk20a_push_cmdbuf,