From: Samuel Pitoiset Date: Tue, 10 Oct 2023 08:43:38 +0000 (+0200) Subject: radv: query and report the last GPUVM fault with RADV_DEBUG=hang X-Git-Tag: upstream/23.3.3~353 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a6208ad722d89416f19daf705b640c143add877;p=platform%2Fupstream%2Fmesa.git radv: query and report the last GPUVM fault with RADV_DEBUG=hang Tested with a small use-after-free Vulkan test. It's pretty basic for now but I think I will add status decoding support to report more useful information. Signed-off-by: Samuel Pitoiset Part-of: --- diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c index ebb6ffa..cda92da 100644 --- a/src/amd/vulkan/radv_debug.c +++ b/src/amd/vulkan/radv_debug.c @@ -694,10 +694,18 @@ radv_gpu_hang_occurred(struct radv_queue *queue, enum amd_ip_type ring) return false; } +static bool +radv_vm_fault_occurred(struct radv_device *device, struct radv_winsys_gpuvm_fault_info *fault_info) +{ + if (!device->physical_device->rad_info.has_gpuvm_fault_query) + return false; + + return device->ws->query_gpuvm_fault(device->ws, fault_info); +} + void radv_check_gpu_hangs(struct radv_queue *queue, const struct radv_winsys_submit_info *submit_info) { - struct radv_device *device = queue->device; enum amd_ip_type ring; ring = radv_queue_ring(queue); @@ -709,6 +717,12 @@ radv_check_gpu_hangs(struct radv_queue *queue, const struct radv_winsys_submit_i fprintf(stderr, "radv: GPU hang detected...\n"); #ifndef _WIN32 + struct radv_winsys_gpuvm_fault_info fault_info = {0}; + struct radv_device *device = queue->device; + + /* Query if a VM fault happened for this GPU hang. */ + bool vm_fault_occurred = radv_vm_fault_occurred(queue->device, &fault_info); + /* Create a directory into $HOME/radv_dumps__