From patchwork Fri Dec 18 20:38:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yu.dai@intel.com X-Patchwork-Id: 7887821 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C82DF9F1C2 for ; Fri, 18 Dec 2015 20:42:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0204C204D3 for ; Fri, 18 Dec 2015 20:42:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 16823204D2 for ; Fri, 18 Dec 2015 20:42:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F18AC6EAF8; Fri, 18 Dec 2015 12:42:09 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTP id 78A3C6EAF8 for ; Fri, 18 Dec 2015 12:42:09 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 18 Dec 2015 12:42:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,447,1444719600"; d="scan'208";a="710638231" Received: from alex-hsw.fm.intel.com ([10.19.83.10]) by orsmga003.jf.intel.com with ESMTP; 18 Dec 2015 12:42:09 -0800 From: yu.dai@intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 18 Dec 2015 12:38:59 -0800 Message-Id: <1450471139-7628-1-git-send-email-yu.dai@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1450315926-30894-1-git-send-email-yu.dai@intel.com> References: <1450315926-30894-1-git-send-email-yu.dai@intel.com> Subject: [Intel-gfx] [PATCH v1] drm/i915/guc: Fix a potential issue during driver unload X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alex Dai 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: [] dump_stack+0x44/0x60 [] warn_slowpath_common+0x82/0xc0 [] warn_slowpath_null+0x1a/0x20 [] gem_release_guc_obj+0x5f/0x70 [i915] [] i915_guc_submission_fini+0x1a/0x70 [i915] [] intel_guc_ucode_fini+0x29/0xa0 [i915] [] i915_driver_unload+0x14d/0x290 [i915] [] drm_dev_unregister+0x29/0xb0 [drm] [] drm_put_dev+0x23/0x60 [drm] [] i915_pci_remove+0x15/0x20 [i915] [] pci_device_remove+0x39/0xc0 [] __device_release_driver+0xa1/0x150 [] driver_detach+0xb5/0xc0 [] bus_remove_driver+0x55/0xd0 [] driver_unregister+0x2c/0x50 [] pci_unregister_driver+0x29/0x90 [] drm_pci_exit+0x94/0xb0 [drm] [] i915_exit+0x20/0xf5c [i915] [] SyS_delete_module+0x1b5/0x210 [] entry_SYSCALL_64_fastpath+0x16/0x75 ---[ end trace f711c4eb63588bb7 ]--- v1: Add backtrace log. Signed-off-by: Alex Dai 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;