Skip to contentSkip to conversation

EEH recovery failing on mlx5 card

DISCUSSION Leon Romanovsky 2 participants 3 messages Jul 17, 2023 – Jul 19, 2023 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

+ Moshe

Quoted 16 lines · Ganesh G R

Hi,

mlx5 cards are failing to recover from PCI errors, Upon investigation we found that the driver is trying to do MMIO in the middle of EEH error handling.
The following fix in mlx5_pci_err_detected() is fixing the issue, Do you think its the right fix?

(quoted diff) +1 -0
@@ -1847,6 +1847,7 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
        mlx5_unload_one(dev, true);
        mlx5_drain_health_wq(dev);
        mlx5_pci_disable_device(dev);
+       cancel_delayed_work_sync(&clock->timer.overflow_work);
        res = state == pci_channel_io_perm_failure ?
                PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET;
 

Regards
Ganesh

#2 lore raw
Quoted 10 lines · Leon Romanovsky

+ Moshe

Quoted 6 lines · Ganesh G R

Hi,

mlx5 cards are failing to recover from PCI errors, Upon investigation we found that the driver is trying to do MMIO in the middle of EEH error handling.
The following fix in mlx5_pci_err_detected() is fixing the issue, Do you think its the right fix?

Quoted 8 lines

Review static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, · line 1853

Quoted 8 lines
(quoted diff) +1 -0
@@ -1847,6 +1847,7 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
         mlx5_unload_one(dev, true);
         mlx5_drain_health_wq(dev);
         mlx5_pci_disable_device(dev);
+       cancel_delayed_work_sync(&clock->timer.overflow_work);
         res = state == pci_channel_io_perm_failure ?
                 PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET;
 

Hi Ganesh,
Thanks for pointing to this issue and its solution! I would rather fix it in the work itself. Please test this fix instead :

drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +5 -0
index 973babfaff25..2ad0bcc0f1b1 100644
@@ -227,10 +227,15 @@ static void mlx5_timestamp_overflow(struct work_struct *work)
        clock = container_of(timer, struct mlx5_clock, timer);
        mdev = container_of(clock, struct mlx5_core_dev, clock);
 
+       if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
+              goto out;
+
        write_seqlock_irqsave(&clock->lock, flags);
        timecounter_read(&timer->tc);
        mlx5_update_clock_info_page(mdev);
        write_sequnlock_irqrestore(&clock->lock, flags);
+
+out:
        schedule_delayed_work(&timer->overflow_work, 

timer->overflow_period);
}

Quoted 2 lines
Quoted 2 lines

Regards
Ganesh

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 35 lines · Ganesh G R
Quoted 32 lines · Moshe Shemesh
Quoted 13 lines · Leon Romanovsky

+ Moshe

Review static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, · line 1852

Quoted 11 lines · Ganesh G R

Hi,
mlx5 cards are failing to recover from PCI errors, Upon investigation we found that the driver is trying to do MMIO in the middle of EEH error handling.
The following fix in mlx5_pci_err_detected() is fixing the issue, Do you think its the right fix?

(quoted diff) +1 -0
@@ -1847,6 +1847,7 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
          mlx5_unload_one(dev, true);
          mlx5_drain_health_wq(dev);
          mlx5_pci_disable_device(dev);
+       cancel_delayed_work_sync(&clock->timer.overflow_work);
          res = state == pci_channel_io_perm_failure ?
                  PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET;

Hi Ganesh,
Thanks for pointing to this issue and its solution! I would rather fix it in the work itself. Please test this fix instead :

drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +3 -0
index 973babfaff25..2ad0bcc0f1b1 100644
@@ -227,10 +227,15 @@ static void mlx5_timestamp_overflow(struct
 work_struct *work)
         clock = container_of(timer, struct mlx5_clock, timer);
         mdev = container_of(clock, struct mlx5_core_dev, clock);
+       if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
+              goto out;
+
         write_seqlock_irqsave(&clock->lock, flags);
         timecounter_read(&timer->tc);
Quoted 9 lines

drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c static void mlx5_timestamp_overflow(struct work_struct *work)

Quoted 7 lines
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +2 -0
         mlx5_update_clock_info_page(mdev);
         write_sequnlock_irqrestore(&clock->lock, flags);
+
+out:
         schedule_delayed_work(&timer->overflow_work,
 timer->overflow_period);
  }

Thanks Moshe, The fix looks clean and It worked.

Great, thank you !