On 02/12/15 14:58, Chris Wilson wrote: > On Wed, Dec 02, 2015 at 02:51:17PM +0000, Dave Gordon wrote: >> Or, put the active ones on a linked list, or keep a bitmask of which >> ones have been initialised inside the dev_priv structure, so you >> don't have to even dereference the engine[] array to work out >> whether a particular engine is initialised. Apropos which, wouldn't >> it be much more efficient to do that, because >> intel_ring_initialized() is quite heavyweight and the results surely >> don't change often, if at all, during normal operation. So we should >> only evaluate it when something has changed, and cache the bool >> result for use in all those for_each() loops! > > commit b53cd50c19f9d3c6f3308165b3e26c47b19dd041 > Author: Chris Wilson > Date: Tue Mar 31 00:25:20 2015 +0100 > > drm/i915: intel_ring_initialized() must be simple and inline > > Fixes regression from > commit 48d823878d64f93163f5a949623346748bbce1b4 > Author: Oscar Mateo > Date: Thu Jul 24 17:04:23 2014 +0100 > > drm/i915/bdw: Generic logical ring init and cleanup > > Signed-off-by: Chris Wilson > > ... > > -bool intel_ring_initialized(struct intel_engine_cs *ring); > +static inline bool > +intel_ring_initialized(struct intel_engine_cs *ring) > +{ > + return ring->dev != NULL; > +} > > Just waiting to clear a massive backlog. > > If we can use an array rather than a list (and a static assignment > certainly qualifies), use an array. > -Chris Aha! That looks useful, but it didn't apply cleanly, so I've reworked it somewhat. Here's the patch (UNTESTED) for your comments ... .Dave.