All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915/gt: Poison GTT scratch pages
@ 2020-01-22 20:18 Chris Wilson
  2020-01-22 21:02 ` Chris Wilson
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Chris Wilson @ 2020-01-22 20:18 UTC (permalink / raw)
  To: intel-gfx

Using a clear page for scratch means that we have relatively benign
errors in case it is accidentally used, but that can be rather too
benign for debugging. If we poison the scratch, ideally it quickly
results in an obvious error.

Suggested-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gtt.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.c b/drivers/gpu/drm/i915/gt/intel_gtt.c
index 45d8e0019a8e..aaba06a774ab 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.c
@@ -331,6 +331,21 @@ int setup_scratch_page(struct i915_address_space *vm, gfp_t gfp)
 		if (unlikely(!page))
 			goto skip;
 
+		/*
+		 * Use a non-zero scratch page for debugging.
+		 *
+		 * We want a value that should be reasonably obvious
+		 * to spot in the error state, while also causing a GPU hang
+		 * if executed. We prefer using a clear page in production, so
+		 * should it ever be accidentally used, the effect should be
+		 * fairly benign.
+		 */
+		if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)) {
+			kunmap_atomic(memset64(kmap_atomic(page),
+					       POISON_FREE,
+					       size / sizeof(64)));
+		}
+
 		addr = dma_map_page_attrs(vm->dma,
 					  page, 0, size,
 					  PCI_DMA_BIDIRECTIONAL,
-- 
2.25.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-01-24  0:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22 20:18 [Intel-gfx] [PATCH] drm/i915/gt: Poison GTT scratch pages Chris Wilson
2020-01-22 21:02 ` Chris Wilson
2020-01-23  7:40   ` Chris Wilson
2020-01-23  3:42 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gt: Poison GTT scratch pages (rev2) Patchwork
2020-01-23  8:25 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gt: Poison GTT scratch pages (rev3) Patchwork
2020-01-23  8:51 ` [Intel-gfx] [PATCH] drm/i915/gt: Poison GTT scratch pages Chris Wilson
2020-01-23  9:38   ` Matthew Auld
2020-01-23  9:55     ` Chris Wilson
2020-01-23  9:50 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gt: Poison GTT scratch pages (rev4) Patchwork
2020-01-23 10:12 ` [Intel-gfx] [PATCH v2] drm/i915/gt: Poison GTT scratch pages Chris Wilson
2020-01-23 11:18 ` [Intel-gfx] [PATCH v3] " Chris Wilson
2020-01-23 11:56   ` Mika Kuoppala
2020-01-23 12:12     ` Chris Wilson
2020-01-23 14:47 ` Chris Wilson
2020-01-23 14:53 ` [Intel-gfx] [PATCH v4] " Chris Wilson
2020-01-24  0:50 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gt: Poison GTT scratch pages (rev8) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.