linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v0] Crypto: Talitos: re-initialize async_tx descriptors
@ 2009-12-14 13:33 Vishnu Suresh
  2009-12-15  7:29 ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Vishnu Suresh @ 2009-12-14 13:33 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel, linux-raid, dan.j.williams,
	linux-crypto, herbert
  Cc: B04825, R58472, Vishnu Suresh

The async_tx descriptors contains dangling pointers.
Hence, re-initialize them to NULL before use.

Signed-off-by: Vishnu Suresh <Vishnu@freescale.com>
---
o. Rebased to linux-next as of 20091214

 drivers/crypto/talitos.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 87f06be..9e261c6 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -952,6 +952,9 @@ static struct dma_async_tx_descriptor * talitos_prep_dma_xor(
 		return NULL;
 	}
 	dma_async_tx_descriptor_init(&new->async_tx, &xor_chan->common);
+	new->async_tx.parent = NULL;
+	new->async_tx.next = NULL;
+
 
 	desc = &new->hwdesc;
 	/* Set destination: Last pointer pair */
-- 
1.6.4.2


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

* Re: [PATCH v0] Crypto: Talitos: re-initialize async_tx descriptors
  2009-12-14 13:33 [PATCH v0] Crypto: Talitos: re-initialize async_tx descriptors Vishnu Suresh
@ 2009-12-15  7:29 ` Dan Williams
  2009-12-15 11:03   ` Suresh Vishnu-B05022
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2009-12-15  7:29 UTC (permalink / raw)
  To: Vishnu Suresh
  Cc: linuxppc-dev, linux-kernel, linux-raid, linux-crypto, herbert,
	B04825, R58472

On Mon, Dec 14, 2009 at 6:33 AM, Vishnu Suresh <Vishnu@freescale.com> wrote:
> The async_tx descriptors contains dangling pointers.
> Hence, re-initialize them to NULL before use.
>
> Signed-off-by: Vishnu Suresh <Vishnu@freescale.com>
> ---
> o. Rebased to linux-next as of 20091214
>
>  drivers/crypto/talitos.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
> index 87f06be..9e261c6 100644
> --- a/drivers/crypto/talitos.c
> +++ b/drivers/crypto/talitos.c
> @@ -952,6 +952,9 @@ static struct dma_async_tx_descriptor * talitos_prep_dma_xor(
>                return NULL;
>        }
>        dma_async_tx_descriptor_init(&new->async_tx, &xor_chan->common);
> +       new->async_tx.parent = NULL;
> +       new->async_tx.next = NULL;
> +
>
>        desc = &new->hwdesc;
>        /* Set destination: Last pointer pair */

These two values are owned by the async_tx api, drivers are not
supposed to touch them.  Both iop_adma and the new ppx4xx driver
(which use the async_tx channel switching capability) get away without
touching these fields which makes me suspect there is a
misunderstanding/bug somewhere else in the talitos implementation.
Also that dma_async_tx_descriptor_init() is unexpected in the hot
path, it's only needed at initial descriptor allocation.  End result I
think this driver needs some more time to brew.

--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH v0] Crypto: Talitos: re-initialize async_tx descriptors
  2009-12-15  7:29 ` Dan Williams
@ 2009-12-15 11:03   ` Suresh Vishnu-B05022
  2009-12-15 18:23     ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Suresh Vishnu-B05022 @ 2009-12-15 11:03 UTC (permalink / raw)
  To: Dan Williams
  Cc: herbert, Tabi Timur-B04825, linux-kernel, linux-raid,
	linuxppc-dev, linux-crypto, Li Yang-R58472


