Eric Anholt wrote:
> On Thu, 2008-04-24 at 11:30 +0200, Thomas Hellström wrote:
>   
>> There is a possibility of a deadlock in the current Intel superioctl path,
>> which can be illustrated by two contexts rendering simultaneously from 
>> the same textures,
>> One context using fallback rendering, the other using the GPU.
>>
>> Context 1 will start mapping the texture buffers, Context 2 will take 
>> the cmdbuf mutex and start validating the same texture buffers.
>> Now if they end up having the buffer lists reversed, context 1 might end 
>> up waiting to map a buffer that context2 has validated for the GPU, 
>> while context2 will wait for a buffer that context1 has mapped => deadlock.
>>
>> One way around this is to use the hardware lock around all buffer 
>> mapping (including client buffer object mapping) and command submission, 
>> I believe the old i915tex driver did this to a large extent. I'm not 
>> sure what the current i915 driver does. Anyway, we need a more 
>> fine-grained approach.
>>     
>
> In master we hold the lock around execbuffer.  Is getting multiple cpus
> in the validate path a bottleneck, really, where a finer-grained
> approach is needed?
>   
I think in most of the cases we're dealing with today, a single thread 
in the execbuf path is sufficient.

However, I think if you use the HW lock to resolve this deadlock you'll 
also need the hw lock around all code paths where you have multiple 
buffers mapped simultaneously.

Since mapping may require a (possibly lengthy) wait for idle, one needs 
to be careful to try to idle all buffers before taking the hardware lock.

Anyway, regardless whether we can work around this using the hardware 
lock in current drivers,
I think a more general solution would need to allow multiple threads 
into the validate path, and also allowing lock-free operation where 
possible. It's a problem that isn't too hard to solve.

/Thomas








-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to