DMA Engine development
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: Check for driver name match before sva user feature
@ 2024-04-03  5:07 Jerry Snitselaar
  2024-04-03 15:23 ` Dave Jiang
  0 siblings, 1 reply; 3+ messages in thread
From: Jerry Snitselaar @ 2024-04-03  5:07 UTC (permalink / raw)
  To: Fenghua Yu, Dave Jiang; +Cc: Vinod Koul, dmaengine, linux-kernel

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.

Cc: Vinod Koul <vkoul@kernel.org>
Cc: dmaengine@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
 drivers/dma/idxd/cdev.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
index 8078ab9acfbc..a4b771781afc 100644
--- a/drivers/dma/idxd/cdev.c
+++ b/drivers/dma/idxd/cdev.c
@@ -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;
 	}
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: idxd: Check for driver name match before sva user feature
  2024-04-03  5:07 [PATCH] dmaengine: idxd: Check for driver name match before sva user feature Jerry Snitselaar
@ 2024-04-03 15:23 ` Dave Jiang
  2024-04-05 20:05   ` Fenghua Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jiang @ 2024-04-03 15:23 UTC (permalink / raw)
  To: Jerry Snitselaar, Fenghua Yu; +Cc: Vinod Koul, dmaengine, linux-kernel



On 4/2/24 10:07 PM, Jerry Snitselaar wrote:
> 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.
> 
> Cc: Vinod Koul <vkoul@kernel.org>
> Cc: dmaengine@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>

Seems reasonable. Thanks!

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/dma/idxd/cdev.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
> index 8078ab9acfbc..a4b771781afc 100644
> --- a/drivers/dma/idxd/cdev.c
> +++ b/drivers/dma/idxd/cdev.c
> @@ -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;
>  	}
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: idxd: Check for driver name match before sva user feature
  2024-04-03 15:23 ` Dave Jiang
@ 2024-04-05 20:05   ` Fenghua Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Fenghua Yu @ 2024-04-05 20:05 UTC (permalink / raw)
  To: Jerry Snitselaar, Dave Jiang; +Cc: Vinod Koul, dmaengine, linux-kernel

On 4/2/24 10:07 PM, Jerry Snitselaar wrote:
> Currenty if the user driver is probed on a workqueue configured for

s/Currenty/Currently/

> 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.
>
> Cc: Vinod Koul <vkoul@kernel.org>
> Cc: dmaengine@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>

Other than the typo,

Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>

Thanks.

-Fenghua

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-05 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03  5:07 [PATCH] dmaengine: idxd: Check for driver name match before sva user feature Jerry Snitselaar
2024-04-03 15:23 ` Dave Jiang
2024-04-05 20:05   ` Fenghua Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox