[PATCH 3/3] drm/xe: Warn on NULL job when user fence used in xe_sync_entry_signal

Matthew Auld matthew.auld at intel.com
Thu Mar 14 10:53:20 UTC 2024


On 14/03/2024 09:54, Nirmoy Das wrote:
> Added a check and warn for NULL job when sync->type is
> DRM_XE_SYNC_TYPE_USER_FENCE to prevent potential crashes
> and aid in debugging
> 
> Cc: Matthew Auld <matthew.auld at intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_sync.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
> index 02c9577fe418..fae466ba8e75 100644
> --- a/drivers/gpu/drm/xe/xe_sync.c
> +++ b/drivers/gpu/drm/xe/xe_sync.c
> @@ -255,9 +255,13 @@ void xe_sync_entry_signal(struct xe_sync_entry *sync, struct xe_sched_job *job,
>   			dma_fence_put(fence);
>   		}
>   	} else if (sync->type == DRM_XE_SYNC_TYPE_USER_FENCE) {
> -		job->user_fence.used = true;
> -		job->user_fence.addr = sync->addr;
> -		job->user_fence.value = sync->timeline_value;
> +		if (job) {
> +			job->user_fence.used = true;
> +			job->user_fence.addr = sync->addr;
> +			job->user_fence.value = sync->timeline_value;
> +		} else {
> +			XE_WARN_ON("NULL job passed with DRM_XE_SYNC_TYPE_USER_FENCE");

Just wondering if it might be better to just let it crash if that ever 
happens? Assumption is that it's impossible and would be programmer error.

Matt, any thoughts here?

> +		}
>   	}
>   }
>   


More information about the Intel-xe mailing list