Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Vinicius Costa Gomes and committed by
Vinod Koul
caf91cdf 77b19d05

+11 -16
+7 -10
drivers/dma/idxd/device.c
··· 1125 1125 { 1126 1126 int rc; 1127 1127 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 + 1129 1133 rc = idxd_wqs_setup(idxd); 1130 1134 if (rc < 0) 1131 1135 return rc; ··· 1458 1454 } 1459 1455 } 1460 1456 1461 - rc = 0; 1462 - spin_lock(&idxd->dev_lock); 1463 - if (test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) 1464 - rc = idxd_device_config(idxd); 1465 - spin_unlock(&idxd->dev_lock); 1457 + rc = idxd_device_config(idxd); 1466 1458 if (rc < 0) { 1467 1459 dev_dbg(dev, "Writing wq %d config failed: %d\n", wq->id, rc); 1468 1460 goto err; ··· 1554 1554 } 1555 1555 1556 1556 /* 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); 1561 1558 if (rc < 0) 1562 1559 return -ENXIO; 1563 1560
+4 -6
drivers/dma/idxd/init.c
··· 1104 1104 idxd_device_config_restore(idxd, idxd->idxd_saved); 1105 1105 1106 1106 /* 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; 1113 1111 } 1114 1112 1115 1113 /* Bind IDXD device to driver. */