[Intel-xe] [PATCH 1/4] drm/xe: Add uapi for dumpable bos

Souza, Jose jose.souza at intel.com
Mon Nov 13 21:41:11 UTC 2023


On Tue, 2023-10-24 at 14:22 +0200, Maarten at mblankhorst.nl wrote:
> From: Maarten Lankhorst <dev at lankhorst.se>
> 
> Add the flag XE_VM_BIND_FLAG_DUMPABLE to notify devcoredump that this
> mapping should be dumped.
> 
> This is not hooked up, but the uapi should be ready before merging.
> 
> It's likely easier to dump the contents of the bo's at devcoredump
> readout time, so it's better if the bos will stay unmodified after
> a hang. The NEEDS_CPU_MAPPING flag is removed as requirement.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> ---
>  drivers/gpu/drm/xe/xe_vm.c | 11 ++++++++---
>  include/uapi/drm/xe_drm.h  |  4 ++++
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 498c0b3e1d73..dca03d8ad98e 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -2819,12 +2819,12 @@ static int vm_bind_ioctl_ops_execute(struct xe_vm *vm,
>  #define SUPPORTED_FLAGS	\
>  	(FORCE_ASYNC_OP_ERROR | XE_VM_BIND_FLAG_ASYNC | \
>  	 XE_VM_BIND_FLAG_READONLY | XE_VM_BIND_FLAG_IMMEDIATE | \
> -	 XE_VM_BIND_FLAG_NULL | 0xffff)
> +	 XE_VM_BIND_FLAG_NULL | XE_VM_BIND_FLAG_DUMPABLE | 0xffff)
>  #else
>  #define SUPPORTED_FLAGS	\
>  	(XE_VM_BIND_FLAG_ASYNC | XE_VM_BIND_FLAG_READONLY | \
>  	 XE_VM_BIND_FLAG_IMMEDIATE | XE_VM_BIND_FLAG_NULL | \
> -	 0xffff)
> +	 XE_VM_BIND_FLAG_DUMPABLE | 0xffff)
>  #endif
>  #define XE_64K_PAGE_MASK 0xffffull
>  
> @@ -3036,8 +3036,13 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>  		u32 obj = bind_ops[i].obj;
>  		u64 obj_offset = bind_ops[i].obj_offset;
>  
> -		if (!obj)
> +		if (!obj) {
> +			if (XE_IOCTL_DBG(xe, bind_ops[i].op & XE_VM_BIND_FLAG_DUMPABLE)) {

this will not allow dump user-ptr.

> +				err = -EINVAL;
> +				goto put_obj;
> +			}
>  			continue;
> +		}
>  
>  		gem_obj = drm_gem_object_lookup(file, obj);
>  		if (XE_IOCTL_DBG(xe, !gem_obj)) {
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index 24bf8f0f52e8..42f5eb95d30c 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -677,6 +677,10 @@ struct drm_xe_vm_bind_op {
>  	 * intended to implement VK sparse bindings.
>  	 */
>  #define XE_VM_BIND_FLAG_NULL		(0x1 << 3)
> +	/*
> +	 * dumpable -> contents are attempted to be included in devcoredumps.
> +	 */
> +#define XE_VM_BIND_FLAG_DUMPABLE        (0x1 << 4)
>  	/** @flags: Bind flags */
>  	__u32 flags;
>  



More information about the Intel-xe mailing list