[Mesa-dev] [PATCH 3/3] radv: report VM faults if detected

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Aug 31 21:12:58 UTC 2017


This series is:

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

Awesome to see this implemented!

On Thu, Aug 31, 2017, at 11:44, Samuel Pitoiset wrote:
> It's fairly simple for now, but this might be quite useful.
> 
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_debug.c   | 13 +++++++++++++
>  src/amd/vulkan/radv_private.h |  3 +++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c
> index 4024f75da8..949eeea2f3 100644
> --- a/src/amd/vulkan/radv_debug.c
> +++ b/src/amd/vulkan/radv_debug.c
> @@ -28,6 +28,7 @@
>  #include <stdlib.h>
>  #include <stdio.h>
>  
> +#include "ac_debug.h"
>  #include "radv_debug.h"
>  
>  bool
> @@ -44,6 +45,9 @@ radv_init_trace(struct radv_device *device)
>  	if (!device->trace_id_ptr)
>  		return false;
>  
> +       ac_vm_fault_occured(device->physical_device->rad_info.chip_class,
> +                           &device->dmesg_timestamp, NULL);
> +
>  	return true;
>  }
>  
> @@ -80,9 +84,18 @@ radv_gpu_hang_occured(struct radv_queue *queue)
>  void
>  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))
>  		return;
>  
> +       if
> (ac_vm_fault_occured(device->physical_device->rad_info.chip_class,
> +                               &device->dmesg_timestamp, &addr)) {
> +               fprintf(stderr, "VM fault report.\n\n");
> +               fprintf(stderr, "Failing VM page: 0x%08"PRIx64"\n\n",
> addr);
> +       }
> +
>  	radv_dump_trace(queue->device, cs);
>  	abort();
>  }
> diff --git a/src/amd/vulkan/radv_private.h
> b/src/amd/vulkan/radv_private.h
> index 73f7bdbe8a..28e70e6915 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -555,6 +555,9 @@ struct radv_device {
>  	uint32_t fmask_mrt_offset_counter;
>  	struct list_head shader_slabs;
>  	mtx_t shader_slab_mutex;
> +
> +       /* For detecting VM faults reported by dmesg. */
> +       uint64_t dmesg_timestamp;
>  };
>  
>  struct radv_device_memory {
> -- 
> 2.14.1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list