]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dmaengine: idxd: Fix lockdep warnings when calling idxd_device_config()
authorVinicius Costa Gomes <vinicius.gomes@intel.com>
Wed, 21 Jan 2026 18:34:27 +0000 (10:34 -0800)
committerVinod Koul <vkoul@kernel.org>
Wed, 25 Feb 2026 11:09:17 +0000 (16:39 +0530)
Move the check for IDXD_FLAG_CONFIGURABLE and the locking to "inside"
idxd_device_config(), as this is common to all callers, and the one
that wasn't holding the lock was an error (that was causing the
lockdep warning).

Suggested-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Link: https://patch.msgid.link/20260121-idxd-fix-flr-on-kernel-queues-v3-v3-1-7ed70658a9d1@intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/idxd/device.c
drivers/dma/idxd/init.c

index c26128529ff49a84bc457a6aed1026b10e8565cf..a704475d87b323a21657545670f8cc02c1e06dd6 100644 (file)
@@ -1125,7 +1125,11 @@ int idxd_device_config(struct idxd_device *idxd)
 {
        int rc;
 
-       lockdep_assert_held(&idxd->dev_lock);
+       guard(spinlock)(&idxd->dev_lock);
+
+       if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
+               return 0;
+
        rc = idxd_wqs_setup(idxd);
        if (rc < 0)
                return rc;
@@ -1454,11 +1458,7 @@ int idxd_drv_enable_wq(struct idxd_wq *wq)
                }
        }
 
-       rc = 0;
-       spin_lock(&idxd->dev_lock);
-       if (test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
-               rc = idxd_device_config(idxd);
-       spin_unlock(&idxd->dev_lock);
+       rc = idxd_device_config(idxd);
        if (rc < 0) {
                dev_dbg(dev, "Writing wq %d config failed: %d\n", wq->id, rc);
                goto err;
@@ -1554,10 +1554,7 @@ int idxd_device_drv_probe(struct idxd_dev *idxd_dev)
        }
 
        /* Device configuration */
-       spin_lock(&idxd->dev_lock);
-       if (test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
-               rc = idxd_device_config(idxd);
-       spin_unlock(&idxd->dev_lock);
+       rc = idxd_device_config(idxd);
        if (rc < 0)
                return -ENXIO;
 
index fb80803d5b57360938bf51966e1a267dbedb57b2..dd32b81a3108c47e6e303a4bbd3d39e96049f907 100644 (file)
@@ -1104,12 +1104,10 @@ static void idxd_reset_done(struct pci_dev *pdev)
        idxd_device_config_restore(idxd, idxd->idxd_saved);
 
        /* Re-configure IDXD device if allowed. */
-       if (test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) {
-               rc = idxd_device_config(idxd);
-               if (rc < 0) {
-                       dev_err(dev, "HALT: %s config fails\n", idxd_name);
-                       goto out;
-               }
+       rc = idxd_device_config(idxd);
+       if (rc < 0) {
+               dev_err(dev, "HALT: %s config fails\n", idxd_name);
+               goto out;
        }
 
        /* Bind IDXD device to driver. */