[PATCH v4] drm/i915: Allocate intel_engine_cs structure only for the enabled engines
Goel, Akash
akash.goel at intel.com
Wed Jul 27 17:41:34 UTC 2016
On 7/27/2016 10:57 PM, Chris Wilson wrote:
> On Wed, Jul 27, 2016 at 10:45:45PM +0530, akash.goel at intel.com wrote:
>> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
>> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
>> @@ -87,7 +87,12 @@ intel_engine_setup(struct drm_i915_private *dev_priv,
>> enum intel_engine_id id)
>> {
>> const struct engine_info *info = &intel_engines[id];
>> - struct intel_engine_cs *engine = &dev_priv->engine[id];
>> + struct intel_engine_cs *engine = dev_priv->engine[id];
>> +
>> + GEM_BUG_ON(engine);
>> + dev_priv->engine[id] = engine = kzalloc(sizeof(*engine), GFP_KERNEL);
>> + if (!engine)
>> + return ERR_PTR(-ENOMEM);
>
> This is ugly.
Sorry for that. Will reshuffle as per the below code.
best regards
Akash
>
> GEM_BUG_ON(dev_priv->engine[id]);
> engine = kzalloc(sizeof(*engine), GFP_KERNEL);
> ...
> dev_priv->engine[id] = engine;
> return 0;
>
> It's important that we don't bail out and pretend the engine is
> initialiased. Hopefully we are now at the point where we don't loop over
> engines or expect dev_priv->engine[id] already set inside the
> intel_engine_setup().
> -Chris
>
More information about the Intel-gfx-trybot
mailing list