提交 172975aa 编写于 作者: C Chris Wilson 提交者: Daniel Vetter

drm/i915: Handle unmappable buffers during error state capture

As the buffer is not necessarily accessible through the GTT at the time
of a GPU hang, and capturing some of its contents is far more valuable
than skipping it, provide a clflushed fallback read path. We still
prefer to read through the GTT as that is more consistent with the GPU
access of the same buffer. So example it will demonstrate any errorneous
tiling or swizzling of the command buffer as seen by the GPU.

This becomes necessary with use of CPU relocations and lazy GTT binding,
but could potentially happen anyway as a result of a pathological error.
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: NEugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 8461d226
...@@ -720,7 +720,6 @@ i915_error_object_create(struct drm_i915_private *dev_priv, ...@@ -720,7 +720,6 @@ i915_error_object_create(struct drm_i915_private *dev_priv,
reloc_offset = src->gtt_offset; reloc_offset = src->gtt_offset;
for (page = 0; page < page_count; page++) { for (page = 0; page < page_count; page++) {
unsigned long flags; unsigned long flags;
void __iomem *s;
void *d; void *d;
d = kmalloc(PAGE_SIZE, GFP_ATOMIC); d = kmalloc(PAGE_SIZE, GFP_ATOMIC);
...@@ -728,10 +727,29 @@ i915_error_object_create(struct drm_i915_private *dev_priv, ...@@ -728,10 +727,29 @@ i915_error_object_create(struct drm_i915_private *dev_priv,
goto unwind; goto unwind;
local_irq_save(flags); local_irq_save(flags);
s = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping, if (reloc_offset < dev_priv->mm.gtt_mappable_end) {
reloc_offset); void __iomem *s;
memcpy_fromio(d, s, PAGE_SIZE);
io_mapping_unmap_atomic(s); /* Simply ignore tiling or any overlapping fence.
* It's part of the error state, and this hopefully
* captures what the GPU read.
*/
s = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping,
reloc_offset);
memcpy_fromio(d, s, PAGE_SIZE);
io_mapping_unmap_atomic(s);
} else {
void *s;
drm_clflush_pages(&src->pages[page], 1);
s = kmap_atomic(src->pages[page]);
memcpy(d, s, PAGE_SIZE);
kunmap_atomic(s);
drm_clflush_pages(&src->pages[page], 1);
}
local_irq_restore(flags); local_irq_restore(flags);
dst->pages[page] = d; dst->pages[page] = d;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册