iris: add identifier BO

A buffer added to all execbufs so that we can attribute a batch that
caused a hang to a particular driver.

v2: Reuse workaround BO

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3203>
This commit is contained in:
Lionel Landwerlin 2019-12-24 02:41:10 +02:00 committed by Marge Bot
parent 805b32cab9
commit 2a4c361b06
3 changed files with 34 additions and 6 deletions

View File

@ -398,6 +398,11 @@ iris_batch_reset(struct iris_batch *batch)
iris_cache_sets_clear(batch);
/* Always add the workaround BO, it contains a driver identifier at the
* beginning quite helpful to debug error states.
*/
iris_use_pinned_bo(batch, screen->workaround_bo, false);
iris_batch_maybe_noop(batch);
}

View File

@ -663,6 +663,27 @@ iris_detect_kernel_features(struct iris_screen *screen)
screen->kernel_features |= KERNEL_HAS_WAIT_FOR_SUBMIT;
}
static bool
iris_init_identifier_bo(struct iris_screen *screen)
{
void *bo_map;
bo_map = iris_bo_map(NULL, screen->workaround_bo, MAP_READ | MAP_WRITE);
if (!bo_map)
return false;
screen->workaround_bo->kflags |= EXEC_OBJECT_CAPTURE;
screen->workaround_address = (struct iris_address) {
.bo = screen->workaround_bo,
.offset = ALIGN(
intel_debug_write_identifiers(bo_map, 4096, "Iris") + 8, 8),
};
iris_bo_unmap(screen->workaround_bo);
return true;
}
struct pipe_screen *
iris_screen_create(int fd, const struct pipe_screen_config *config)
{
@ -718,10 +739,8 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
if (!screen->workaround_bo)
return NULL;
screen->workaround_address = (struct iris_address) {
.bo = screen->workaround_bo,
.offset = 0,
};
if (!iris_init_identifier_bo(screen))
return NULL;
brw_process_intel_debug_variable();

View File

@ -192,8 +192,12 @@ struct iris_screen {
const struct gen_l3_config *l3_config_cs;
/**
* A buffer containing nothing useful, for hardware workarounds that
* require scratch writes or reads from some unimportant memory.
* A buffer containing a marker + description of the driver. This buffer is
* added to all execbufs syscalls so that we can identify the driver that
* generated a hang by looking at the content of the buffer in the error
* state. It is also used for hardware workarounds that require scratch
* writes or reads from some unimportant memory. To avoid overriding the
* debug data, use the workaround_address field for workarounds.
*/
struct iris_bo *workaround_bo;
struct iris_address workaround_address;