From: Vladimir Lypak <vladimir.lypak@gmail.com>
To: Akhil P Oommen <quic_akhilpo@quicinc.com>
Cc: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Jordan Crouse <jordan@cosmicpenguin.net>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] drm/msm/a5xx: properly clear preemption records on resume
Date: Fri, 2 Aug 2024 13:41:32 +0000 [thread overview]
Message-ID: <ZqziDJlrhvSnijpw@trashcan> (raw)
In-Reply-To: <20240801131610.jtcpo5l2gd34uqbf@hu-akhilpo-hyd.qualcomm.com>
On Thu, Aug 01, 2024 at 06:46:10PM +0530, Akhil P Oommen wrote:
> On Thu, Jul 11, 2024 at 10:00:19AM +0000, Vladimir Lypak wrote:
> > Two fields of preempt_record which are used by CP aren't reset on
> > resume: "data" and "info". This is the reason behind faults which happen
> > when we try to switch to the ring that was active last before suspend.
> > In addition those faults can't be recovered from because we use suspend
> > and resume to do so (keeping values of those fields again).
> >
> > Fixes: b1fc2839d2f9 ("drm/msm: Implement preemption for A5XX targets")
> > Signed-off-by: Vladimir Lypak <vladimir.lypak@gmail.com>
> > ---
> > drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c
> > index f58dd564d122..67a8ef4adf6b 100644
> > --- a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c
> > +++ b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c
> > @@ -204,6 +204,8 @@ void a5xx_preempt_hw_init(struct msm_gpu *gpu)
> > return;
> >
> > for (i = 0; i < gpu->nr_rings; i++) {
> > + a5xx_gpu->preempt[i]->data = 0;
> > + a5xx_gpu->preempt[i]->info = 0;
>
> I don't see this bit in the downstream driver. Just curious, do we need
> to clear both fields to avoid the gpu faults?
Downstream gets away without doing so because it resumes on the same
ring that it suspended on. On mainline we always do GPU resume on first
ring. It was enough to zero info field to avoid faults but clearing
both shouldn't hurt.
I have tried to replicate faults again with local preemption disabled
and unmodified mesa and couldn't do so. It only happens when fine-grain
preemption is used and there was a switch from IB1.
This made me come up with explanation of what could be happening.
If preemption switch is initiated on a some ring at checkpoint in IB1,
CP should save position of that checkpoint in the preemption record and
set some flag in "info" field which will tell it to continue from that
checkpoint when switching back.
When switching back to that ring we program address of its preemption
record to CP_CONTEXT_SWITCH_RESTORE_ADDR. Apparently this won't remove
the flag from "info" field because the preemption record is only being
read from. This leaves preemption record outdated on that ring until
next switch will override it. This doesn't cause issues on downstream
because it won't try to restore from that record since it's ignored
during GPU power-up.
Vladimir
>
> -Akhil
> > a5xx_gpu->preempt[i]->wptr = 0;
> > a5xx_gpu->preempt[i]->rptr = 0;
> > a5xx_gpu->preempt[i]->rbase = gpu->rb[i]->iova;
> > --
> > 2.45.2
> >
next prev parent reply other threads:[~2024-08-02 13:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 10:00 [PATCH 0/4] fixes for Adreno A5Xx preemption Vladimir Lypak
2024-07-11 10:00 ` [PATCH 1/4] drm/msm/a5xx: disable preemption in submits by default Vladimir Lypak
2024-07-15 21:00 ` Rob Clark
2024-08-01 12:38 ` Akhil P Oommen
2024-07-11 10:00 ` [PATCH 2/4] drm/msm/a5xx: properly clear preemption records on resume Vladimir Lypak
2024-07-11 10:42 ` Konrad Dybcio
2024-08-01 13:16 ` Akhil P Oommen
2024-08-02 13:41 ` Vladimir Lypak [this message]
2024-08-05 19:07 ` Akhil P Oommen
2024-07-11 10:00 ` [PATCH 3/4] drm/msm/a5xx: fix races in preemption evaluation stage Vladimir Lypak
2024-07-29 17:26 ` Connor Abbott
2024-08-01 12:22 ` Vladimir Lypak
2024-08-01 12:52 ` Connor Abbott
2024-08-01 14:23 ` Vladimir Lypak
2024-08-01 15:57 ` Connor Abbott
2024-08-05 19:29 ` Akhil P Oommen
2024-07-11 10:00 ` [PATCH 4/4] drm/msm/a5xx: workaround early ring-buffer emptiness check Vladimir Lypak
2024-08-05 19:58 ` Akhil P Oommen
2024-07-17 9:40 ` [PATCH 0/4] fixes for Adreno A5Xx preemption Connor Abbott
2024-07-17 16:31 ` Vladimir Lypak
2024-07-17 17:52 ` Connor Abbott
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=ZqziDJlrhvSnijpw@trashcan \
--to=vladimir.lypak@gmail.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jordan@cosmicpenguin.net \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_akhilpo@quicinc.com \
--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