[Intel-gfx] [PATCH v2] drm/i915: Enable debugobjects for request validation

2018-02-04 Thread Chris Wilson
Use debugobjects to track and validate the lifecycle of a struct
drm_i915_gem_request.

v2: Mark up allowed NULL request pointers.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/Kconfig.debug  |  14 
 drivers/gpu/drm/i915/i915_gem_request.c | 140 ++--
 drivers/gpu/drm/i915/i915_gem_request.h |  37 -
 3 files changed, 181 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/Kconfig.debug 
b/drivers/gpu/drm/i915/Kconfig.debug
index 108d21f34777..326be039e39c 100644
--- a/drivers/gpu/drm/i915/Kconfig.debug
+++ b/drivers/gpu/drm/i915/Kconfig.debug
@@ -27,6 +27,7 @@ config DRM_I915_DEBUG
 select DRM_DEBUG_MM if DRM=y
select DRM_DEBUG_MM_SELFTEST
select SW_SYNC # signaling validation framework (igt/syncobj*)
+   select DRM_I915_REQUEST_DEBUG_OBJECTS
select DRM_I915_SW_FENCE_DEBUG_OBJECTS
select DRM_I915_SELFTEST
 default n
@@ -64,6 +65,19 @@ config DRM_I915_TRACE_GEM
 
  If in doubt, say "N".
 
+config DRM_I915_REQUEST_DEBUG_OBJECTS
+bool "Enable additional driver debugging for request objects"
+depends on DRM_I915
+select DEBUG_OBJECTS
+default n
+help
+  Choose this option to turn on extra driver debugging that may affect
+  performance but will catch some internal issues.
+
+  Recommended for driver developers only.
+
+  If in doubt, say "N".
+
 config DRM_I915_SW_FENCE_DEBUG_OBJECTS
 bool "Enable additional driver debugging for fence objects"
 depends on DRM_I915
diff --git a/drivers/gpu/drm/i915/i915_gem_request.c 
b/drivers/gpu/drm/i915/i915_gem_request.c
index cf2f3895b70e..164a1bb8d655 100644
--- a/drivers/gpu/drm/i915/i915_gem_request.c
+++ b/drivers/gpu/drm/i915/i915_gem_request.c
@@ -30,6 +30,108 @@
 
 #include "i915_drv.h"
 
