From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Liu, Monk" Subject: weird reservation issues Date: Wed, 28 Feb 2018 10:37:22 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0380860175==" Return-path: 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: "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" , "Koenig, Christian" --===============0380860175== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BLUPR12MB044995B6521FBE9C389BBE7184C70BLUPR12MB0449namp_" --_000_BLUPR12MB044995B6521FBE9C389BBE7184C70BLUPR12MB0449namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Christian In amdgpu_cs_parser_bos(), it calls ttm_eu_backoff_reservation() if @need_p= ages not empty, is it safe ? You see that if two threads in parallel running in cs_parser_bos(), if the = thread1 did call backoff_reservation and continue, that leaves All following reservation functions on root BO executed without protection = from the lock, Meanwhile if this time thread2 call cs_parser_bos() in paral= lel, it can Get the lock of the reservation object on root BO (assume thread 1/2 share = the same VM) immediately, so both of those threads consider they are Under protection of lock of reservation on the root bo. Do you think it's a= race issue ? You know that I recently hit BUG() in reservation.c, and also found some we= ird bugs can be fixed by removing the kfree(obj->staged) In reservation_object_reserve_shared(), and I think you right on the "stage= d" part that it shouldn't be freed if everything go with rules ( Always held the lock of the bo) Thanks /Monk --_000_BLUPR12MB044995B6521FBE9C389BBE7184C70BLUPR12MB0449namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Christian =

 

In amdgpu_cs_parser_bos(), it c= alls ttm_eu_backoff_reservation() if @need_pages not empty, is it safe ?

 

You see that if two threads in = parallel running in cs_parser_bos(), if the thread1 did call backoff_reserv= ation and continue, that leaves

All following reservation funct= ions on root BO executed without protection from the lock, Meanwhile if thi= s time thread2 call cs_parser_bos() in parallel, it can

Get the lock of the reservation= object on root BO (assume thread 1/2 share the same VM) immediately, so bo= th of those threads consider they are

Under protection of lock of res= ervation on the root bo. Do you think it’s a race issue ?<= /span>

 

You know that I recently hit BU= G() in reservation.c, and also found some weird bugs can be fixed by removi= ng the kfree(obj->staged)

In reservation_object_reserve_s= hared(), and I think you right on the “staged” part that it sho= uldn’t be freed if everything go with rules (

Always held the lock of the bo)=

 

 

Thanks

/Monk

 

--_000_BLUPR12MB044995B6521FBE9C389BBE7184C70BLUPR12MB0449namp_-- --===============0380860175== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYW1kLWdmeCBt YWlsaW5nIGxpc3QKYW1kLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9hbWQtZ2Z4Cg== --===============0380860175==--