diff options
author | Ben Widawsky <ben@bwidawsk.net> | 2012-05-24 18:03:09 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-05-25 03:55:15 -0400 |
commit | f3fd37683cc406ffaccf097de0433130c85c8651 (patch) | |
tree | b3fdd17c52001bfd48edc339819f6b9a7a0022af /drivers/gpu/drm/i915/i915_trace.h | |
parent | 5c81fe85dad3c8c2bcec03e3fc2bfd4ea198763c (diff) |
drm/i915: improve i915_wait_request_begin trace
The trace events adds whether or not the wait was blocking. Blocking in
this case means to hold struct_mutex (ie. no new work can be submitted
during the wait). The information is inherently racy.
The blocking information is racy since mutex_is_locked doesn't check
that the current thread holds the lock. The only other option would be
to pass the boolean information of whether or not the class was blocking
down through the stack which is less desirable.
v2: Don't do a trace event per loop. (Chris)
Only get blocking/non-blocking info (Chris)
v3: updated comment in code as well as commit msg (Daniel)
Add "(NB)" to trace information to remind us in 6 months (Ben)
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_trace.h')
-rw-r--r-- | drivers/gpu/drm/i915/i915_trace.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h index dac7bba4d9da..fe90b3a84a6d 100644 --- a/drivers/gpu/drm/i915/i915_trace.h +++ b/drivers/gpu/drm/i915/i915_trace.h | |||
@@ -311,9 +311,33 @@ DEFINE_EVENT(i915_gem_request, i915_gem_request_retire, | |||
311 | TP_ARGS(ring, seqno) | 311 | TP_ARGS(ring, seqno) |
312 | ); | 312 | ); |
313 | 313 | ||
314 | DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_begin, | 314 | TRACE_EVENT(i915_gem_request_wait_begin, |
315 | TP_PROTO(struct intel_ring_buffer *ring, u32 seqno), | 315 | TP_PROTO(struct intel_ring_buffer *ring, u32 seqno), |
316 | TP_ARGS(ring, seqno) | 316 | TP_ARGS(ring, seqno), |
317 | |||
318 | TP_STRUCT__entry( | ||
319 | __field(u32, dev) | ||
320 | __field(u32, ring) | ||
321 | __field(u32, seqno) | ||
322 | __field(bool, blocking) | ||
323 | ), | ||
324 | |||
325 | /* NB: the blocking information is racy since mutex_is_locked | ||
326 | * doesn't check that the current thread holds the lock. The only | ||
327 | * other option would be to pass the boolean information of whether | ||
328 | * or not the class was blocking down through the stack which is | ||
329 | * less desirable. | ||
330 | */ | ||
331 | TP_fast_assign( | ||
332 | __entry->dev = ring->dev->primary->index; | ||
333 | __entry->ring = ring->id; | ||
334 | __entry->seqno = seqno; | ||
335 | __entry->blocking = mutex_is_locked(&ring->dev->struct_mutex); | ||
336 | ), | ||
337 | |||
338 | TP_printk("dev=%u, ring=%u, seqno=%u, blocking=%s", | ||
339 | __entry->dev, __entry->ring, __entry->seqno, | ||
340 | __entry->blocking ? "yes (NB)" : "no") | ||
317 | ); | 341 | ); |
318 | 342 | ||
319 | DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end, | 343 | DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end, |