+enum {
+   DEBUG_REQUEST_INACTIVE = 0,
+   DEBUG_REQUEST_WAITING,
+   DEBUG_REQUEST_READY,
+   DEBUG_REQUEST_EXECUTING,
+   DEBUG_REQUEST_RETIRED,
+};
+
+#if IS_ENABLED(CONFIG_DRM_I915_REQUEST_DEBUG_OBJECTS)
+
+static struct debug_obj_descr i915_request_debug_descr = {
+   .name = "i915_request",
+};
+
+static inline void debug_request_init(struct drm_i915_gem_request *rq)
+{
+   debug_object_init(rq, _request_debug_descr);
+}
+
+static inline void debug_request_activate(struct drm_i915_gem_request *rq)
+{
+   debug_object_activate(rq, _request_debug_descr);
+}
+
+static inline void debug_request_set_state(struct drm_i915_gem_request *rq,
+  int old, int new)
+{
+   debug_object_active_state(rq, _request_debug_descr, old, new);
+}
+
+static inline void debug_request_deactivate(struct drm_i915_gem_request *rq)
+{
+   debug_object_deactivate(rq, _request_debug_descr);
+}
+
+static inline void debug_request_destroy(struct drm_i915_gem_request *rq)
+{
+   debug_object_destroy(rq, _request_debug_descr);
+}
+
+static inline void debug_request_free(struct drm_i915_gem_request *rq)
+{
+   debug_object_free(rq, _request_debug_descr);
+   smp_wmb(); /* flush the change in state before reallocation */
+}
+
+void debug_request_assert(const struct drm_i915_gem_request *rq)
+{
+   debug_object_assert_init((void *)rq, _request_debug_descr);
+}
+
+#else
+
+static inline void debug_request_init(struct drm_i915_gem_request *rq)
+{
+}
+
+static inline void debug_request_activate(struct drm_i915_gem_request *rq)
+{
+}
+
+static inline void debug_request_set_state(struct drm_i915_gem_request *rq,
+  int old, int new)
+{
+}
+
+static inline void debug_request_deactivate(struct drm_i915_gem_request *rq)
+{
+}
+
+static inline void debug_request_destroy(struct drm_i915_gem_request *rq)
+{
+}
+
+static inline void debug_request_free(struct drm_i915_gem_request *rq)
+{
+}
+
+#endif
+
+static inline struct drm_i915_gem_request *
+__request_alloc(struct drm_i915_private *i915, gfp_t gfp)
+{
+#if IS_ENABLED(CONFIG_KASAN)
+   return kmalloc(sizeof(struct drm_i915_gem_request), gfp);
+#else
+   return kmem_cache_alloc(i915->requests, gfp);
+#endif
+}
+
+static inline void
+__request_free(struct drm_i915_gem_request *rq)
+{
+   debug_request_free(rq);
+
+#if IS_ENABLED(CONFIG_KASAN)
+   dma_fence_free(>fence);
+#else
+   kmem_cache_free(rq->i915->requests, rq);
+#endif
+}
+
 static const char *i915_fence_get_driver_name(struct dma_fence *fence)
 {
return "i915";
@@ -37,7 +139,8 @@ static const char *i915_fence_get_driver_name(struct 
dma_fence *fence)
 
 static const char *i915_fence_get_timeline_name(struct dma_fence *fence)
 {
-   /* The timeline struct (as part of the ppgtt underneath a context)
+   /*
+* The timeline struct (as part of the ppgtt underneath a context)
 * may be freed when the request is no longer in use by the GPU.
 * We could extend the life of a context to 

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Enable debugobjects for request validation (rev4)

2018-02-04 Thread Patchwork
== Series Details ==

Series: drm/i915: Enable debugobjects for request validation (rev4)
URL   : https://patchwork.freedesktop.org/series/37240/
State : success

== Summary ==

Series 37240v4 drm/i915: Enable debugobjects for request validation
https://patchwork.freedesktop.org/api/1.0/series/37240/revisions/4/mbox/

Test debugfs_test:
Subgroup read_all_entries:
pass   -> INCOMPLETE (fi-snb-2520m) fdo#103713
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
pass   -> FAIL   (fi-gdg-551) fdo#102575
Test gem_ringfill:
Subgroup basic-default-hang:
dmesg-warn -> INCOMPLETE (fi-pnv-d510) fdo#101600

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#101600 https://bugs.freedesktop.org/show_bug.cgi?id=101600

fi-bdw-5557u total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  
time:417s
fi-bdw-gvtdvmtotal:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  
time:423s
fi-blb-e6850 total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  
time:371s
fi-bsw-n3050 total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  
time:483s
fi-bwr-2160  total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 
time:281s
fi-bxt-dsi   total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  
time:482s
fi-bxt-j4205 total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  
time:481s
fi-byt-j1900 total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  
time:466s
fi-byt-n2820 total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  
time:455s
fi-cfl-s2total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  
time:566s
fi-elk-e7500 total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  
time:420s
fi-gdg-551   total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 
time:280s
fi-glk-1 total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  
time:512s
fi-hsw-4770  total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  
time:390s
fi-hsw-4770r total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  
time:405s
fi-ilk-650   total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  
time:412s
fi-ivb-3520m total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  
time:461s
fi-ivb-3770  total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  
time:417s
fi-kbl-7500u total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  
time:455s
fi-kbl-7560u total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  
time:497s
fi-kbl-7567u total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  
time:453s
fi-kbl-r total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  
time:501s
fi-pnv-d510  total:146  pass:113  dwarn:0   dfail:0   fail:0   skip:32 
fi-skl-6260u total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  
time:426s
fi-skl-6600u total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  
time:507s
fi-skl-6700hqtotal:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  
time:527s
fi-skl-6700k2total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  
time:490s
fi-skl-6770hqtotal:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  
time:478s
fi-skl-guc   total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  
time:415s
fi-skl-gvtdvmtotal:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  
time:430s
fi-snb-2520m total:3pass:2dwarn:0   dfail:0   fail:0   skip:0  
fi-snb-2600  total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  
time:396s
Blacklisted hosts:
fi-glk-dsi   total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  
time:471s

2e76a2952923eba64c4f9baf461613bc42ee997a drm-tip: 2018y-02m-02d-20h-33m-12s UTC 
integration manifest
444faaa68de2 drm/i915: Enable debugobjects for request validation

== Logs ==

For more details see: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7880/issues.html
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915: Enable debugobjects for request validation (rev4)

2018-02-04 Thread Patchwork
== Series Details ==

Series: drm/i915: Enable debugobjects for request validation (rev4)
URL   : https://patchwork.freedesktop.org/series/37240/
State : failure

== Summary ==

Test kms_cursor_legacy:
Subgroup flip-vs-cursor-atomic:
fail   -> PASS   (shard-hsw) fdo#102670 +1
Test testdisplay:
pass   -> DMESG-WARN (shard-apl) fdo#104727
Test gem_eio:
Subgroup in-flight-contexts:
dmesg-warn -> PASS   (shard-snb) fdo#104058
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-primscrn-pri-shrfb-draw-mmap-cpu:
pass   -> DMESG-FAIL (shard-apl) fdo#103167
Subgroup fbc-1p-primscrn-cur-indfb-draw-mmap-gtt:
pass   -> FAIL   (shard-apl) fdo#101623
Test gem_exec_schedule:
Subgroup wide-bsd:
pass   -> FAIL   (shard-apl) fdo#102848 +2
Subgroup wide-render:
pass   -> FAIL   (shard-apl)
Test kms_flip:
Subgroup 2x-plain-flip-ts-check:
fail   -> PASS   (shard-hsw)
Subgroup 2x-flip-vs-expired-vblank-interruptible:
fail   -> PASS   (shard-hsw) fdo#102887
Test gem_busy:
Subgroup close-race:
pass   -> DMESG-WARN (shard-hsw)

fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670
fdo#104727 https://bugs.freedesktop.org/show_bug.cgi?id=104727
fdo#104058 https://bugs.freedesktop.org/show_bug.cgi?id=104058
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#102848 https://bugs.freedesktop.org/show_bug.cgi?id=102848
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887

shard-apltotal:2836 pass:1744 dwarn:2   dfail:1   fail:25  skip:1064 
time:12370s
shard-hswtotal:2836 pass:1732 dwarn:2   dfail:0   fail:11  skip:1090 
time:11510s
shard-snbtotal:2836 pass:1328 dwarn:1   dfail:0   fail:10  skip:1497 
time:6427s
Blacklisted hosts:
shard-kbltotal:2836 pass:1867 dwarn:2   dfail:1   fail:21  skip:945 
time:9460s

== Logs ==

For more details see: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7880/shards.html
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] i915 PSR test results and cursor lag

2018-02-04 Thread Andy Lutomirski
On Sat, Feb 3, 2018 at 5:08 PM, Andy Lutomirski  wrote:
> On Sat, Feb 3, 2018 at 5:20 AM, Pandiyan, Dhinakaran
>  wrote:
>>
>> On Fri, 2018-02-02 at 19:18 +, Andy Lutomirski wrote:
>>> I updated to 4.15, and the situation is much worse.  With
>>> enable_psr=1, the system survives for several seconds and then the
>>> screen stops updating entirely.  If I boot with i915.enable_psr=1, I
>>> get to the Fedora login screen and then the system dies.  If I set
>>> enable_psr=1 using sysfs, it does a bit after the next resume.  It
>>> seems like it also sometimes hangs even worse a bit after the screen
>>> stops updating, but it's hard to tell.
>>
>> The login screen freeze sounds like what I have. Does this system have
>> DMC firmware? If yes, can you try this series
>> https://patchwork.freedesktop.org/series/37598/. You'll only need
>> patches 1,8,9 and 10.
>
> That fixes the hang.  Feel free to add:
>
> Tested-by: Andy Lutomirski 
>
> to the i915 parts.  Also, any chance of getting it into the 4.15 stable 
> kernels?

Correction: I'm still getting a second or two of complete screen
freezing every now and then.  The kernel says:

[69400.016524] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic
update failure on pipe A (start=19 end=20) time 198 us, min 1073, max
1079, scanline start 1068, end 1082

So something might still be a bit buggy.
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx