[Intel-gfx] [PATCH v2] drm/i915: Unwind i915_gem_init() failure
Michał Winiarski
michal.winiarski at intel.com
Fri Dec 8 22:32:40 UTC 2017
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 <chris at chris-wilson.co.uk>
> Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble at intel.com>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> 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 <michal.winiarski at intel.com>
-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
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
More information about the Intel-gfx
mailing list