diff mbox

[v2] ioat: fail self-test if wait_for_completion times out

Message ID 1420726595-29152-1-git-send-email-der.herr@hofr.at (mailing list archive)
State Accepted
Headers show

Commit Message

Nicholas Mc Guire Jan. 8, 2015, 2:16 p.m. UTC
wait_for_completion_timeout reaching timeout was being ignored,
fail the self-test if timeout condition occurs.

v2: fixup of coding style issues.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---

this was only compile tested with
x86_64_defconfig + CONFIG_DMA_ENGINE=y + CONFIG_INTEL_IOATDMA=m

patch is against linux-next 3.19.0-rc3 -next-20150108

 drivers/dma/ioat/dma_v3.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Dave Jiang Jan. 8, 2015, 3:51 p.m. UTC | #1
On Thu, 2015-01-08 at 14:16 +0000, Nicholas Mc Guire wrote:
> wait_for_completion_timeout reaching timeout was being ignored,

> fail the self-test if timeout condition occurs.

> 

> v2: fixup of coding style issues.

> 

> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>

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


> ---

> 

> this was only compile tested with

> x86_64_defconfig + CONFIG_DMA_ENGINE=y + CONFIG_INTEL_IOATDMA=m

> 

> patch is against linux-next 3.19.0-rc3 -next-20150108

> 

>  drivers/dma/ioat/dma_v3.c |    9 ++++++---

>  1 file changed, 6 insertions(+), 3 deletions(-)

> 

> diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c

> index be307182..a26882e 100644

> --- a/drivers/dma/ioat/dma_v3.c

> +++ b/drivers/dma/ioat/dma_v3.c

> @@ -1311,7 +1311,8 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)

>  

>  	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));

>  

> -	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {

> +	if (tmo == 0 ||

> +	    dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {

>  		dev_err(dev, "Self-test xor timed out\n");

>  		err = -ENODEV;

>  		goto dma_unmap;

> @@ -1377,7 +1378,8 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)

>  

>  	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));

>  

> -	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {

> +	if (tmo == 0 ||

> +	    dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {

>  		dev_err(dev, "Self-test validate timed out\n");

>  		err = -ENODEV;

>  		goto dma_unmap;

> @@ -1429,7 +1431,8 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)

>  

>  	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));

>  

> -	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {

> +	if (tmo == 0 ||

> +	    dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {

>  		dev_err(dev, "Self-test 2nd validate timed out\n");

>  		err = -ENODEV;

>  		goto dma_unmap;
Prarit Bhargava Jan. 8, 2015, 3:57 p.m. UTC | #2
On 01/08/2015 09:16 AM, Nicholas Mc Guire wrote:
> wait_for_completion_timeout reaching timeout was being ignored,
> fail the self-test if timeout condition occurs.
> 
> v2: fixup of coding style issues.
> 
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>


Reviewed-by: Prarit Bhargava <prarit@redhat.com>

P.


> ---
> 
> this was only compile tested with
> x86_64_defconfig + CONFIG_DMA_ENGINE=y + CONFIG_INTEL_IOATDMA=m
> 
> patch is against linux-next 3.19.0-rc3 -next-20150108
> 
>  drivers/dma/ioat/dma_v3.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
> index be307182..a26882e 100644
> --- a/drivers/dma/ioat/dma_v3.c
> +++ b/drivers/dma/ioat/dma_v3.c
> @@ -1311,7 +1311,8 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)
>  
>  	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
>  
> -	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
> +	if (tmo == 0 ||
> +	    dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
>  		dev_err(dev, "Self-test xor timed out\n");
>  		err = -ENODEV;
>  		goto dma_unmap;
> @@ -1377,7 +1378,8 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)
>  
>  	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
>  
> -	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
> +	if (tmo == 0 ||
> +	    dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
>  		dev_err(dev, "Self-test validate timed out\n");
>  		err = -ENODEV;
>  		goto dma_unmap;
> @@ -1429,7 +1431,8 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)
>  
>  	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
>  
> -	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
> +	if (tmo == 0 ||
> +	    dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
>  		dev_err(dev, "Self-test 2nd validate timed out\n");
>  		err = -ENODEV;
>  		goto dma_unmap;
> 
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
index be307182..a26882e 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -1311,7 +1311,8 @@  static int ioat_xor_val_self_test(struct ioatdma_device *device)
 
 	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
 
-	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
+	if (tmo == 0 ||
+	    dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
 		dev_err(dev, "Self-test xor timed out\n");
 		err = -ENODEV;
 		goto dma_unmap;
@@ -1377,7 +1378,8 @@  static int ioat_xor_val_self_test(struct ioatdma_device *device)
 
 	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
 
-	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
+	if (tmo == 0 ||
+	    dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
 		dev_err(dev, "Self-test validate timed out\n");
 		err = -ENODEV;
 		goto dma_unmap;
@@ -1429,7 +1431,8 @@  static int ioat_xor_val_self_test(struct ioatdma_device *device)
 
 	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
 
-	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
+	if (tmo == 0 ||
+	    dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
 		dev_err(dev, "Self-test 2nd validate timed out\n");
 		err = -ENODEV;
 		goto dma_unmap;