From 6fd3962cfa4e07f245c463e7de7514b807d2594b Mon Sep 17 00:00:00 2001 From: Calder Young Date: Wed, 8 Apr 2026 14:36:42 -0700 Subject: [PATCH] anv: Print page faults whenever a queue gets banned Prints the page faults to STDERR whenever a banned queue is detected for added visibility to developers. Currently, the only way to get this information without using the device fault extension is to increase the kernel logging verbosity and check dmesg after a lost device. In my opinion its a lot more convenient for all parties involved if the driver could just print this directly to the log instead. Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_debug.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/intel/vulkan/anv_debug.c b/src/intel/vulkan/anv_debug.c index d83021443db..f08a5e0e1a8 100644 --- a/src/intel/vulkan/anv_debug.c +++ b/src/intel/vulkan/anv_debug.c @@ -6,6 +6,27 @@ #include "anv_private.h" +static inline void +anv_device_print_vm_faults(struct anv_device *device) +{ + struct intel_pagefault_buffer *faults = + anv_device_alloc_get_vm_faults(device); + + if (!faults) + return; + + for (unsigned i = 0; i < faults->size; ++i) { + mesa_loge("[GPU-VM-FAULT] Page Address: 0x%016"PRIx64", " + "Page Size: 0x%04x, Access: %s, Type: %s, Level: %s", + faults->items[i].address, faults->items[i].precision, + intel_pagefault_access_to_string(faults->items[i].access), + intel_pagefault_type_to_string(faults->items[i].type), + intel_pagefault_level_to_string(faults->items[i].level)); + } + + free(faults); +} + void anv_device_update_fault_state(struct anv_device *device, int device_errno) @@ -29,6 +50,8 @@ anv_queue_update_fault_state(struct anv_queue *queue, assert(queue_errno != 0); struct anv_device *device = queue->device; + bool print_vm_faults = false; + mtx_lock(&device->fault.mutex); struct anv_device_fault_state *state = &device->fault.state; @@ -39,7 +62,11 @@ anv_queue_update_fault_state(struct anv_queue *queue, state->queue.family = queue->vk.queue_family_index; state->queue.index = queue->vk.index_in_family; state->queue.flags = queue->vk.flags; + print_vm_faults = queue_errno == ECANCELED; } mtx_unlock(&device->fault.mutex); + + if (print_vm_faults) + anv_device_print_vm_faults(device); }