radv: Actually check for vm faults.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 7 Sep 2017 20:12:50 +0000 (22:12 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 9 Sep 2017 09:50:30 +0000 (11:50 +0200)
The code can check for vm faults having happened. If we only do it
on a hang we don't know when the faults happened. This changes the
behavior to when the first VM faults is found, even without a hang.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_debug.c
src/amd/vulkan/radv_debug.h
src/amd/vulkan/radv_device.c

index a1c0a6199793877f2116afad4914d05a13ad8396..d52ba5d86d82444aef1ff805ea5fe034649e797d 100644 (file)
@@ -88,11 +88,15 @@ radv_check_gpu_hangs(struct radv_queue *queue, struct radeon_winsys_cs *cs)
        struct radv_device *device = queue->device;
        uint64_t addr;
 
-       if (!radv_gpu_hang_occured(queue))
+       bool hang_occurred = radv_gpu_hang_occured(queue);
+       bool vm_fault_occurred = false;
+       if (queue->device->instance->debug_flags & RADV_DEBUG_VM_FAULTS)
+               vm_fault_occurred = ac_vm_fault_occured(device->physical_device->rad_info.chip_class,
+                                                       &device->dmesg_timestamp, &addr);
+       if (!hang_occurred && !vm_fault_occurred)
                return;
 
-       if (ac_vm_fault_occured(device->physical_device->rad_info.chip_class,
-                               &device->dmesg_timestamp, &addr)) {
+       if (vm_fault_occurred) {
                fprintf(stderr, "VM fault report.\n\n");
                fprintf(stderr, "Failing VM page: 0x%08"PRIx64"\n\n", addr);
        }
index 240ce162047c5f7ccd6521cec8b4ed1a4040fb29..18ef7e7e0a8e9a5b3cb04da70ce9617911138105 100644 (file)
@@ -38,6 +38,7 @@ enum {
        RADV_DEBUG_ALL_BOS           = 0x100,
        RADV_DEBUG_NO_IBS            = 0x200,
        RADV_DEBUG_DUMP_SPIRV        = 0x400,
+       RADV_DEBUG_VM_FAULTS         = 0x800,
 };
 
 enum {
index d220eb596d640e097fbe07c8178d2510b95309f5..a68278ff4396c4c5a2e14ec386cd3c74a4d41df6 100644 (file)
@@ -411,6 +411,7 @@ static const struct debug_control radv_debug_options[] = {
        {"allbos", RADV_DEBUG_ALL_BOS},
        {"noibs", RADV_DEBUG_NO_IBS},
        {"spirv", RADV_DEBUG_DUMP_SPIRV},
+       {"vmfaults", RADV_DEBUG_VM_FAULTS},
        {NULL, 0}
 };