linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/hisilicon: Fix rmmod hibmc_drm failed
@ 2020-12-15  3:01 Tian Tao
  2020-12-15  7:53 ` Thomas Zimmermann
  2020-12-15 11:59 ` Daniel Vetter
  0 siblings, 2 replies; 5+ messages in thread
From: Tian Tao @ 2020-12-15  3:01 UTC (permalink / raw)
  To: airlied, daniel, tzimmermann, kraxel, alexander.deucher, tglx,
	dri-devel, xinliang.liu, linux-kernel

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

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/hisilicon: Fix rmmod hibmc_drm failed
  2020-12-15  3:01 [PATCH] drm/hisilicon: Fix rmmod hibmc_drm failed Tian Tao
@ 2020-12-15  7:53 ` Thomas Zimmermann
  2020-12-15 11:59 ` Daniel Vetter
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Zimmermann @ 2020-12-15  7:53 UTC (permalink / raw)
  To: Tian Tao, airlied, daniel, kraxel, alexander.deucher, tglx,
	dri-devel, xinliang.liu, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 3919 bytes --]

Hi Tian

Am 15.12.20 um 04:01 schrieb Tian Tao:
> 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
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>   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);

We're trying to move towards managed driver releases; and this feels 
like a step backwards.

I looked through the PCI-device release code in pcim_release() and it 
already disables MSI automatically. [1] You can enable the PCI device 
with pcim_enable_device() instead of pci_enable_device() to use the 
automatic release. No more need to disable MSI manually.

If this does not work, could you provide a managed version of 
pci_disable_msi() that solves the problem?

Best regards
Thomas

[1] https://elixir.bootlin.com/linux/latest/source/drivers/pci/pci.c#L1976


>   
>   	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);
>   	}
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/hisilicon: Fix rmmod hibmc_drm failed
  2020-12-15  3:01 [PATCH] drm/hisilicon: Fix rmmod hibmc_drm failed Tian Tao
  2020-12-15  7:53 ` Thomas Zimmermann
@ 2020-12-15 11:59 ` Daniel Vetter
  2020-12-15 12:01   ` Daniel Vetter
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2020-12-15 11:59 UTC (permalink / raw)
  To: Tian Tao
  Cc: airlied, daniel, tzimmermann, kraxel, alexander.deucher, tglx,
	dri-devel, xinliang.liu, linux-kernel

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 <daniel.vetter@ffwll.ch>

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 <tiantao6@hisilicon.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/hisilicon: Fix rmmod hibmc_drm failed
  2020-12-15 11:59 ` Daniel Vetter
@ 2020-12-15 12:01   ` Daniel Vetter
  2020-12-15 12:04     ` tiantao (H)
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2020-12-15 12:01 UTC (permalink / raw)
  To: Tian Tao, airlied, tzimmermann, kraxel, alexander.deucher, tglx,
	dri-devel, xinliang.liu, linux-kernel

On Tue, Dec 15, 2020 at 12:59:53PM +0100, Daniel Vetter wrote:
> 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 <daniel.vetter@ffwll.ch>
> 
> 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.

I also just noticed that you didn't add devm_drm_irq_install to the list
of functions in Documentation/driver-api/driver-model/devres.rst. Can you
please submit a patch to fix this?

Thanks, Daniel

> -Daniel
> 
> > Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> > ---
> >  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

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/hisilicon: Fix rmmod hibmc_drm failed
  2020-12-15 12:01   ` Daniel Vetter
@ 2020-12-15 12:04     ` tiantao (H)
  0 siblings, 0 replies; 5+ messages in thread
From: tiantao (H) @ 2020-12-15 12:04 UTC (permalink / raw)
  To: Tian Tao, airlied, tzimmermann, kraxel, alexander.deucher, tglx,
	dri-devel, xinliang.liu, linux-kernel


在 2020/12/15 20:01, Daniel Vetter 写道:
> On Tue, Dec 15, 2020 at 12:59:53PM +0100, Daniel Vetter wrote:
>> 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 <daniel.vetter@ffwll.ch>
>>
>> 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.
> I also just noticed that you didn't add devm_drm_irq_install to the list
> of functions in Documentation/driver-api/driver-model/devres.rst. Can you
> please submit a patch to fix this?
sure
>
> Thanks, Daniel
>
>> -Daniel
>>
>>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>>> ---
>>>   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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-15 12:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15  3:01 [PATCH] drm/hisilicon: Fix rmmod hibmc_drm failed Tian Tao
2020-12-15  7:53 ` Thomas Zimmermann
2020-12-15 11:59 ` Daniel Vetter
2020-12-15 12:01   ` Daniel Vetter
2020-12-15 12:04     ` tiantao (H)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).