From 4ffa6acb0decca0a8eb41b41e985b2f92bf8d1ff Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 20 Nov 2020 09:56:59 +0100 Subject: [PATCH] radv: add RADV_DEBUG=noumr to disable UMR logs during GPU hang detection Sometimes UMR logs can't be dumped and you would get permission denied, even if the UMR binary has the setuid bit enabled. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- docs/envvars.rst | 2 ++ src/amd/vulkan/radv_debug.c | 31 +++++++++++++++++-------------- src/amd/vulkan/radv_debug.h | 1 + src/amd/vulkan/radv_device.c | 1 + 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index b91e682ec16..e47befa388d 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -589,6 +589,8 @@ RADV driver environment variables disable out-of-order rasterization ``nothreadllvm`` disable LLVM threaded compilation + ``noumr`` + disable UMR dumps during GPU hang detection (only with RADV_DEBUG=hang) ``preoptir`` dump LLVM IR before any optimizations ``shaders`` diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c index 00af287dcc1..fb8b5ed0703 100644 --- a/src/amd/vulkan/radv_debug.c +++ b/src/amd/vulkan/radv_debug.c @@ -473,7 +473,8 @@ radv_dump_queue_state(struct radv_queue *queue, FILE *f) pipeline = radv_get_saved_pipeline(queue->device, ring); if (pipeline) { radv_dump_shaders(pipeline, pipeline->active_stages, f); - radv_dump_annotated_shaders(pipeline, pipeline->active_stages, f); + if (!(queue->device->instance->debug_flags & RADV_DEBUG_NO_UMR)) + radv_dump_annotated_shaders(pipeline, pipeline->active_stages, f); radv_dump_descriptors(queue->device, f); } } @@ -670,20 +671,22 @@ radv_check_gpu_hangs(struct radv_queue *queue, struct radeon_cmdbuf *cs) fclose(f); } - /* Dump UMR ring. */ - snprintf(dump_path, sizeof(dump_path), "%s/%s", dump_dir, "umr_ring.log"); - f = fopen(dump_path, "w+"); - if (f) { - radv_dump_umr_ring(queue, f); - fclose(f); - } + if (!(device->instance->debug_flags & RADV_DEBUG_NO_UMR)) { + /* Dump UMR ring. */ + snprintf(dump_path, sizeof(dump_path), "%s/%s", dump_dir, "umr_ring.log"); + f = fopen(dump_path, "w+"); + if (f) { + radv_dump_umr_ring(queue, f); + fclose(f); + } - /* Dump UMR waves. */ - snprintf(dump_path, sizeof(dump_path), "%s/%s", dump_dir, "umr_waves.log"); - f = fopen(dump_path, "w+"); - if (f) { - radv_dump_umr_waves(queue, f); - fclose(f); + /* Dump UMR waves. */ + snprintf(dump_path, sizeof(dump_path), "%s/%s", dump_dir, "umr_waves.log"); + f = fopen(dump_path, "w+"); + if (f) { + radv_dump_umr_waves(queue, f); + fclose(f); + } } /* Dump debug registers. */ diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h index 4f049f7dc2f..4d5c360c7c5 100644 --- a/src/amd/vulkan/radv_debug.h +++ b/src/amd/vulkan/radv_debug.h @@ -59,6 +59,7 @@ enum { RADV_DEBUG_FORCE_COMPRESS = 1 << 28, RADV_DEBUG_HANG = 1 << 29, RADV_DEBUG_IMG = 1 << 30, + RADV_DEBUG_NO_UMR = 1 << 31, }; enum { diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 2d3e8813d30..b71ea73cdcc 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -553,6 +553,7 @@ static const struct debug_control radv_debug_options[] = { {"forcecompress", RADV_DEBUG_FORCE_COMPRESS}, {"hang", RADV_DEBUG_HANG}, {"img", RADV_DEBUG_IMG}, + {"noumr", RADV_DEBUG_NO_UMR}, {NULL, 0} };