linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Qiang-B32616 <B32616@freescale.com>
To: Geanta Neag Horia Ioan-B05471 <B05471@freescale.com>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"dan.j.williams@gmail.com" <dan.j.williams@gmail.com>,
	"herbert@gondor.hengli.com.au" <herbert@gondor.hengli.com.au>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Cc: Li Yang-R58472 <r58472@freescale.com>,
	Phillips Kim-R1AAHA <R1AAHA@freescale.com>,
	"vinod.koul@intel.com" <vinod.koul@intel.com>,
	Dan Williams <djbw@fb.com>, "arnd@arndb.de" <arnd@arndb.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Subject: RE: [PATCH v7 1/8] Talitos: Support for async_tx XOR offload
Date: Fri, 31 Aug 2012 10:41:08 +0000	[thread overview]
Message-ID: <BCB48C05FCE8BC4D9E61E841ECBE6DB70FDD90@039-SN2MPN1-011.039d.mgd.msft.net> (raw)
In-Reply-To: <FD18E5D573A8AB48A365D4D78185DE992E9EFF@039-SN1MPN1-001.039d.mgd.msft.net>

> -----Original Message-----
> From: Geanta Neag Horia Ioan-B05471
> Sent: Friday, August 31, 2012 6:39 PM
> To: Liu Qiang-B32616; linux-crypto@vger.kernel.org;
> dan.j.williams@gmail.com; herbert@gondor.hengli.com.au;
> davem@davemloft.net; linux-kernel@vger.kernel.org; linuxppc-
> dev@lists.ozlabs.org
> Cc: Li Yang-R58472; Phillips Kim-R1AAHA; vinod.koul@intel.com; Dan
> Williams; arnd@arndb.de; gregkh@linuxfoundation.org
> Subject: RE: [PATCH v7 1/8] Talitos: Support for async_tx XOR offload
> 
> On Fri, 31 Aug 2012 06:08:05 +0300, Liu Qiang-B32616
> <B32616@freescale.com>
> wrote:
> > > -----Original Message-----
> > > From: Geanta Neag Horia Ioan-B05471
> > > Sent: Thursday, August 30, 2012 10:23 PM
> > > To: Liu Qiang-B32616; linux-crypto@vger.kernel.org;
> > > dan.j.williams@gmail.com; herbert@gondor.hengli.com.au;
> > > davem@davemloft.net; linux-kernel@vger.kernel.org; linuxppc-
> > > dev@lists.ozlabs.org
> > > Cc: Li Yang-R58472; Phillips Kim-R1AAHA; vinod.koul@intel.com;
> > > dan.j.williams@intel.com; arnd@arndb.de; gregkh@linuxfoundation.org;
> Liu
> > > Qiang-B32616
> > > Subject: RE: [PATCH v7 1/8] Talitos: Support for async_tx XOR offload
> > >
> > > On Thu, 9 Aug 2012 11:20:48 +0300, qiang.liu@freescale.com wrote:
> > > > From: Qiang Liu <qiang.liu@freescale.com>
> > > >
> > > > Expose Talitos's XOR functionality to be used for RAID parity
> > > > calculation via the Async_tx layer.
> > > >
> > > > Cc: Herbert Xu <herbert@gondor.apana.org.au>
> > > > Cc: David S. Miller <davem@davemloft.net>
> > > > Signed-off-by: Dipen Dudhat <Dipen.Dudhat@freescale.com>
> > > > Signed-off-by: Maneesh Gupta <Maneesh.Gupta@freescale.com>
> > > > Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> > > > Signed-off-by: Vishnu Suresh <Vishnu@freescale.com>
> > > > Signed-off-by: Qiang Liu <qiang.liu@freescale.com>
> > > > ---
> > > >  drivers/crypto/Kconfig   |    9 +
> > > >  drivers/crypto/talitos.c |  413
> > > ++++++++++++++++++++++++++++++++++++++++++++++
> > > >  drivers/crypto/talitos.h |   53 ++++++
> > > >  3 files changed, 475 insertions(+), 0 deletions(-)
> > >
> 
> > > > +static int talitos_alloc_chan_resources(struct dma_chan *chan)
> > > > +{
> > > > +	struct talitos_xor_chan *xor_chan;
> > > > +	struct talitos_xor_desc *desc;
> > > > +	LIST_HEAD(tmp_list);
> > > > +	int i;
> > > > +
> > > > +	xor_chan = container_of(chan, struct talitos_xor_chan,
> common);
> > > > +
> > > > +	if (!list_empty(&xor_chan->free_desc))
> > > > +		return xor_chan->total_desc;
> > > > +
> > > > +	for (i = 0; i < TALITOS_MAX_DESCRIPTOR_NR; i++) {
> > > > +		desc = talitos_xor_alloc_descriptor(xor_chan,
> > > > +				GFP_KERNEL | GFP_DMA);
> > >
> > > talitos_xor_alloc_descriptor() is called here without holding
> > > the xor_chan->desc_lock and it increments xor_chan->total_desc.
> > > Isn't this an issue ?
> >
> > No, please refer to the code as below,
> > +	list_add_tail(&desc->node, &tmp_list);
> >
> > The list is temporary list, it will be merged to xor_chan->free_desc in
> next step, here is protected
> > by lock,
> > +	spin_lock_bh(&xor_chan->desc_lock);
> > +	list_splice_init(&tmp_list, &xor_chan->free_desc);
> > +	spin_unlock_bh(&xor_chan->desc_lock);
> 
> I was not referring to the list, but to xor_chan->total_desc variable.
> The following access:
> talitos_alloc_chan_resources()->talitos_xor_alloc_descriptor()-
> >total_desc++
> is not protected by the xor_chan->desc_lock.
Ok, I will correct it in next series. Thanks.



  reply	other threads:[~2012-08-31 10:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-09  8:20 [PATCH v7 1/8] Talitos: Support for async_tx XOR offload qiang.liu
2012-08-30 14:23 ` Geanta Neag Horia Ioan-B05471
2012-08-31  3:08   ` Liu Qiang-B32616
2012-08-31 10:38     ` Geanta Neag Horia Ioan-B05471
2012-08-31 10:41       ` Liu Qiang-B32616 [this message]
2012-09-02  6:47   ` Dan Williams
2012-09-02  8:12 ` Dan Williams
2012-09-04 12:28   ` Liu Qiang-B32616
2012-09-05  1:19     ` Dan Williams
2012-09-12  9:45       ` Liu Qiang-B32616

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BCB48C05FCE8BC4D9E61E841ECBE6DB70FDD90@039-SN2MPN1-011.039d.mgd.msft.net \
    --to=b32616@freescale.com \
    --cc=B05471@freescale.com \
    --cc=R1AAHA@freescale.com \
    --cc=arnd@arndb.de \
    --cc=dan.j.williams@gmail.com \
    --cc=davem@davemloft.net \
    --cc=djbw@fb.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.hengli.com.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=r58472@freescale.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).