From: "Koenig, Christian" Subject: Re: [PATCH] drm/amdgpu/gmc10: apply the 'invalidation from sdma' workaround for navi Date: Thu, 26 Sep 2019 18:02:23 +0000 Message-ID: <6c2ee5a6-8283-4b36-9177-36ddb22a60ad@email.android.com> References: <93f9508c-2871-4d48-9407-a0c3a6525bab@email.android.com>, Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1396212037==" Return-path: In-Reply-To: Content-Language: de-DE List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "amd-gfx" To: "Yuan, Xiaojie" Cc: Alex Deucher , "Deucher, Alexander" , "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" --===============1396212037== Content-Language: de-DE Content-Type: multipart/alternative; boundary="_000_6c2ee5a682834b36917736ddb22a60ademailandroidcom_" --_000_6c2ee5a682834b36917736ddb22a60ademailandroidcom_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Well then you didn't figured out the root cause correctly. This is to avoid data corruption with the SDMA on Navi 10/14 and should def= initely not applied to Navi 12. The hardware team went through quite some work to avoid this. Christian. Am 26.09.2019 19:38 schrieb "Yuan, Xiaojie" : Hi Alex / Christian, When gfxoff is enabled for Navi12, I observed sdma0 hang while launching de= sktop. When this workaround is applied, the issue fades away. That's why I included this workaround for Navi12 as well. BR, Xiaojie ________________________________ From: Koenig, Christian Sent: Thursday, September 26, 2019 10:20 PM To: Alex Deucher Cc: Deucher, Alexander ; Yuan, Xiaojie ; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Subject: Re: [PATCH] drm/amdgpu/gmc10: apply the 'invalidation from sdma' w= orkaround for navi Am 26.09.2019 15:51 schrieb Alex Deucher : On Thu, Sep 26, 2019 at 9:47 AM Koenig, Christian wrote: > > Am 26.09.19 um 15:40 schrieb Alex Deucher: > > On Thu, Sep 26, 2019 at 8:29 AM Christian K=F6nig > > wrote: > >> Stop, wait a second guys! > >> > >> This will disable the workaround for Navi10 and that is certainly not = correct: > >> > >> !(adev->asic_type >=3D CHIP_NAVI10 && adev->asic_type <=3D CHIP_NAVI12= ) > >> > > Actually, I think it's correct. When I merged the baco patch, I > > accidentally dropped the navi checks. E.g., > > @@ -245,8 +245,9 @@ static void gmc_v10_0_flush_gpu_tlb(struct > > amdgpu_device *adev, > > mutex_lock(&adev->mman.gtt_window_lock); > > > > gmc_v10_0_flush_vm_hub(adev, vmid, AMDGPU_MMHUB, 0); > > - if (!adev->mman.buffer_funcs_enabled || !adev->ib_pool_ready || > > - adev->asic_type !=3D CHIP_NAVI10) { > > + if (!adev->mman.buffer_funcs_enabled || > > + !adev->ib_pool_ready || > > + adev->in_gpu_reset) { > > gmc_v10_0_flush_vm_hub(adev, vmid, AMDGPU_GFXHUB, 0); > > mutex_unlock(&adev->mman.gtt_window_lock); > > return; > > I think it should have been > > adev->asic_type !=3D CHIP_NAVI10 && adev->asic_type !=3D CHIP_NAVI14 && > > adev->asic_type !=3D CHIP_NAVI12 > > My last status is that Navi12 is not supposed to need that workaround, > that's why we checked Navi10 and later Navi14 separately. > > It's possible that I miss-read the !(adev->asic_type >=3D CHIP_NAVI10 && > adev->asic_type <=3D CHIP_NAVI12) check here, but either way that looks t= o > complicated to me. > > We should rather mention every affected asic type separately here. Good point. navi12 should be dropped from the check. How about the follow= ing? I would rather test explicitly for Navi 10 and 14, cause we can't be sure i= f there won't be another variant in the future. Christian. diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c index 241a4e57cf4a..280bbd7ca8a0 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c @@ -292,7 +292,8 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, if (!adev->mman.buffer_funcs_enabled || !adev->ib_pool_ready || - adev->in_gpu_reset) { + adev->in_gpu_reset || + (adev->asic_type =3D=3D CHIP_NAVI12)) { gmc_v10_0_flush_vm_hub(adev, vmid, AMDGPU_GFXHUB_0, 0); mutex_unlock(&adev->mman.gtt_window_lock); return; Alex > > Regards, > Christian. > > > > > Alex > > > >> Christian. > >> > >> > >> Am 26.09.19 um 14:26 schrieb Deucher, Alexander: > >> > >> Please add a patch description. With that fixed: > >> Reviewed-by: Alex Deucher > >> ________________________________ > >> From: amd-gfx on behalf of Yua= n, Xiaojie > >> Sent: Thursday, September 26, 2019 4:09 AM > >> To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org > >> Cc: alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > >> Subject: Re: [PATCH] drm/amdgpu/gmc10: apply the 'invalidation from sd= ma' workaround for navi > >> > >> Hi Alex, > >> > >> This patch is to add the asic_type check which is missing after drm-ne= xt branch rebase. > >> > >> BR, > >> Xiaojie > >> ________________________________ > >> From: Yuan, Xiaojie > >> Sent: Thursday, September 26, 2019 4:08 PM > >> To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org > >> Cc: alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org ; Yuan, Xiaojie > >> Subject: [PATCH] drm/amdgpu/gmc10: apply the 'invalidation from sdma' = workaround for navi > >> > >> Fixes: 767acabdac81 ("drm/amd/powerplay: add baco smu reset function f= or smu11") > >> Signed-off-by: Xiaojie Yuan > >> --- > >> drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 1 + > >> 1 file changed, 1 insertion(+) > >> > >> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/= amd/amdgpu/gmc_v10_0.c > >> index cb3f61873baa..dc2e68e019eb 100644 > >> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c > >> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c > >> @@ -292,6 +292,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_= device *adev, uint32_t vmid, > >> > >> if (!adev->mman.buffer_funcs_enabled || > >> !adev->ib_pool_ready || > >> + !(adev->asic_type >=3D CHIP_NAVI10 && adev->asic_type <=3D= CHIP_NAVI12) || > >> adev->in_gpu_reset) { > >> gmc_v10_0_flush_vm_hub(adev, vmid, AMDGPU_GFXHUB_0, = 0); > >> mutex_unlock(&adev->mman.gtt_window_lock); > >> -- > >> 2.20.1 > >> > >> > >> _______________________________________________ > >> amd-gfx mailing list > >> amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org > >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx > >> > >> > --_000_6c2ee5a682834b36917736ddb22a60ademailandroidcom_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Well then you didn't figured out the root cause correctly= .

