Skip to contentSkip to conversation

dmaengine: idxd: Check for driver name match before sva user feature

PATCH Superseded Jerry Snitselaar 3 participants 3 messages Apr 3, 2024 – Apr 5, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: idxd: Check for driver name match before sva user feature

Currenty if the user driver is probed on a workqueue configured for another driver with SVA not enabled on the system, it will print out a number of probe failing messages like the following:

    [   264.831140] user: probe of wq13.0 failed with error -95

On some systems, such as GNR, the number of messages can reach over 100.

Move the SVA feature check to be after the driver name match check.

---
 drivers/dma/idxd/cdev.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/dma/idxd/cdev.c +9 -8
index 8078ab9acfbc..a4b771781afc 100644
@@ -517,6 +517,14 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev)
 	if (idxd->state != IDXD_DEV_ENABLED)
 		return -ENXIO;
 
+	mutex_lock(&wq->wq_lock);
+
+	if (!idxd_wq_driver_name_match(wq, dev)) {
+		idxd->cmd_status = IDXD_SCMD_WQ_NO_DRV_NAME;
+		rc = -ENODEV;
+		goto wq_err;
+	}
+
 	/*
 	 * User type WQ is enabled only when SVA is enabled for two reasons:
 	 *   - If no IOMMU or IOMMU Passthrough without SVA, userspace
@@ -532,14 +540,7 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev)
 		dev_dbg(&idxd->pdev->dev,
 			"User type WQ cannot be enabled without SVA.\n");
 
-		return -EOPNOTSUPP;
-	}
-
-	mutex_lock(&wq->wq_lock);
-
-	if (!idxd_wq_driver_name_match(wq, dev)) {
-		idxd->cmd_status = IDXD_SCMD_WQ_NO_DRV_NAME;
-		rc = -ENODEV;
+		rc = -EOPNOTSUPP;
 		goto wq_err;
 	}
 
Signature · 1 line
2.44.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jerry Snitselaar

Currenty if the user driver is probed on a workqueue configured for another driver with SVA not enabled on the system, it will print out a number of probe failing messages like the following:

    [   264.831140] user: probe of wq13.0 failed with error -95

On some systems, such as GNR, the number of messages can reach over 100.

Quoted 7 lines

Move the SVA feature check to be after the driver name match check.

Seems reasonable. Thanks!

Quoted 39 lines
---
 drivers/dma/idxd/cdev.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/dma/idxd/cdev.c +9 -8
index 8078ab9acfbc..a4b771781afc 100644
@@ -517,6 +517,14 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev)
 	if (idxd->state != IDXD_DEV_ENABLED)
 		return -ENXIO;
 
+	mutex_lock(&wq->wq_lock);
+
+	if (!idxd_wq_driver_name_match(wq, dev)) {
+		idxd->cmd_status = IDXD_SCMD_WQ_NO_DRV_NAME;
+		rc = -ENODEV;
+		goto wq_err;
+	}
+
 	/*
 	 * User type WQ is enabled only when SVA is enabled for two reasons:
 	 *   - If no IOMMU or IOMMU Passthrough without SVA, userspace
@@ -532,14 +540,7 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev)
 		dev_dbg(&idxd->pdev->dev,
 			"User type WQ cannot be enabled without SVA.\n");
 
-		return -EOPNOTSUPP;
-	}
-
-	mutex_lock(&wq->wq_lock);
-
-	if (!idxd_wq_driver_name_match(wq, dev)) {
-		idxd->cmd_status = IDXD_SCMD_WQ_NO_DRV_NAME;
-		rc = -ENODEV;
+		rc = -EOPNOTSUPP;
 		goto wq_err;
 	}
 
Reviewed-by
#2 lore raw
Quoted 1 line · Jerry Snitselaar

Currenty if the user driver is probed on a workqueue configured for

s/Currenty/Currently/

Quoted 8 lines

another driver with SVA not enabled on the system, it will print out a number of probe failing messages like the following:

     [   264.831140] user: probe of wq13.0 failed with error -95

On some systems, such as GNR, the number of messages can reach over 100.

Quoted 7 lines

Move the SVA feature check to be after the driver name match check.

Other than the typo,

Thanks.

-Fenghua