On Fri, Dec 08, 2017 at 01:17:20AM +0000, Chris Wilson wrote:
> Since Michal introduced new errors other than -EIO during
> i915_gem_init(), we need to actually unwind on the error path as we have
> to abort the module load (and we expect to do so cleanly!).
> 
> As we now teardown key state and then mark the driver as wedged (on
> EIO), we have to be careful to not allow ourselves to resume and
> unwedge, thus attempting to use the uninitialised driver.
> 
> v2: Try not to free driver state for the suppressed EIO
> 
> References: 8620eb1dbbf2 ("drm/i915/uc: Don't use -EIO to report missing 
> firmware")
> Signed-off-by: Chris Wilson <[email protected]>
> Cc: Michal Wajdeczko <[email protected]>
> Cc: Joonas Lahtinen <[email protected]>
> Cc: Sagar Arun Kamble <[email protected]>
> Signed-off-by: Chris Wilson <[email protected]>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 82 
> +++++++++++++++++++++++++++++++++--------
>  1 file changed, 67 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index c7b5db78fbb4..ee243e1ef706 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c

[SNIP]

> +err_ggtt:
> +err_unlock:

So... Just unlock? :>

Does what it says on the tin (fixing WARN_ON galore on guc load failure):

Reviewed-by: Michał Winiarski <[email protected]>

-Michał

> +     intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
> +     mutex_unlock(&dev_priv->drm.struct_mutex);
> +
> +     if (ret != -EIO)
> +             i915_gem_cleanup_userptr(dev_priv);
> +
>       if (ret == -EIO) {
> -             /* Allow engine initialisation to fail by marking the GPU as
> +             /*
> +              * Allow engine initialisation to fail by marking the GPU as
>                * wedged. But we only want to do this where the GPU is angry,
>                * for all other failure, such as an allocation failure, bail.
>                */
> @@ -5199,9 +5252,8 @@ int i915_gem_init(struct drm_i915_private *dev_priv)
>               }
>               ret = 0;
>       }
> -     intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
> -     mutex_unlock(&dev_priv->drm.struct_mutex);
>  
> +     i915_gem_drain_freed_objects(dev_priv);
>       return ret;
>  }
>  
> -- 
> 2.15.1
> 
> _______________________________________________
> Intel-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to