netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] mlx4: disable device on shutdown
@ 2020-07-24 23:15 Jakub Kicinski
  2020-07-28  8:53 ` Saeed Mahameed
  2020-07-29  0:12 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-07-24 23:15 UTC (permalink / raw)
  To: davem
  Cc: netdev, kernel-team, tariqt, ogerlitz, yishaih, saeedm,
	Jakub Kicinski, Jake Lawrence

It appears that not disabling a PCI device on .shutdown may lead to
a Hardware Error with particular (perhaps buggy) BIOS versions:

    mlx4_en: eth0: Close port called
    mlx4_en 0000:04:00.0: removed PHC
    reboot: Restarting system
    {1}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1
    {1}[Hardware Error]: event severity: fatal
    {1}[Hardware Error]:  Error 0, type: fatal
    {1}[Hardware Error]:   section_type: PCIe error
    {1}[Hardware Error]:   port_type: 4, root port
    {1}[Hardware Error]:   version: 1.16
    {1}[Hardware Error]:   command: 0x4010, status: 0x0143
    {1}[Hardware Error]:   device_id: 0000:00:02.2
    {1}[Hardware Error]:   slot: 0
    {1}[Hardware Error]:   secondary_bus: 0x04
    {1}[Hardware Error]:   vendor_id: 0x8086, device_id: 0x2f06
    {1}[Hardware Error]:   class_code: 000604
    {1}[Hardware Error]:   bridge: secondary_status: 0x2000, control: 0x0003
    {1}[Hardware Error]:   aer_uncor_status: 0x00100000, aer_uncor_mask: 0x00000000
    {1}[Hardware Error]:   aer_uncor_severity: 0x00062030
    {1}[Hardware Error]:   TLP Header: 40000018 040000ff 791f4080 00000000
[hw error repeats]
    Kernel panic - not syncing: Fatal hardware error!
    CPU: 0 PID: 2189 Comm: reboot Kdump: loaded Not tainted 5.6.x-blabla #1
    Hardware name: HP ProLiant DL380 Gen9/ProLiant DL380 Gen9, BIOS P89 05/05/2017

Fix the mlx4 driver.

This is a very similar problem to what had been fixed in:
commit 0d98ba8d70b0 ("scsi: hpsa: disable device during shutdown")
to address https://bugzilla.kernel.org/show_bug.cgi?id=199779.

Fixes: 2ba5fbd62b25 ("net/mlx4_core: Handle AER flow properly")
Reported-by: Jake Lawrence <lawja@fb.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx4/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 3d9aa7da95e9..2d3e45780719 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -4356,12 +4356,14 @@ static void mlx4_pci_resume(struct pci_dev *pdev)
 static void mlx4_shutdown(struct pci_dev *pdev)
 {
 	struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev);
+	struct mlx4_dev *dev = persist->dev;
 
 	mlx4_info(persist->dev, "mlx4_shutdown was called\n");
 	mutex_lock(&persist->interface_state_mutex);
 	if (persist->interface_state & MLX4_INTERFACE_STATE_UP)
 		mlx4_unload_one(pdev);
 	mutex_unlock(&persist->interface_state_mutex);
+	mlx4_pci_disable_device(dev);
 }
 
 static const struct pci_error_handlers mlx4_err_handler = {
-- 
2.26.2


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

* Re: [PATCH net] mlx4: disable device on shutdown
  2020-07-24 23:15 [PATCH net] mlx4: disable device on shutdown Jakub Kicinski
@ 2020-07-28  8:53 ` Saeed Mahameed
  2020-07-29  0:12 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2020-07-28  8:53 UTC (permalink / raw)
  To: kuba, davem
  Cc: kernel-team, lawja, Yishai Hadas, Or Gerlitz, netdev, Tariq Toukan

