From ca2345a05d53e19063a53304c5e9a7d20bc87176 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Fri, 30 Mar 2018 19:49:35 +0000 Subject: [PATCH] Make sure Giant is locked when allocating bus resources in mlx5core. During health care IRQ resources will be reallocated. Newbus requires that Giant is locked before accessing these resources. MFC after: 3 days Sponsored by: Mellanox Technologies --- sys/dev/mlx5/mlx5_core/mlx5_health.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_health.c b/sys/dev/mlx5/mlx5_core/mlx5_health.c index 4aed0766cf65..ba55cd19f05b 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_health.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_health.c @@ -300,6 +300,8 @@ static void health_recover(struct work_struct *work) priv = container_of(health, struct mlx5_priv, health); dev = container_of(priv, struct mlx5_core_dev, priv); + mtx_lock(&Giant); /* XXX newbus needs this */ + if (sensor_pci_no_comm(dev)) { dev_err(&dev->pdev->dev, "health recovery flow aborted, PCI reads still not working\n"); recover = false; @@ -322,6 +324,8 @@ static void health_recover(struct work_struct *work) dev_err(&dev->pdev->dev, "starting health recovery flow\n"); mlx5_recover_device(dev); } + + mtx_unlock(&Giant); } /* How much time to wait until health resetting the driver (in msecs) */