[Intel-gfx] [PATCH 04/15] drm/panfrost: Shrink sched_lock

Boris Brezillon boris.brezillon at collabora.com
Wed Jun 23 16:52:50 UTC 2021


On Tue, 22 Jun 2021 18:55:00 +0200
Daniel Vetter <daniel.vetter at ffwll.ch> wrote:

> drm/scheduler requires a lock between _init and _push_job, but the
> reservation lock dance doesn't. So shrink the critical section a
> notch.
> 
> v2: Lucas pointed out how this should really work, I got it all wrong
> in v1.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> Cc: Lucas Stach <l.stach at pengutronix.de>
> Cc: Rob Herring <robh at kernel.org>
> Cc: Tomeu Vizoso <tomeu.vizoso at collabora.com>
> Cc: Steven Price <steven.price at arm.com>
> Cc: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>

> ---
>  drivers/gpu/drm/panfrost/panfrost_job.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
> index 2df3e999a38d..38f8580c19f1 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_job.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_job.c
> @@ -224,14 +224,13 @@ int panfrost_job_push(struct panfrost_job *job)
>  	struct ww_acquire_ctx acquire_ctx;
>  	int ret = 0;
>  
> -	mutex_lock(&pfdev->sched_lock);
>  
>  	ret = drm_gem_lock_reservations(job->bos, job->bo_count,
>  					    &acquire_ctx);
> -	if (ret) {
> -		mutex_unlock(&pfdev->sched_lock);
> +	if (ret)
>  		return ret;
> -	}
> +
> +	mutex_lock(&pfdev->sched_lock);
>  
>  	ret = drm_sched_job_init(&job->base, entity, NULL);
>  	if (ret) {



More information about the Intel-gfx mailing list