diff mbox

incorrect use of init_completion fixup

Message ID 1419357151-22889-1-git-send-email-der.herr@hofr.at (mailing list archive)
State Not Applicable
Headers show

Commit Message

Nicholas Mc Guire Dec. 23, 2014, 5:52 p.m. UTC
The successive init_completion calls should be reinit_completion here.

patch is against 3.18.0 linux-next

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
 drivers/dma/ioat/dma_v3.c |    4 +-
 1 files changed, 2 insertions(+), 2 deletions(-)

--
1.7.10.4

--
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

Comments

Prarit Bhargava Dec. 24, 2014, 7:01 p.m. UTC | #1
On 12/23/2014 12:52 PM, Nicholas Mc Guire wrote:
> The successive init_completion calls should be reinit_completion here.
> 

Hi Nicholas,

I know enough about this code to break it ;) ... what condition did you hit that
led you to this patch?

P.

> patch is against 3.18.0 linux-next
> 
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> ---
>  drivers/dma/ioat/dma_v3.c |    4 +-
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
> index 32eae38..3dbcc42 100644
> --- a/drivers/dma/ioat/dma_v3.c
> +++ b/drivers/dma/ioat/dma_v3.c
> @@ -1353,7 +1353,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)
>  	}
> 
>  	async_tx_ack(tx);
> -	init_completion(&cmp);
> +	reinit_completion(&cmp);
>  	tx->callback = ioat3_dma_test_callback;
>  	tx->callback_param = &cmp;
>  	cookie = tx->tx_submit(tx);
> @@ -1405,7 +1405,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)
>  	}
> 
>  	async_tx_ack(tx);
> -	init_completion(&cmp);
> +	reinit_completion(&cmp);
>  	tx->callback = ioat3_dma_test_callback;
>  	tx->callback_param = &cmp;
>  	cookie = tx->tx_submit(tx);
> --
> 1.7.10.4
> 
--
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
Nicholas Mc Guire Dec. 24, 2014, 7:11 p.m. UTC | #2
On Wed, 24 Dec 2014, Prarit Bhargava wrote:

> 
> 
> On 12/23/2014 12:52 PM, Nicholas Mc Guire wrote:
> > The successive init_completion calls should be reinit_completion here.
> > 
> 
> Hi Nicholas,
> 
> I know enough about this code to break it ;) ... what condition did you hit that
> led you to this patch?
>

Was writing up documentation for completion (also posted today) and the 
intended API is reinit_completion which is just resetting the counter but
not touching the related waitqueu. So the failure scenario would be
a race between accessing elements on the current wait-queue and the 
init_completion reinitializing this very wait-queue. 

Further if switching from init_completion -> reinit_completion brakes
anything then it really *is* broken now.

thx!
hofrat
--
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 32eae38..3dbcc42 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -1353,7 +1353,7 @@  static int ioat_xor_val_self_test(struct ioatdma_device *device)
 	}

 	async_tx_ack(tx);
-	init_completion(&cmp);
+	reinit_completion(&cmp);
 	tx->callback = ioat3_dma_test_callback;
 	tx->callback_param = &cmp;
 	cookie = tx->tx_submit(tx);
@@ -1405,7 +1405,7 @@  static int ioat_xor_val_self_test(struct ioatdma_device *device)
 	}

 	async_tx_ack(tx);
-	init_completion(&cmp);
+	reinit_completion(&cmp);
 	tx->callback = ioat3_dma_test_callback;
 	tx->callback_param = &cmp;
 	cookie = tx->tx_submit(tx);