From: Steven Price <steven.price@arm.com>
To: Rob Herring <robh@kernel.org>, dri-devel@lists.freedesktop.org
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Robin Murphy <robin.murphy@arm.com>,
David Airlie <airlied@linux.ie>,
Boris Brezillon <boris.brezillon@collabora.com>,
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
Sean Paul <sean@poorly.run>
Subject: Re: [PATCH v2 3/8] drm/panfrost: Hold runtime PM reference until jobs complete
Date: Fri, 23 Aug 2019 15:50:55 +0100 [thread overview]
Message-ID: <2d4febdb-4db8-7e69-7798-9fea67c1cc8e@arm.com> (raw)
In-Reply-To: <20190823021216.5862-4-robh@kernel.org>
On 23/08/2019 03:12, Rob Herring wrote:
> Doing a pm_runtime_put as soon as a job is submitted is wrong as it should
> not happen until the job completes. It works because we are relying on the
> autosuspend timeout to keep the h/w enabled.
>
> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Cc: Steven Price <steven.price@arm.com>
> Cc: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Rob Herring <robh@kernel.org>
Nice find, but I'm a bit worried about one thing.
> ---
> v2: new patch
>
> drivers/gpu/drm/panfrost/panfrost_job.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
> index 05c85f45a0de..80c9cab9a01b 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_job.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_job.c
> @@ -151,7 +151,7 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js)
> return;
>
> if (WARN_ON(job_read(pfdev, JS_COMMAND_NEXT(js))))
> - goto end;
> + return;
>
> cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu);
>
> @@ -187,10 +187,6 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js)
> job_write(pfdev, JS_COMMAND_NEXT(js), JS_COMMAND_START);
>
> spin_unlock_irqrestore(&pfdev->hwaccess_lock, flags);
> -
> -end:
> - pm_runtime_mark_last_busy(pfdev->dev);
> - pm_runtime_put_autosuspend(pfdev->dev);
> }
>
> static void panfrost_acquire_object_fences(struct drm_gem_object **bos,
> @@ -388,9 +384,13 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job)
>
> mutex_lock(&pfdev->reset_lock);
>
> - for (i = 0; i < NUM_JOB_SLOTS; i++)
> + for (i = 0; i < NUM_JOB_SLOTS; i++) {
> drm_sched_stop(&pfdev->js->queue[i].sched, sched_job);
> -
> + if (pfdev->jobs[i]) {
> + pm_runtime_put_noidle(pfdev->dev);
> + pfdev->jobs[i] = NULL;
I can't see what prevents this racing with panfrost_job_irq_handler() -
the job could be completing at the same time as we assign NULL. Then
panfrost_job_irq_handler() will happily dereference the NULL pointer...
Admittedly this patch is an improvement over the situation before :)
Steve
> + }
> + }
> if (sched_job)
> drm_sched_increase_karma(sched_job);
>
> @@ -455,7 +455,9 @@ static irqreturn_t panfrost_job_irq_handler(int irq, void *data)
> pfdev->jobs[j] = NULL;
> panfrost_mmu_as_put(pfdev, &job->file_priv->mmu);
> panfrost_devfreq_record_transition(pfdev, j);
> +
> dma_fence_signal(job->done_fence);
> + pm_runtime_put_autosuspend(pfdev->dev);
> }
>
> status &= ~mask;
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-08-23 14:50 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 2:12 (unknown) Rob Herring
2019-08-23 2:12 ` [PATCH v2 1/8] drm/panfrost: Fix possible suspend in panfrost_remove Rob Herring
2019-08-23 14:50 ` Steven Price
2019-08-23 2:12 ` [PATCH v2 2/8] drm/panfrost: Rework runtime PM initialization Rob Herring
2019-08-23 10:54 ` Robin Murphy
2019-08-23 12:16 ` Rob Herring
2019-08-23 2:12 ` [PATCH v2 3/8] drm/panfrost: Hold runtime PM reference until jobs complete Rob Herring
2019-08-23 14:50 ` Steven Price [this message]
2019-08-23 15:13 ` Rob Herring
2019-08-23 2:12 ` [PATCH v2 4/8] drm/shmem: Do dma_unmap_sg before purging pages Rob Herring
2019-08-23 2:12 ` [PATCH v2 5/8] drm/shmem: Use mutex_trylock in drm_gem_shmem_purge Rob Herring
2019-08-23 14:53 ` Steven Price
2019-08-23 2:12 ` [PATCH v2 6/8] drm/panfrost: Use mutex_trylock in panfrost_gem_purge Rob Herring
2019-08-23 14:55 ` Steven Price
2019-08-23 2:12 ` [PATCH v2 7/8] drm/panfrost: Rework page table flushing and runtime PM interaction Rob Herring
2019-08-23 11:11 ` Robin Murphy
2019-08-23 15:05 ` Steven Price
2019-08-23 15:44 ` Robin Murphy
2019-08-23 15:57 ` Rob Herring
2019-08-23 16:16 ` Robin Murphy
2019-08-23 16:45 ` Rob Herring
2019-08-23 15:09 ` Steven Price
2019-08-23 15:49 ` Rob Herring
2019-08-23 2:12 ` [PATCH v2 8/8] drm/panfrost: Remove unnecessary flushing from tlb_inv_context Rob Herring
2019-08-23 12:56 ` Robin Murphy
2019-08-23 13:18 ` Rob Herring
2019-08-23 14:05 ` Robin Murphy
2019-08-23 14:26 ` Rob Herring
2019-08-23 14:56 ` Robin Murphy
2019-08-23 15:12 ` Steven Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2d4febdb-4db8-7e69-7798-9fea67c1cc8e@arm.com \
--to=steven.price@arm.com \
--cc=airlied@linux.ie \
--cc=alyssa.rosenzweig@collabora.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=maxime.ripard@bootlin.com \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=sean@poorly.run \
--cc=tomeu.vizoso@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox