Author: hselasky
Date: Thu Mar  8 09:51:33 2018
New Revision: 330645
URL: https://svnweb.freebsd.org/changeset/base/330645

Log:
  Avoid calling sleeping function from the health poll thread in mlx5core.
  
  linux commit c1d4d2e92ad670168a17a57dfa182a5a5baa72d4
  
  Submitted by: Matthew Finlay <m...@mellanox.com>
  MFC after:    1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Thu Mar  8 09:47:09 2018        
(r330644)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Thu Mar  8 09:51:33 2018        
(r330645)
@@ -87,15 +87,23 @@ static int in_fatal(struct mlx5_core_dev *dev)
 
 void mlx5_enter_error_state(struct mlx5_core_dev *dev)
 {
-       if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
+       mutex_lock(&dev->intf_state_mutex);
+       if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
+               goto unlock;
                return;
+       }
 
        mlx5_core_err(dev, "start\n");
-       if (pci_channel_offline(dev->pdev) || in_fatal(dev))
+       if (pci_channel_offline(dev->pdev) || in_fatal(dev)) {
                dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
+               mlx5_trigger_cmd_completions(dev);
+       }
 
        mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0);
        mlx5_core_err(dev, "end\n");
+
+unlock:
+       mutex_unlock(&dev->intf_state_mutex);
 }
 
 static void mlx5_handle_bad_state(struct mlx5_core_dev *dev)
@@ -213,7 +221,6 @@ static void poll_health(unsigned long data)
                return;
 
        if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
-               mlx5_trigger_cmd_completions(dev);
                mod_timer(&health->timer, get_next_poll_jiffies());
                return;
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to