All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] incorrect use of init_completion fixup
@ 2014-12-23 17:44 Nicholas Mc Guire
  0 siblings, 0 replies; 5+ messages in thread
From: Nicholas Mc Guire @ 2014-12-23 17:44 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Nicholas Mc Guire

The second init_completion call should be a reinit_completion here.

patch is against 3.18.0 linux-next

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
 drivers/block/aoe/aoecmd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 422b7d8..2239513 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -1331,7 +1331,7 @@ aoe_ktstart(struct ktstate *k)
 		return -ENOMEM;
 	k->task = task;
 	wait_for_completion(&k->rendez); /* allow kthread to start */
-	init_completion(&k->rendez);	/* for waiting for exit later */
+	reinit_completion(&k->rendez);	/* for waiting for exit later */
 	return 0;
 }

--
1.7.10.4


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

* Re: [PATCH] incorrect use of init_completion fixup
  2014-12-24 19:01 ` Prarit Bhargava
@ 2014-12-24 19:11   ` Nicholas Mc Guire
  0 siblings, 0 replies; 5+ messages in thread
From: Nicholas Mc Guire @ 2014-12-24 19:11 UTC (permalink / raw)
  To: Prarit Bhargava; +Cc: Dan Williams, Vinod Koul, dmaengine, linux-kernel

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

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

* Re: [PATCH] incorrect use of init_completion fixup
  2014-12-23 17:52 Nicholas Mc Guire
@ 2014-12-24 19:01 ` Prarit Bhargava
  2014-12-24 19:11   ` Nicholas Mc Guire
  0 siblings, 1 reply; 5+ messages in thread
From: Prarit Bhargava @ 2014-12-24 19:01 UTC (permalink / raw)
  To: Nicholas Mc Guire; +Cc: Dan Williams, Vinod Koul, dmaengine, linux-kernel



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
> 

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

* Re: [PATCH] incorrect use of init_completion fixup
       [not found] <49ea5f8dc52545d4a5df6b1ad8302410@HT17-E6.exg6.exghost.com>
@ 2014-12-24  2:14 ` Ed Cashin
  0 siblings, 0 replies; 5+ messages in thread
From: Ed Cashin @ 2014-12-24  2:14 UTC (permalink / raw)
  To: Nicholas Mc Guire; +Cc: linux-kernel

On Tue, Dec 23, 2014 at 12:44 PM, Nicholas Mc Guire <der.herr@hofr.at> wrote:
>
> The second init_completion call should be a reinit_completion here.
>
> patch is against 3.18.0 linux-next
>
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> ---
>  drivers/block/aoe/aoecmd.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
> index 422b7d8..2239513 100644
> --- a/drivers/block/aoe/aoecmd.c
> +++ b/drivers/block/aoe/aoecmd.c
> @@ -1331,7 +1331,7 @@ aoe_ktstart(struct ktstate *k)
>                 return -ENOMEM;
>         k->task = task;
>         wait_for_completion(&k->rendez); /* allow kthread to start */
> -       init_completion(&k->rendez);    /* for waiting for exit later */
> +       reinit_completion(&k->rendez);  /* for waiting for exit later */
>         return 0;
>  }

That looks good to me, thanks.

-- 
  Ed Cashin <ecashin@noserose.net>

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

* [PATCH] incorrect use of init_completion fixup
@ 2014-12-23 17:52 Nicholas Mc Guire
  2014-12-24 19:01 ` Prarit Bhargava
  0 siblings, 1 reply; 5+ messages in thread
From: Nicholas Mc Guire @ 2014-12-23 17:52 UTC (permalink / raw)
  To: Dan Williams
  Cc: Vinod Koul, Prarit Bhargava, dmaengine, linux-kernel, Nicholas Mc Guire

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

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


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

end of thread, other threads:[~2014-12-24 19:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-23 17:44 [PATCH] incorrect use of init_completion fixup Nicholas Mc Guire
2014-12-23 17:52 Nicholas Mc Guire
2014-12-24 19:01 ` Prarit Bhargava
2014-12-24 19:11   ` Nicholas Mc Guire
     [not found] <49ea5f8dc52545d4a5df6b1ad8302410@HT17-E6.exg6.exghost.com>
2014-12-24  2:14 ` Ed Cashin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.