On Fri, 2020-07-24 at 16:15 -0700, Jakub Kicinski wrote:
> It appears that not disabling a PCI device on .shutdown may lead to
> a Hardware Error with particular (perhaps buggy) BIOS versions:
> 
>     mlx4_en: eth0: Close port called
>     mlx4_en 0000:04:00.0: removed PHC
>     reboot: Restarting system
>     {1}[Hardware Error]: Hardware error from APEI Generic Hardware
> Error Source: 1
>     {1}[Hardware Error]: event severity: fatal
>     {1}[Hardware Error]:  Error 0, type: fatal
>     {1}[Hardware Error]:   section_type: PCIe error
>     {1}[Hardware Error]:   port_type: 4, root port
>     {1}[Hardware Error]:   version: 1.16
>     {1}[Hardware Error]:   command: 0x4010, status: 0x0143
>     {1}[Hardware Error]:   device_id: 0000:00:02.2
>     {1}[Hardware Error]:   slot: 0
>     {1}[Hardware Error]:   secondary_bus: 0x04
>     {1}[Hardware Error]:   vendor_id: 0x8086, device_id: 0x2f06
>     {1}[Hardware Error]:   class_code: 000604
>     {1}[Hardware Error]:   bridge: secondary_status: 0x2000, control:
> 0x0003
>     {1}[Hardware Error]:   aer_uncor_status: 0x00100000,
> aer_uncor_mask: 0x00000000
>     {1}[Hardware Error]:   aer_uncor_severity: 0x00062030
>     {1}[Hardware Error]:   TLP Header: 40000018 040000ff 791f4080
> 00000000
> [hw error repeats]
>     Kernel panic - not syncing: Fatal hardware error!
>     CPU: 0 PID: 2189 Comm: reboot Kdump: loaded Not tainted 5.6.x-
> blabla #1
>     Hardware name: HP ProLiant DL380 Gen9/ProLiant DL380 Gen9, BIOS
> P89 05/05/2017
> 
> Fix the mlx4 driver.
> 
> This is a very similar problem to what had been fixed in:
> commit 0d98ba8d70b0 ("scsi: hpsa: disable device during shutdown")
> to address https://bugzilla.kernel.org/show_bug.cgi?id=199779.
> 
> Fixes: 2ba5fbd62b25 ("net/mlx4_core: Handle AER flow properly")
> Reported-by: Jake Lawrence <lawja@fb.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>

> ---
>  drivers/net/ethernet/mellanox/mlx4/main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c
> b/drivers/net/ethernet/mellanox/mlx4/main.c
> index 3d9aa7da95e9..2d3e45780719 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/main.c
> @@ -4356,12 +4356,14 @@ static void mlx4_pci_resume(struct pci_dev
> *pdev)
>  static void mlx4_shutdown(struct pci_dev *pdev)
>  {
>  	struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev);
> +	struct mlx4_dev *dev = persist->dev;
>  
>  	mlx4_info(persist->dev, "mlx4_shutdown was called\n");
>  	mutex_lock(&persist->interface_state_mutex);
>  	if (persist->interface_state & MLX4_INTERFACE_STATE_UP)
>  		mlx4_unload_one(pdev);
>  	mutex_unlock(&persist->interface_state_mutex);
> +	mlx4_pci_disable_device(dev);
>  }
>  
>  static const struct pci_error_handlers mlx4_err_handler = {

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

* Re: [PATCH net] mlx4: disable device on shutdown
  2020-07-24 23:15 [PATCH net] mlx4: disable device on shutdown Jakub Kicinski
  2020-07-28  8:53 ` Saeed Mahameed
@ 2020-07-29  0:12 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-07-29  0:12 UTC (permalink / raw)
  To: kuba; +Cc: netdev, kernel-team, tariqt, ogerlitz, yishaih, saeedm, lawja

From: Jakub Kicinski <kuba@kernel.org>
Date: Fri, 24 Jul 2020 16:15:43 -0700

> It appears that not disabling a PCI device on .shutdown may lead to
> a Hardware Error with particular (perhaps buggy) BIOS versions:
 ...
> Fix the mlx4 driver.
> 
> This is a very similar problem to what had been fixed in:
> commit 0d98ba8d70b0 ("scsi: hpsa: disable device during shutdown")
> to address https://bugzilla.kernel.org/show_bug.cgi?id=199779.
> 
> Fixes: 2ba5fbd62b25 ("net/mlx4_core: Handle AER flow properly")
> Reported-by: Jake Lawrence <lawja@fb.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2020-07-29  0:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24 23:15 [PATCH net] mlx4: disable device on shutdown Jakub Kicinski
2020-07-28  8:53 ` Saeed Mahameed
2020-07-29  0:12 ` David Miller

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).