[Intel-gfx] [PATCH] drm/i915: add missing unregister_oom_notifier to the error/unload path

Daniel Vetter daniel at ffwll.ch
Tue May 20 19:34:08 CEST 2014


On Tue, May 20, 2014 at 07:47:20PM +0300, Imre Deak wrote:
> I'm trying to reduce the WARNs during driver reload and this was one of
> them. Also while at it remove the redundant condition from before
> unregister_shrinker().
> 
> v2:
> - fix the error path too and move the unregister to its logical place
> (Chris)
> - remove redundant condition from before unregister_shrinker()
> 
> Signed-off-by: Imre Deak <imre.deak at intel.com>

Queued for -next, thanks for the patch.
-Daniel
> ---
>  drivers/gpu/drm/i915/i915_dma.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index bf81396..f14c47a 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -44,6 +44,7 @@
>  #include <acpi/video.h>
>  #include <linux/pm.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/oom.h>
>  
>  #define LP_RING(d) (&((struct drm_i915_private *)(d))->ring[RCS])
>  
> @@ -1741,8 +1742,8 @@ out_power_well:
>  	intel_power_domains_remove(dev_priv);
>  	drm_vblank_cleanup(dev);
>  out_gem_unload:
> -	if (dev_priv->mm.shrinker.scan_objects)
> -		unregister_shrinker(&dev_priv->mm.shrinker);
> +	WARN_ON(unregister_oom_notifier(&dev_priv->mm.oom_notifier));
> +	unregister_shrinker(&dev_priv->mm.shrinker);
>  
>  	if (dev->pdev->msi_enabled)
>  		pci_disable_msi(dev->pdev);
> @@ -1793,8 +1794,8 @@ int i915_driver_unload(struct drm_device *dev)
>  
>  	i915_teardown_sysfs(dev);
>  
> -	if (dev_priv->mm.shrinker.scan_objects)
> -		unregister_shrinker(&dev_priv->mm.shrinker);
> +	WARN_ON(unregister_oom_notifier(&dev_priv->mm.oom_notifier));
> +	unregister_shrinker(&dev_priv->mm.shrinker);
>  
>  	io_mapping_free(dev_priv->gtt.mappable);
>  	arch_phys_wc_del(dev_priv->gtt.mtrr);
> -- 
> 1.8.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list