This is to avoid data corruption with the SDMA on Navi 10= /14 and should definitely not applied to Navi 12.

The hardware team went through quite some work to avoid t= his.

Christian.

Am 26.09.2019 19:38 schrieb "Yuan, Xiaojie&= quot; <Xiaojie.Yuan-5C7GfCeVMHo@public.gmane.org>:
 Hi Alex / Christian,

When gfxoff is enabled for Navi12, I observed sdma0 hang while launching de= sktop. When this workaround is applied, the issue fades away.
That's why I included this workaround for Navi12 as well.

BR,
Xiaojie

From: Koenig, Christian <= ;Christian.Koenig-5C7GfCeVMHo@public.gmane.org>
Sent: Thursday, September 26, 2019 10:20 PM
To: Alex Deucher <alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Deucher, Alexander <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>; Yuan, Xiao= jie <Xiaojie.Yuan-5C7GfCeVMHo@public.gmane.org>; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <amd-gfx= @lists.freedesktop.org>
Subject: Re: [PATCH] drm/amdgpu/gmc10: apply the 'invalidation from = sdma' workaround for navi
 


Am 26.09.2019 15:51 schrieb Alex Deucher <a= lexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
On Thu, Sep 26, 2019 at 9:47 AM Koenig, Christian
<Christian.Koenig-5C7GfCeVMHo@public.gmane.org> wrote:
>
> Am 26.09.19 um 15:40 schrieb Alex Deucher:
> > On Thu, Sep 26, 2019 at 8:29 AM Christian K=F6nig
> > <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >> Stop, wait a second guys!
> >>
> >> This will disable the workaround for Navi10 and that is certa= inly not correct:
> >>
> >> !(adev->asic_type >=3D CHIP_NAVI10 && adev->= asic_type <=3D CHIP_NAVI12)
> >>
> > Actually, I think it's correct. When I merged the baco patch, I > > accidentally dropped the navi checks.  E.g.,
> > @@ -245,8 +245,9 @@ static void gmc_v10_0_flush_gpu_tlb(struc= t
> > amdgpu_device *adev,
> >          mutex_lock(= &adev->mman.gtt_window_lock);
> >
> >          gmc_v10_0_f= lush_vm_hub(adev, vmid, AMDGPU_MMHUB, 0);
> > -       if (!adev->mman.buffer_f= uncs_enabled || !adev->ib_pool_ready ||
> > -           ade= v->asic_type !=3D CHIP_NAVI10) {
> > +       if (!adev->mman.buff= er_funcs_enabled ||
> > +          = !adev->ib_pool_ready ||
> > +          = adev->in_gpu_reset) {
> >           =        gmc_v10_0_flush_vm_hub(adev, vmid, AMD= GPU_GFXHUB, 0);
> >           =        mutex_unlock(&adev->mman.gtt_wi= ndow_lock);
> >           =        return;
> > I think it should have been
> > adev->asic_type !=3D CHIP_NAVI10 && adev->asic_type= !=3D CHIP_NAVI14 &&
> > adev->asic_type !=3D CHIP_NAVI12
>
> My last status is that Navi12 is not supposed to need that workaround,=
> that's why we checked Navi10 and later Navi14 separately.
>
> It's possible that I miss-read the !(adev->asic_type >=3D CHIP_N= AVI10 &&
> adev->asic_type <=3D CHIP_NAVI12) check here, but either way tha= t looks to
> complicated to me.
>
> We should rather mention every affected asic type separately here.

Good point.  navi12 should be dropped from the check.  How about = the following?

I would rather test explicitly for Navi 10 and 14, cause = we can't be sure if there won't be another variant in the future.

Christian.


diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 241a4e57cf4a..280bbd7ca8a0 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -292,7 +292,8 @@ static void gmc_v10_0_flush_gpu_tlb(struct
amdgpu_device *adev, uint32_t vmid,

        if (!adev->mman.buffer_funcs_= enabled ||
            !adev-&g= t;ib_pool_ready ||
-           adev->in_g= pu_reset) {
+           adev->= in_gpu_reset ||
+           (adev->= ;asic_type =3D=3D CHIP_NAVI12)) {
            &nb= sp;   gmc_v10_0_flush_vm_hub(adev, vmid, AMDGPU_GFXHUB_0, 0);
            &nb= sp;   mutex_unlock(&adev->mman.gtt_window_lock);
            &nb= sp;   return;

Alex

>
> Regards,
> Christian.
>
> >
> > Alex
> >
> >> Christian.
> >>
> >>
> >> Am 26.09.19 um 14:26 schrieb Deucher, Alexander:
> >>
> >> Please add a patch description.  With that fixed:
> >> Reviewed-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org> > >> ________________________________
> >> From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> o= n behalf of Yuan, Xiaojie <Xiaojie.Yuan-5C7GfCeVMHo@public.gmane.org>
> >> Sent: Thursday, September 26, 2019 4:09 AM
> >> To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <amd-gfx-PD4FTy7X32nrcLQh/DF6ew@public.gmane.org= op.org>
> >> Cc: alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >> Subject: Re: [PATCH] drm/amdgpu/gmc10: apply the 'invalidatio= n from sdma' workaround for navi
> >>
> >> Hi Alex,
> >>
> >> This patch is to add the asic_type check which is missing aft= er drm-next branch rebase.
> >>
> >> BR,
> >> Xiaojie
> >> ________________________________
> >> From: Yuan, Xiaojie <Xiaojie.Yuan-5C7GfCeVMHo@public.gmane.org>
> >> Sent: Thursday, September 26, 2019 4:08 PM
> >> To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <amd-gfx-PD4FTy7X32nrcLQh/DF6ew@public.gmane.org= op.org>
> >> Cc: alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>; Yuan= , Xiaojie <Xiaojie.Yuan-5C7GfCeVMHo@public.gmane.org>
> >> Subject: [PATCH] drm/amdgpu/gmc10: apply the 'invalidation fr= om sdma' workaround for navi
> >>
> >> Fixes: 767acabdac81 ("drm/amd/powerplay: add baco smu re= set function for smu11")
> >> Signed-off-by: Xiaojie Yuan <xiaojie.yuan-5C7GfCeVMHo@public.gmane.org>
> >> ---
> >>   drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 1 +<= br> > >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers= /gpu/drm/amd/amdgpu/gmc_v10_0.c
> >> index cb3f61873baa..dc2e68e019eb 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> >> @@ -292,6 +292,7 @@ static void gmc_v10_0_flush_gpu_tlb(s= truct amdgpu_device *adev, uint32_t vmid,
> >>
> >>           i= f (!adev->mman.buffer_funcs_enabled ||
> >>          &n= bsp;    !adev->ib_pool_ready ||
> >> +         &n= bsp; !(adev->asic_type >=3D CHIP_NAVI10 && adev->asic_type= <=3D CHIP_NAVI12) ||
> >>          &n= bsp;    adev->in_gpu_reset) {
> >>          &n= bsp;        gmc_v10_0_flush_vm_hub(adev,= vmid, AMDGPU_GFXHUB_0, 0);
> >>          &n= bsp;        mutex_unlock(&adev->m= man.gtt_window_lock);
> >> --
> >> 2.20.1
> >>
> >>
> >> _______________________________________________
> >> amd-gfx mailing list
> >> amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> >>
> >>
>

--_000_6c2ee5a682834b36917736ddb22a60ademailandroidcom_-- --===============1396212037== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYW1kLWdmeCBt YWlsaW5nIGxpc3QKYW1kLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9hbWQtZ2Z4 --===============1396212037==--