[Intel-gfx] [PATCH 2/4] drm/i915/guc: Move GuC workqueue allocations outside of the mutex

Chris Wilson chris at chris-wilson.co.uk
Mon Dec 11 15:26:14 UTC 2017


Quoting MichaƂ Winiarski (2017-12-11 15:12:54)
> @@ -1256,20 +1214,20 @@ int intel_guc_submission_init(struct intel_guc *guc)
>         if (ret < 0)
>                 goto err_stage_desc_pool;
>  
> -       ret = guc_preempt_work_create(guc);
> -       if (ret)
> -               goto err_log;
> -       GEM_BUG_ON(!guc->preempt_wq);
> -
>         ret = guc_ads_create(guc);
>         if (ret < 0)
> -               goto err_wq;
> +               goto err_log;
>         GEM_BUG_ON(!guc->ads_vma);
>  
> +       if (HAS_LOGICAL_RING_PREEMPTION(dev_priv)) {
> +               for_each_engine(engine, dev_priv, id) {
> +                       guc->preempt_work[id].engine = engine;
> +                       INIT_WORK(&guc->preempt_work[id].work, inject_preempt_context);
> +               }
> +       }
> +
>         return 0;
>  
> -err_wq:
> -       guc_preempt_work_destroy(guc);
>  err_log:
>         intel_guc_log_destroy(guc);
>  err_stage_desc_pool:
> @@ -1279,8 +1237,14 @@ int intel_guc_submission_init(struct intel_guc *guc)
>  
>  void intel_guc_submission_fini(struct intel_guc *guc)
>  {
> +       struct drm_i915_private *dev_priv = guc_to_i915(guc);
> +       struct intel_engine_cs *engine;
> +       enum intel_engine_id id;
> +
> +       for_each_engine(engine, dev_priv, id)
> +               cancel_work_sync(&guc->preempt_work[id].work);
> +

You should then unconditionally initialise the preempt_work[id].work as
well. Which isn't a problem as it is just pure initialisation and no
allocation.
-Chris


More information about the Intel-gfx mailing list