intel: add INTEL_DEBUG=capture-all to capture everything upon hang

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewd-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18977>
This commit is contained in:
Lionel Landwerlin 2022-10-06 00:34:52 +03:00 committed by Marge Bot
parent 650880105e
commit 1964899c28
6 changed files with 19 additions and 4 deletions

View file

@ -280,6 +280,9 @@ Intel driver environment variables
emit messages about buffer objects
``bt``
emit messages binding tables
``capture-all``
flag all buffers to be captured by the kernel driver when
generating an error stage after a gpu hang
``clip``
emit messages about the clip unit (for old gens, includes the CLIP
program)

View file

@ -1133,7 +1133,7 @@ iris_bo_alloc(struct iris_bufmgr *bufmgr,
/* By default, capture all driver-internal buffers like shader kernels,
* surface states, dynamic states, border colors, and so on.
*/
if (memzone < IRIS_MEMZONE_OTHER)
if (memzone < IRIS_MEMZONE_OTHER || INTEL_DEBUG(DEBUG_CAPTURE_ALL))
bo->real.kflags |= EXEC_OBJECT_CAPTURE;
assert(bo->real.map == NULL || bo->real.mmap_mode == mmap_mode);
@ -1205,6 +1205,9 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
bo->bufmgr = bufmgr;
bo->real.kflags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_PINNED;
if (INTEL_DEBUG(DEBUG_CAPTURE_ALL))
bo->real.kflags |= EXEC_OBJECT_CAPTURE;
simple_mtx_lock(&bufmgr->lock);
bo->address = vma_alloc(bufmgr, memzone, size, 1);
simple_mtx_unlock(&bufmgr->lock);
@ -1285,6 +1288,8 @@ iris_bo_gem_create_from_name(struct iris_bufmgr *bufmgr,
bo->real.imported = true;
bo->real.mmap_mode = IRIS_MMAP_NONE;
bo->real.kflags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_PINNED;
if (INTEL_DEBUG(DEBUG_CAPTURE_ALL))
bo->real.kflags |= EXEC_OBJECT_CAPTURE;
bo->address = vma_alloc(bufmgr, IRIS_MEMZONE_OTHER, bo->size, 1);
if (bo->address == 0ull) {
@ -1913,6 +1918,8 @@ iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd)
bo->real.imported = true;
bo->real.mmap_mode = IRIS_MMAP_NONE;
bo->real.kflags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_PINNED;
if (INTEL_DEBUG(DEBUG_CAPTURE_ALL))
bo->real.kflags |= EXEC_OBJECT_CAPTURE;
bo->gem_handle = handle;
/* From the Bspec, Memory Compression - Gfx12:

View file

@ -93,6 +93,7 @@ static const struct debug_control debug_control[] = {
{ "task", DEBUG_TASK },
{ "mesh", DEBUG_MESH },
{ "stall", DEBUG_STALL },
{ "capture-all", DEBUG_CAPTURE_ALL },
{ NULL, 0 }
};

View file

@ -88,6 +88,7 @@ extern uint64_t intel_debug;
#define DEBUG_RT (1ull << 40)
#define DEBUG_TASK (1ull << 41)
#define DEBUG_MESH (1ull << 42)
#define DEBUG_CAPTURE_ALL (1ull << 43)
#define DEBUG_ANY (~0ull)

View file

@ -1366,7 +1366,9 @@ anv_bo_alloc_flags_to_bo_flags(struct anv_device *device,
pdevice->supports_48bit_addresses)
bo_flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
if ((alloc_flags & ANV_BO_ALLOC_CAPTURE) && pdevice->has_exec_capture)
if (((alloc_flags & ANV_BO_ALLOC_CAPTURE) ||
INTEL_DEBUG(DEBUG_CAPTURE_ALL)) &&
pdevice->has_exec_capture)
bo_flags |= EXEC_OBJECT_CAPTURE;
if (alloc_flags & ANV_BO_ALLOC_IMPLICIT_WRITE) {

View file

@ -1786,8 +1786,9 @@ anv_queue_exec_locked(struct anv_queue *queue,
const struct anv_bo *bo = execbuf.bos[i];
fprintf(stderr, " BO: addr=0x%016"PRIx64"-0x%016"PRIx64" size=0x%010"PRIx64
" handle=%05u name=%s\n",
bo->offset, bo->offset + bo->size - 1, bo->size, bo->gem_handle, bo->name);
" handle=%05u capture=%u name=%s\n",
bo->offset, bo->offset + bo->size - 1, bo->size, bo->gem_handle,
(bo->flags & EXEC_OBJECT_CAPTURE) != 0, bo->name);
}
}