[-- Attachment #1.1: Type: text/plain, Size: 2185 bytes --]

> On Mon, Dec 14, 2009 at 6:33 AM, Vishnu Suresh <Vishnu@freescale.com> wrote:
> > The async_tx descriptors contains dangling pointers.
> > Hence, re-initialize them to NULL before use.
> >
> > Signed-off-by: Vishnu Suresh <Vishnu@freescale.com>
> > ---
> > o. Rebased to linux-next as of 20091214
> >
> >  drivers/crypto/talitos.c |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
> > index 87f06be..9e261c6 100644
> > --- a/drivers/crypto/talitos.c
> > +++ b/drivers/crypto/talitos.c
> > @@ -952,6 +952,9 @@ static struct dma_async_tx_descriptor * talitos_prep_dma_xor(
> >                return NULL;
> >        }
> >        dma_async_tx_descriptor_init(&new->async_tx, &xor_chan->common);
> > +       new->async_tx.parent = NULL;
> > +       new->async_tx.next = NULL;
> > +
> >
> >        desc = &new->hwdesc;
> >        /* Set destination: Last pointer pair */

> These two values are owned by the async_tx api, drivers are not
> supposed to touch them.
I have sent this patch and the similar one for fsldma seperately, 
so that if the changes are needed and can be done in dma_async_tx_descriptor_init(), 
these patches can be ignored.  
> Both iop_adma and the new ppx4xx driver
> (which use the async_tx channel switching capability) get away without
> touching these fields which makes me suspect there is a
> misunderstanding/bug somewhere else in the talitos implementation.

This bug does not occur on all the platforms. The occurrance is random. 
This occurs when a channel switch between two different devices are present. 
This same initialization is required in case of fsldma as well. 
In case of fsldma/talitosXOR, there are two DMA channels (on same device) and single XOR channel (on another device). 

When used without fsldma, this driver works fine.
Does iop_adma and ppx4xx work in similar enviroment?

> > Also that dma_async_tx_descriptor_init() is unexpected in the hot
> > path, it's only needed at initial descriptor allocation.  End result I
> > think this driver needs some more time to brew.



> --
> Dan




[-- Attachment #1.2: Type: text/html, Size: 3265 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* Re: [PATCH v0] Crypto: Talitos: re-initialize async_tx descriptors
  2009-12-15 11:03   ` Suresh Vishnu-B05022
@ 2009-12-15 18:23     ` Dan Williams
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Williams @ 2009-12-15 18:23 UTC (permalink / raw)
  To: Suresh Vishnu-B05022
  Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
	linux-raid@vger.kernel.org, linux-crypto@vger.kernel.org,
	herbert@gondor.apana.org.au, Tabi Timur-B04825, Li Yang-R58472,
	Ira Snyder

Suresh Vishnu-B05022 wrote:
>  > On Mon, Dec 14, 2009 at 6:33 AM, Vishnu Suresh <Vishnu@freescale.com> 
> wrote:
>  > > The async_tx descriptors contains dangling pointers.
>  > > Hence, re-initialize them to NULL before use.
>  > >
>  > > Signed-off-by: Vishnu Suresh <Vishnu@freescale.com>
>  > > ---
>  > > o. Rebased to linux-next as of 20091214
>  > >
>  > >  drivers/crypto/talitos.c |    3 +++
>  > >  1 files changed, 3 insertions(+), 0 deletions(-)
>  > >
>  > > diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
>  > > index 87f06be..9e261c6 100644
>  > > --- a/drivers/crypto/talitos.c
>  > > +++ b/drivers/crypto/talitos.c
>  > > @@ -952,6 +952,9 @@ static struct dma_async_tx_descriptor * 
> talitos_prep_dma_xor(
>  > >                return NULL;
>  > >        }
>  > >        dma_async_tx_descriptor_init(&new->async_tx, &xor_chan->common);
>  > > +       new->async_tx.parent = NULL;
>  > > +       new->async_tx.next = NULL;
>  > > +
>  > >
>  > >        desc = &new->hwdesc;
>  > >        /* Set destination: Last pointer pair */
> 
>  > These two values are owned by the async_tx api, drivers are not
>  > supposed to touch them.
> I have sent this patch and the similar one for fsldma seperately,
> so that if the changes are needed and can be done in 
> dma_async_tx_descriptor_init(),
> these patches can be ignored. 
>  > Both iop_adma and the new ppx4xx driver
>  > (which use the async_tx channel switching capability) get away without
>  > touching these fields which makes me suspect there is a
>  > misunderstanding/bug somewhere else in the talitos implementation.
> 
> This bug does not occur on all the platforms. The occurrance is random.
> This occurs when a channel switch between two different devices are 
> present.
> This same initialization is required in case of fsldma as well. 
> In case of fsldma/talitosXOR, there are two DMA channels (on same 
> device) and single XOR channel (on another device).
> 
> When used without fsldma, this driver works fine.
> Does iop_adma and ppx4xx work in similar enviroment?

Yes, iop_adma when running on iop3xx hardware has one xor channel and 
two memcpy channels.

The bug may very well be in the fsldma driver, but the workarounds are 
just band aids.  I would be more comfortable with dropping the three 
workaround patches and simply adding "depends on !FSL_DMA" to the 
CRYPTO_DEV_TALITOS option until the true fix can be developed.

--
Dan


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

end of thread, other threads:[~2009-12-15 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-14 13:33 [PATCH v0] Crypto: Talitos: re-initialize async_tx descriptors Vishnu Suresh
2009-12-15  7:29 ` Dan Williams
2009-12-15 11:03   ` Suresh Vishnu-B05022
2009-12-15 18:23     ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).