On Mon, Dec 03, 2012 at 11:36:30AM +0000, Chris Wilson wrote: > Before queuing the flip but crucially after attaching the unpin-work to > the crtc, we continue to setup the unpin-work. However, should the > hardware fire early, we see the connected unpin-work and queue the task. > The task then promptly runs and unpins the fb before we finish taking > the required references or even pinning it... Havoc. > > To close the race, we use the flip-pending atomic to indicate when the > flip is finally setup and enqueued. So during the flip-done processing, > we can check more accurately whether the flip was expected. > > v2: Add the appropriate mb() to ensure that the writes to the page-flip > worker are complete prior to marking it active and emitting the MI_FLIP. > On the read side, the mb should be enforced by the spinlocks. > > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk> > Cc: stable at vger.kernel.org Merged to -fixes, with the barrier changes we've discussed on irc applied (and the reasoning for why we need 2 on each sided added to my commit message note). Thanks, Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch