[PATCH] drm/xe: Only check last fence on user binds

Cavitt, Jonathan jonathan.cavitt at intel.com
Mon Aug 5 20:55:07 UTC 2024


-----Original Message-----
From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of Matthew Brost
Sent: Monday, August 5, 2024 1:03 PM
To: intel-xe at lists.freedesktop.org
Cc: Dugast, Francois <francois.dugast at intel.com>
Subject: [PATCH] drm/xe: Only check last fence on user binds
> 
> We only set the last fence on user binds, so no need to check last fence
> kernel issued binds. Will avoid blowing up last fence lockdep asserts.
> 
> Cc: Francois Dugast <francois.dugast at intel.com>
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_pt.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> index 97a6a0b0b8ba..579ed31b46db 100644
> --- a/drivers/gpu/drm/xe/xe_pt.c
> +++ b/drivers/gpu/drm/xe/xe_pt.c
> @@ -1149,10 +1149,12 @@ static int xe_pt_vm_dependencies(struct xe_sched_job *job,
>  			return err;
>  	}
>  
> -	if (job)
> -		err = xe_sched_job_last_fence_add_dep(job, vm);
> -	else
> -		err = xe_exec_queue_last_fence_test_dep(pt_update_ops->q, vm);
> +	if (!(pt_update_ops->q->flags & EXEC_QUEUE_FLAG_KERNEL)) {
> +		if (job)
> +			err = xe_sched_job_last_fence_add_dep(job, vm);
> +		else
> +			err = xe_exec_queue_last_fence_test_dep(pt_update_ops->q, vm);
> +	}

Non-blocking suggestion: this looks like it can be inlined as such:

        if (!(pt_update_ops->q->flags & EXEC_QUEUE_FLAG_KERNEL))
                err = job ? xe_sched_job_last_fence_add_dep(job, vm) :
                         xe_exec_queue_last_fence_test_dep(pt_update_ops->q, vm);

I think this is just a matter of preference, though.  The explicit if-else
block is definitely clearer.
Reviewed-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
-Jonathan Cavitt

>  
>  	for (i = 0; job && !err && i < vops->num_syncs; i++)
>  		err = xe_sync_entry_add_deps(&vops->syncs[i], job);
> -- 
> 2.34.1
> 
> 


More information about the Intel-xe mailing list