Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3322219pxu; Tue, 15 Dec 2020 04:23:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRWAHYvJv3Kqdz42jlnv3jlqq8tRAM5AVQG9X35r2U6OMbR8YxmLk1oAh7Q9EJ1FlMLLLU X-Received: by 2002:a17:907:1607:: with SMTP id hb7mr25886920ejc.81.1608035015935; Tue, 15 Dec 2020 04:23:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608035015; cv=none; d=google.com; s=arc-20160816; b=d+UOk7XUSn/lfjdIG7GwNWFpKW+Fpzikb+gN/itIxG0+N3UDcHCAbfeaC2EQQ5gWdP tS6BEVmYlrDhDpV8oGFKmHR6lQvKFSu5qhduVzns5v2Ba5stXf9aon6taswgoUkYtQxo B06dw4WQQ/3oK4KCMMCjIFLvISpufaNTz3SvT5/+x3qrjDkxXKG2WWJRv+Mb5Hkl4GFz p9snuTiaAKgLD3uGW0+0ZaqzLT8ZJZ5CdnTXoeFnhhhqJWCWkVT2P3SoGNps2rUqbK5b wHj/2XKltRWeNjSATW3Uk7k1ZC/TALlJCSZ36GOOHnaRA2bXDQswL1YU6JsDuahyxe2d blKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:to:from; bh=Wc5K9cT1xw3RLy0etdoPmiqAGC/XU+7mlIkfV7f2dNY=; b=WrtZP/AYU4JdHM+9Em+nSW/OIEzHXK8Pw2/G/TtvEaYwTMZszvo/tVBGZpFmlEx44q nOESFqOLlPLzqnhoz2e4tWlMai9dpx0r/V30zHNdqKxDjyKAobKylCcMqVrUXr1sqFq8 SXfL3PnsaQnMwjClhaBNd8HrMOc94N9aL3hr8GHStfmlQ3ZmvAuAbnDUszWdzbSkv5sn LVq/lhd3aMsn1UfLpBeYW2T8/6euVAHexOWEt2EGdqhi53/Fsr/7tbQZsQymj7Al5YvV WhdIfvjkcAbaFLH5WJQvJaVBq/RN3CJB2NFLponZsYrqXzAy/ryzRE9uYwXjRKuwv2iV /XWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr5si753095ejb.59.2020.12.15.04.23.12; Tue, 15 Dec 2020 04:23:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726951AbgLOMUQ (ORCPT + 99 others); Tue, 15 Dec 2020 07:20:16 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9610 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729126AbgLOMTe (ORCPT ); Tue, 15 Dec 2020 07:19:34 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CwHMv5QLVzM5hT; Tue, 15 Dec 2020 20:18:03 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Tue, 15 Dec 2020 20:18:49 +0800 From: Tian Tao To: , , , , , , , , Subject: [PATCH v2] drm/hisilicon: Fix rmmod hibmc_drm failed Date: Tue, 15 Dec 2020 20:18:59 +0800 Message-ID: <1608034739-699-1-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org drm_irq_uninstall should be called before pci_disable_msi, if use devm_drm_irq_install to register the interrupt, the system will call pci_disable_msi first and then call drm_irq_uninstall, which will result in the following callstack. This reverts commit e4401247070a37c2fce62b2773a4eb7757983938. kernel BUG at drivers/pci/msi.c:376! Internal error: Oops - BUG: 0 [#1] SMP CPU: 93 PID: 173814 Comm: rmmod Tainted: pstate: a0400009 (NzCv daif +PAN -UAO -TCO BTYPE=--) pc : free_msi_irqs+0x17c/0x1a0 lr : free_msi_irqs+0x16c/0x1a0 sp : ffff2028157f7bd0 x29: ffff2028157f7bd0 x28: ffff202849edab00 x27: 0000000000000000 x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000 x23: ffff0020851da000 x22: ffff0020851da2d8 x21: ffff0020cc829000 x20: 0000000000000000 x19: ffff0020d6714800 x18: 0000000000000010 x17: 0000000000000000 x16: 0000000000000000 x15: ffffffffffffffff x14: ffff2028957f77df x13: ffff2028157f77ed x12: 0000000000000000 x11: 0000000000000040 x10: ffff800011b2f8e0 x9 : ffff800011b2f8d8 x8 : ffff2020203fc458 x7 : 0000000000000000 x6 : 0000000000000000 x5 : ffff2020203fc430 x4 : ffff2020203fc4a0 x3 : 0000000000000000 x2 : 0000000000000000 x1 : 00000000000002c9 x0 : ffff0020d6719500 Call trace: free_msi_irqs+0x17c/0x1a0 pci_disable_msi+0xe4/0x118 hibmc_unload+0x44/0x80 [hibmc_drm] hibmc_pci_remove+0x2c/0x38 [hibmc_drm] pci_device_remove+0x48/0x108 device_release_driver_internal+0x118/0x1f0 driver_detach+0x6c/0xe0 bus_remove_driver+0x74/0x100 driver_unregister+0x34/0x60 pci_unregister_driver+0x24/0xd8 hibmc_pci_driver_exit+0x14/0xe768 [hibmc_drm] __arm64_sys_delete_module+0x1fc/0x2d0 el0_svc_common.constprop.3+0xa8/0x188 do_el0_svc+0x80/0xa0 el0_sync_handler+0x8c/0xb0 el0_sync+0x15c/0x180 Code: f940b400 b4ffff00 a903e7b8 f90013b5 (d4210000) ---[ end trace 310d94ee8abef44f ]--- Kernel panic - not syncing: Oops - BUG: Fatal exception v2: update the commit log to indicate the patch that needs to be revert. Signed-off-by: Tian Tao Acked-by: Daniel Vetter --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c index 7e91ef1..9b5f15c 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -251,6 +251,10 @@ static int hibmc_hw_init(struct hibmc_drm_private *priv) static int hibmc_unload(struct drm_device *dev) { drm_atomic_helper_shutdown(dev); + + if (dev->irq_enabled) + drm_irq_uninstall(dev); + pci_disable_msi(dev->pdev); return 0; @@ -286,7 +290,7 @@ static int hibmc_load(struct drm_device *dev) if (ret) { drm_warn(dev, "enabling MSI failed: %d\n", ret); } else { - ret = devm_drm_irq_install(dev, dev->pdev->irq); + ret = drm_irq_install(dev, dev->pdev->irq); if (ret) drm_warn(dev, "install irq failed: %d\n", ret); } -- 2.7.4