[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230906095730.27cb394f@collabora.com>
Date: Wed, 6 Sep 2023 09:57:30 +0200
From: Boris Brezillon <boris.brezillon@...labora.com>
To: Adrián Larumbe <adrian.larumbe@...labora.com>
Cc: maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
tzimmermann@...e.de, airlied@...il.com, daniel@...ll.ch,
robdclark@...il.com, quic_abhinavk@...cinc.com,
dmitry.baryshkov@...aro.org, sean@...rly.run,
marijn.suijten@...ainline.org, robh@...nel.org,
steven.price@....com, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
healych@...zon.com, kernel@...labora.com,
freedreno@...ts.freedesktop.org
Subject: Re: [PATCH v3 2/8] drm/panfrost: Enable cycle counter register upon
job submission
On Tue, 5 Sep 2023 19:45:18 +0100
Adrián Larumbe <adrian.larumbe@...labora.com> wrote:
> diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
> index 033f5e684707..8b1bf6ac48f8 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_job.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_job.c
> @@ -297,6 +297,11 @@ int panfrost_job_push(struct panfrost_job *job)
>
> kref_get(&job->refcount); /* put by scheduler job completion */
>
> + if (atomic_read(&pfdev->profile_mode)) {
> + panfrost_cycle_counter_get(pfdev);
This one should go in panfrost_job_hw_submit() IMO, otherwise you're
enabling the cycle-counter before the job has its dependencies met, and
depending on what the job depends on, it might take some time.
> + job->is_profiled = true;
> + }
> +
> drm_sched_entity_push_job(&job->base);
>
> mutex_unlock(&pfdev->sched_lock);
> @@ -351,6 +356,9 @@ static void panfrost_job_free(struct drm_sched_job *sched_job)
>
> drm_sched_job_cleanup(sched_job);
>
> + if (job->is_profiled)
> + panfrost_cycle_counter_put(job->pfdev);
I think I'd move this panfrost_cycle_counter_put() to
panfrost_job_handle_{err,done}(), to release the counter as soon as
we're done executing the job. We also need to make sure we release
cycle counter refs in the reset path (here [1]), to keep get/put
balanced when jobs are resubmitted.
> +
> panfrost_job_put(job);
> }
[1]https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/panfrost/panfrost_job.c#L666
Powered by blists - more mailing lists