[Mesa-dev] [PATCH] radv: Actually check for vm faults.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Sep 7 20:23:03 UTC 2017


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.
---
 src/amd/vulkan/radv_debug.c  | 10 +++++++---
 src/amd/vulkan/radv_debug.h  |  1 +
 src/amd/vulkan/radv_device.c |  1 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c
index 949eeea2f36..4b70c8a141c 100644
--- a/src/amd/vulkan/radv_debug.c
+++ b/src/amd/vulkan/radv_debug.c
@@ -87,11 +87,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);
 	}
diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h
index 240ce162047..18ef7e7e0a8 100644
--- a/src/amd/vulkan/radv_debug.h
+++ b/src/amd/vulkan/radv_debug.h
@@ -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 {
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index bf7552e63da..4f4fa20209b 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -410,6 +410,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}
 };
 
-- 
2.14.1



More information about the mesa-dev mailing list