From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Christian_K=c3=b6nig?= Subject: Re: [PATCH 11/11] drm/amdgpu: stop removing BOs from the LRU during CS Date: Wed, 15 May 2019 16:16:29 +0200 Message-ID: <451e8757-b509-c0f7-eced-6ccedc45117b@gmail.com> References: <20190514123127.1650-1-christian.koenig@amd.com> <20190514123127.1650-11-christian.koenig@amd.com> <-vf7xt3-qgf5mz-veq8ih-okgxtz-9ehg3tx8dyemoidihe-fwj066fntvvx-x3y4nh-bn07hl-82anfo4oofx-4di7gg-3nkfhtbcgh58-yj9ws0-pthytc-oq9qcxd40s4g-249dv8-x6wbfujry6xi-mu2nvl.1557839540398@email.android.com> <-wsx1tz-kxfbz1yns7x33sra134gl11xhlux4lx3izissqr2httt4mb1vleyxgj8i7k6-q6ze8ub3ff8c4o0fxmx7niu76yg4-ybakue-3v14jw-ed5ol8ybh6o9-1ze886-hbstfi448pvq3pwhkj.1557844282594@email.android.com> Reply-To: christian.koenig-5C7GfCeVMHo@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2022690318==" Return-path: In-Reply-To: <-wsx1tz-kxfbz1yns7x33sra134gl11xhlux4lx3izissqr2httt4mb1vleyxgj8i7k6-q6ze8ub3ff8c4o0fxmx7niu76yg4-ybakue-3v14jw-ed5ol8ybh6o9-1ze886-hbstfi448pvq3pwhkj.1557844282594-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org> Content-Language: en-US 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: "Zhou, David(ChunMing)" , "Koenig, Christian" , "Olsak, Marek" , "Liang, Prike" , "dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" , "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" This is a multi-part message in MIME format. --===============2022690318== Content-Type: multipart/alternative; boundary="------------561008C46C49D0E900F6669C" Content-Language: en-US This is a multi-part message in MIME format. --------------561008C46C49D0E900F6669C Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit That is a good point, but actually not a problem in practice. See the change to ttm_eu_fence_buffer_objects: > -               ttm_bo_add_to_lru(bo); > +               if (list_empty(&bo->lru)) > +                       ttm_bo_add_to_lru(bo); > +               else > +                       ttm_bo_move_to_lru_tail(bo, NULL); We still move the BOs to the end of the LRU in the same order we have before, we just don't remove them when they are reserved. Regards, Christian. Am 14.05.19 um 16:31 schrieb Zhou, David(ChunMing): > how to refresh LRU to keep the order align with bo list passed from > user space? > > you can verify it by some games, performance could be different much > between multiple runnings. > > -David > > -------- Original Message -------- > Subject: Re: [PATCH 11/11] drm/amdgpu: stop removing BOs from the LRU > during CS > From: Christian König > To: "Zhou, David(ChunMing)" ,"Olsak, Marek" ,"Liang, Prike" > ,dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org > CC: > > [CAUTION: External Email] > Hui? What do you mean with that? > > Christian. > > Am 14.05.19 um 15:12 schrieb Zhou, David(ChunMing): >> my only concern is how to fresh LRU when bo is from bo list. >> >> -David >> >> -------- Original Message -------- >> Subject: [PATCH 11/11] drm/amdgpu: stop removing BOs from the LRU >> during CS >> From: Christian König >> To: "Olsak, Marek" ,"Zhou, David(ChunMing)" ,"Liang, Prike" >> ,dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org >> CC: >> >> [CAUTION: External Email] >> >> This avoids OOM situations when we have lots of threads >> submitting at the same time. >> >> Signed-off-by: Christian König >> --- >>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- >>  1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c >> index fff558cf385b..f9240a94217b 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c >> @@ -648,7 +648,7 @@ static int amdgpu_cs_parser_bos(struct >> amdgpu_cs_parser *p, >>         } >> >>         r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true, >> -                                  &duplicates, true); >> +                                  &duplicates, false); >>         if (unlikely(r != 0)) { >>                 if (r != -ERESTARTSYS) >> DRM_ERROR("ttm_eu_reserve_buffers failed.\n"); >> -- >> 2.17.1 >> > > > _______________________________________________ > amd-gfx mailing list > amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx --------------561008C46C49D0E900F6669C Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit
That is a good point, but actually not a problem in practice.

See the change to ttm_eu_fence_buffer_objects:
-               ttm_bo_add_to_lru(bo);
+               if (list_empty(&bo->lru))
+                       ttm_bo_add_to_lru(bo);
+               else
+                       ttm_bo_move_to_lru_tail(bo, NULL);

We still move the BOs to the end of the LRU in the same order we have before, we just don't remove them when they are reserved.

Regards,
Christian.

Am 14.05.19 um 16:31 schrieb Zhou, David(ChunMing):
how to refresh LRU to keep the order align with bo list passed from user space?

you can verify it by some games, performance could be different much between multiple runnings.

-David

-------- Original Message --------
Subject: Re: [PATCH 11/11] drm/amdgpu: stop removing BOs from the LRU during CS
From: Christian König
To: "Zhou, David(ChunMing)" ,"Olsak, Marek" ,"Liang, Prike" ,dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
CC:

[CAUTION: External Email]
Hui? What do you mean with that?

Christian.

Am 14.05.19 um 15:12 schrieb Zhou, David(ChunMing):
my only concern is how to fresh LRU when bo is from bo list.

-David

-------- Original Message --------
Subject: [PATCH 11/11] drm/amdgpu: stop removing BOs from the LRU during CS
From: Christian König
To: "Olsak, Marek" ,"Zhou, David(ChunMing)" ,"Liang, Prike" ,dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
CC:

[CAUTION: External Email]

This avoids OOM situations when we have lots of threads
submitting at the same time.

Signed-off-by: Christian König <christian.koenig-5C7GfCeVMHo@public.gmane.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index fff558cf385b..f9240a94217b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -648,7 +648,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
        }

        r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true,
-                                  &duplicates, true);
+                                  &duplicates, false);
        if (unlikely(r != 0)) {
                if (r != -ERESTARTSYS)
                        DRM_ERROR("ttm_eu_reserve_buffers failed.\n");
--
2.17.1



_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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