Skip to content

Commit caf91cd

Browse files
vcgomesvinodkoul
authored andcommitted
dmaengine: idxd: Fix lockdep warnings when calling idxd_device_config()
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>
1 parent 77b19d0 commit caf91cd

2 files changed

Lines changed: 11 additions & 16 deletions

File tree

drivers/dma/idxd/device.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,11 @@ int idxd_device_config(struct idxd_device *idxd)
11251125
{
11261126
int rc;
11271127

1128-
lockdep_assert_held(&idxd->dev_lock);
1128+
guard(spinlock)(&idxd->dev_lock);
1129+
1130+
if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
1131+
return 0;
1132+
11291133
rc = idxd_wqs_setup(idxd);
11301134
if (rc < 0)
11311135
return rc;
@@ -1454,11 +1458,7 @@ int idxd_drv_enable_wq(struct idxd_wq *wq)
14541458
}
14551459
}
14561460

1457-
rc = 0;
1458-
spin_lock(&idxd->dev_lock);
1459-
if (test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
1460-
rc = idxd_device_config(idxd);
1461-
spin_unlock(&idxd->dev_lock);
1461+
rc = idxd_device_config(idxd);
14621462
if (rc < 0) {
14631463
dev_dbg(dev, "Writing wq %d config failed: %d\n", wq->id, rc);
14641464
goto err;
@@ -1554,10 +1554,7 @@ int idxd_device_drv_probe(struct idxd_dev *idxd_dev)
15541554
}
15551555

15561556
/* Device configuration */
1557-
spin_lock(&idxd->dev_lock);
1558-
if (test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
1559-
rc = idxd_device_config(idxd);
1560-
spin_unlock(&idxd->dev_lock);
1557+
rc = idxd_device_config(idxd);
15611558
if (rc < 0)
15621559
return -ENXIO;
15631560

drivers/dma/idxd/init.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,12 +1104,10 @@ static void idxd_reset_done(struct pci_dev *pdev)
11041104
idxd_device_config_restore(idxd, idxd->idxd_saved);
11051105

11061106
/* Re-configure IDXD device if allowed. */
1107-
if (test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) {
1108-
rc = idxd_device_config(idxd);
1109-
if (rc < 0) {
1110-
dev_err(dev, "HALT: %s config fails\n", idxd_name);
1111-
goto out;
1112-
}
1107+
rc = idxd_device_config(idxd);
1108+
if (rc < 0) {
1109+
dev_err(dev, "HALT: %s config fails\n", idxd_name);
1110+
goto out;
11131111
}
11141112

11151113
/* Bind IDXD device to driver. */

0 commit comments

Comments
 (0)