From: Steev Klimaszewski <steev@kali.org>
To: Rob Clark <robdclark@gmail.com>, dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
"Rob Clark" <robdclark@chromium.org>,
"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
"Sean Paul" <sean@poorly.run>, "David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Akhil P Oommen" <quic_akhilpo@quicinc.com>,
"Jonathan Marek" <jonathan@marek.ca>,
"Christian König" <christian.koenig@amd.com>,
"Dan Carpenter" <dan.carpenter@oracle.com>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] drm/msm: Don't overwrite hw fence in hw_init
Date: Wed, 15 Jun 2022 13:03:24 -0500 [thread overview]
Message-ID: <9ff7adc6-570f-8089-c93d-b10fcafc02b6@kali.org> (raw)
In-Reply-To: <20220615150107.2969593-2-robdclark@gmail.com>
On 6/15/22 10:01 AM, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
>
> Prior to the last commit, this could result in setting the GPU
> written fence value back to an older value, if we had missed
> updating completed_fence prior to suspend. This was mostly
> harmless as the GPU would eventually overwrite it again with
> the correct value. But we should just not do this. Instead
> just leave a sanity check that the fence looks plausible (in
> case the GPU scribbled on memory).
>
> Reported-by: Steev Klimaszewski <steev@kali.org>
> Fixes: 95d1deb02a9c ("drm/msm/gem: Add fenced vma unpin")
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> ---
> drivers/gpu/drm/msm/adreno/adreno_gpu.c | 11 ++++++++---
> drivers/gpu/drm/msm/msm_gpu.c | 2 +-
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index e1aef4875e2f..dd044d557c7c 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -498,10 +498,15 @@ int adreno_hw_init(struct msm_gpu *gpu)
>
> ring->cur = ring->start;
> ring->next = ring->start;
> -
> - /* reset completed fence seqno: */
> - ring->memptrs->fence = ring->fctx->completed_fence;
> ring->memptrs->rptr = 0;
> +
> + /* Detect and clean up an impossible fence, ie. if GPU managed
> + * to scribble something invalid, we don't want that to confuse
> + * us into mistakingly believing that submits have completed.
> + */
> + if (fence_before(ring->fctx->last_fence, ring->memptrs->fence)) {
> + ring->memptrs->fence = ring->fctx->last_fence;
> + }
> }
>
> return 0;
> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> index b61078f0cd0f..8c00f9187c03 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.c
> +++ b/drivers/gpu/drm/msm/msm_gpu.c
> @@ -430,7 +430,7 @@ static void recover_worker(struct kthread_work *work)
> * one more to clear the faulting submit
> */
> if (ring == cur_ring)
> - fence++;
> + ring->memptrs->fence = ++fence;
>
> msm_update_fence(ring->fctx, fence);
> }
Tested on the Lenovo Yoga C630
Tested-by: Steev Klimaszewski <steev@kali.org>
next prev parent reply other threads:[~2022-06-15 18:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-15 15:01 [PATCH 1/2] drm/msm: Drop update_fences() Rob Clark
2022-06-15 15:01 ` [PATCH 2/2] drm/msm: Don't overwrite hw fence in hw_init Rob Clark
2022-06-15 18:03 ` Steev Klimaszewski [this message]
2022-06-15 18:03 ` [PATCH 1/2] drm/msm: Drop update_fences() Steev Klimaszewski
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=9ff7adc6-570f-8089-c93d-b10fcafc02b6@kali.org \
--to=steev@kali.org \
--cc=airlied@linux.ie \
--cc=christian.koenig@amd.com \
--cc=dan.carpenter@oracle.com \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jonathan@marek.ca \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_akhilpo@quicinc.com \
--cc=robdclark@chromium.org \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
/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
all inboxes | Powered by JetHome®