[Intel-gfx] [PATCH V2 6/6] drm/i915:Use the coarse ping-pong mechanism based on drm fd to dispatch the BSD command on BDW GT3

Zhao Yakui yakui.zhao at intel.com
Mon Apr 14 10:46:35 CEST 2014


On Mon, 2014-04-14 at 02:19 -0600, Chris Wilson wrote:
> On Mon, Apr 14, 2014 at 04:05:19PM +0800, Zhao Yakui wrote:
> > On Mon, 2014-04-14 at 01:22 -0600, Daniel Vetter wrote:
> > > You're still using atomic_t for no real good reason.
> > > gen8_dispatch_bsd_ring is always called with the dev->struct_mutex lock
> > > held, so there's really no reason for it.
> > 
> > If the struct_mutex is used in the gen8_dispatch_bsd_ring, I can remove
> > the atomic_t. 
> > It seems that the struct_mutex is a big lock and it is used very
> > frequently(i915_gem.c, i915_dma.c and so on). In my point it is a little
> > heavier than the atomic_t if one counter is increased and returned. 
> > 
> > If you think that the mutex is better than atomic, I will follow your
> > advice.
> 
> You are already holding the struct_mutex whenever we touch the ring and
> execbuffer. Even in a fine-grained world, there will still be a mutex
> around all operations that touch the rings.

Hi, Chris

    I understand your concern. From the source code the struct_mutex
will be held when trying to do the buffer relocation and dispatch the
command in one ring. 
    But my code is only to select one BSD ring. In such case the
atomic_t usage is enough and it is unnecessary to hold the struct_mutex.
    If you also think that the struct_mutex is better, I can update the
code to use the struct_mutex.

Thanks.
    Yakui    


> -Chris
> 





More information about the Intel-gfx mailing list