Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3313447pxu; Tue, 15 Dec 2020 04:10:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwX9ZGAkoKX2GCsaotnxT8x0kCtWHyEt/G5UpEoVGBDdG3HQvxc7EpSAjMZYbUzByHtEVU7 X-Received: by 2002:a17:906:68d1:: with SMTP id y17mr26892839ejr.447.1608034221256; Tue, 15 Dec 2020 04:10:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608034221; cv=none; d=google.com; s=arc-20160816; b=nXIAuSscJGtdNh092eoyaXYjl5x8Wd+tLQjkqr1gXFYGnmXlid8qfVqMQL+pBVtnWA cLam8+iZO2qDK8vg1b7vxcvnyy9pytzHLFtjVlsAYN7dwEFkOwgGGgLngMWUQcNdwTNX TUAaPU6fUh4bFgqEVNLrD44wu8MDk112ebc70G6rfQk7NJsCFThBy+NFhbDztUeg/ZkC krVxsEwluzX/nJShkW5EPThDWjIxvXJhoDMol1x1J3xY23MAADYanmAEyRw/7GD3GiqL u+TIQpnAqFfNRosmvDTnc/AlAf58I+OhNpG2hsPtWeTOvw7KdfnBnMMF+OusFNwG9Bh/ L41A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=AHASKMgtyjqftLYSNx1zW4K9iETPXaBXN6ZbMW8229U=; b=xZKC8Eyz/Xc251RC07WcwG9Xz6njwt726/6Qank7TjGmgLovtFuIkmKBr5eMLwE6y8 MhPbDSyToZNTOdEsOJ9ovWsBErQ6ZyRwj8Hqlbt9m2Qjf1yyplrsxLka9oNg5xzpEeVd hsSa0oRwMkZK5Sd804ShkN0TEmN6PUNjC82zVM9j1neETlsn9wQTwf16xOyMreeVhujo nsaTOBXVDVLZ+3fMBDedJzyCrzfsojpvfl5zY2p5t4hUI8PB6aaZKQ+o7cw9fJIFZSi2 PVTlZ8c2SO/QxGwPK2WSM50B9g7vLnK5Xd+kIqGW41qBVcti6hF80V64mIkqRkanoRbN C67g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="aLQfH/fp"; 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 a18si657968ejf.618.2020.12.15.04.09.49; Tue, 15 Dec 2020 04:10:21 -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; dkim=pass header.i=@ffwll.ch header.s=google header.b="aLQfH/fp"; 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 S1728489AbgLOMA5 (ORCPT + 99 others); Tue, 15 Dec 2020 07:00:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728659AbgLOMAh (ORCPT ); Tue, 15 Dec 2020 07:00:37 -0500 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 387FEC06179C for ; Tue, 15 Dec 2020 03:59:57 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id a6so16640974wmc.2 for ; Tue, 15 Dec 2020 03:59:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=AHASKMgtyjqftLYSNx1zW4K9iETPXaBXN6ZbMW8229U=; b=aLQfH/fpUhKhWWdfgex0BhLZ92m6v/1VZkPA+iR53DqtVk6lLrDiKqrV1/+zEatt5B RIWmIPRs+1FHuGPdQGJm7cAWQ77+H40pjdm6y0YP57ZzrQkpQ3obtwLo5RLhiDr4Boxe 2WAooMb8eguO0owJ/GBO8t0J08GGLMZkYfvkM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=AHASKMgtyjqftLYSNx1zW4K9iETPXaBXN6ZbMW8229U=; b=C5MFXWGbLb0Ybq+S3WzzesYu3Ol6uRTMMxalwe3Xm/HamOprv9yLOWCTk9cLYqeXJN HaUoqC6IYXoLPL5TTYXzdjyBp46ctRdbQpxQHTOiPwlS5FenkHARx5PrJaFSfGZFldrt P+Y3PatZ6wLiEekLq5+3k8XLDyU5+c6DBTFOyufu/pCWZ+aaDhMsSR2GCePWdpnMSDgT 9yzJKk8iPw2ZwvdjxN8+0RduvJaO+i5i72gd9deqr/cCYRgUSgTdwPNBN/wNbw/11SWQ dzD/K/0HM3/CQh9fQPuNbFHhTazCUMiRx1MhiozteBQimLMDkPLwS/sOQHSUWIGECn3K GI7Q== X-Gm-Message-State: AOAM531Vj/kQ6be/ylUqQHjDvWEGVMdHEkQZQ2TiRMNo9yPYkEDAm4IB /T2CtoIjbzxEUJUPWievVQ4+7w== X-Received: by 2002:a05:600c:410d:: with SMTP id j13mr32725060wmi.95.1608033595958; Tue, 15 Dec 2020 03:59:55 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id q143sm37528307wme.28.2020.12.15.03.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 03:59:55 -0800 (PST) Date: Tue, 15 Dec 2020 12:59:53 +0100 From: Daniel Vetter To: Tian Tao Cc: airlied@linux.ie, daniel@ffwll.ch, tzimmermann@suse.de, kraxel@redhat.com, alexander.deucher@amd.com, tglx@linutronix.de, dri-devel@lists.freedesktop.org, xinliang.liu@linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/hisilicon: Fix rmmod hibmc_drm failed Message-ID: Mail-Followup-To: Tian Tao , airlied@linux.ie, tzimmermann@suse.de, kraxel@redhat.com, alexander.deucher@amd.com, tglx@linutronix.de, dri-devel@lists.freedesktop.org, xinliang.liu@linaro.org, linux-kernel@vger.kernel.org References: <1608001299-7237-1-git-send-email-tiantao6@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1608001299-7237-1-git-send-email-tiantao6@hisilicon.com> X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 15, 2020 at 11:01:39AM +0800, Tian Tao wrote: > 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. > > 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 > You should mention here which patch you're reverting. With that: Acked-by: Daniel Vetter Since the proper fix will probably take a while longer. Also why was this not noticed when merging the original patch? hisilicon is the only user of devm_drm_irq_install we have in-tree right now. -Daniel > Signed-off-by: Tian Tao > --- > 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 e3ab765b..02f3bd1 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 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch