From: Maarten Maathuis Subject: Re: [PATCH] drm/ttm: Fix race condition in ttm_bo_delayed_delete Date: Thu, 21 Jan 2010 17:02:57 +0100 Message-ID: <6d4bc9fc1001210802o7114a25awa0872749667aad76@mail.gmail.com> References: <1263840434-9113-1-git-send-email-luca@luca-barbieri.com> <4B576FF5.9040907@shipmail.org> <4B584E48.8020806@shipmail.org> <87vdeveekk.fsf@riseup.net> <87pr53ecwd.fsf@riseup.net> <6d4bc9fc1001210739r2bb8b4c4i18590376a1628d82@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: Luca Barbieri Cc: Thomas Hellstrom , "dri-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org" , Thomas Hellstrom , "airlied-cv59FeDIM0c@public.gmane.org" , "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" List-Id: dri-devel@lists.freedesktop.org On Thu, Jan 21, 2010 at 4:56 PM, Luca Barbieri wrote: >> Doing it without software methods means you need to have a semaphore >> that "exists" in the cpu domain and therefore cannot be used again >> until the cpu is sure it's done. So that will probably require a >> rotating queue of several semaphores and a fallback to cpu waiting. > > Why would it need a semaphore in CPU domain? > Couldn't it work this way: > 1. Allocate a BO in the kernel Who will set the initial "not-done" value? > 2. Emit on one channel a "notify" request on that BO > 3. Emit on the other channel a "wait" request on that BO > 4. Emit a fence on the wait channel > 5. Use the existing delayed-destroy mechanism to get rid of the BO > once the wait channel fence expires > > Then the GPU would presumably switch away from the "waiting" context > and not reexecute it until the notify happens, or something similar. > > The problem is, of course, whether the GPU supports the "wait" request. >