[Intel-gfx] [PATCH v1] drm/i915/guc: Fix a potential issue during driver unload

yu.dai at intel.com yu.dai at intel.com
Fri Dec 18 12:38:59 PST 2015


From: Alex Dai <yu.dai at intel.com>

The device struct_mutex needs to be held before releasing any GEM
objects allocated by GuC.

    WARNING: CPU: 0 PID: 1575 at include/drm/drm_gem.h:217 gem_release_guc_obj+0x5f/0x70 [i915]()
    Call Trace:
     [<ffffffff813c8b64>] dump_stack+0x44/0x60
     [<ffffffff8107d642>] warn_slowpath_common+0x82/0xc0
     [<ffffffff8107d78a>] warn_slowpath_null+0x1a/0x20
     [<ffffffffc02369ef>] gem_release_guc_obj+0x5f/0x70 [i915]
     [<ffffffffc02380ba>] i915_guc_submission_fini+0x1a/0x70 [i915]
     [<ffffffffc0235d09>] intel_guc_ucode_fini+0x29/0xa0 [i915]
     [<ffffffffc029595d>] i915_driver_unload+0x14d/0x290 [i915]
     [<ffffffffc00912a9>] drm_dev_unregister+0x29/0xb0 [drm]
     [<ffffffffc00919d3>] drm_put_dev+0x23/0x60 [drm]
     [<ffffffffc01d51b5>] i915_pci_remove+0x15/0x20 [i915]
     [<ffffffff81419b49>] pci_device_remove+0x39/0xc0
     [<ffffffff81527f51>] __device_release_driver+0xa1/0x150
     [<ffffffff81528a85>] driver_detach+0xb5/0xc0
     [<ffffffff815279b5>] bus_remove_driver+0x55/0xd0
     [<ffffffff8152921c>] driver_unregister+0x2c/0x50
     [<ffffffff814181e9>] pci_unregister_driver+0x29/0x90
     [<ffffffffc0093174>] drm_pci_exit+0x94/0xb0 [drm]
     [<ffffffffc02960c4>] i915_exit+0x20/0xf5c [i915]
     [<ffffffff81102bc5>] SyS_delete_module+0x1b5/0x210
     [<ffffffff817fc2b6>] entry_SYSCALL_64_fastpath+0x16/0x75
    ---[ end trace f711c4eb63588bb7 ]---

v1: Add backtrace log.

Signed-off-by: Alex Dai <yu.dai at intel.com>

diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
index 625272f4..4748651 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -631,10 +631,10 @@ void intel_guc_ucode_fini(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_guc_fw *guc_fw = &dev_priv->guc.guc_fw;
 
+	mutex_lock(&dev->struct_mutex);
 	direct_interrupts_to_host(dev_priv);
 	i915_guc_submission_fini(dev);
 
-	mutex_lock(&dev->struct_mutex);
 	if (guc_fw->guc_fw_obj)
 		drm_gem_object_unreference(&guc_fw->guc_fw_obj->base);
 	guc_fw->guc_fw_obj = NULL;
-- 
2.5.0



More information about the Intel-gfx mailing list