linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vakul Garg <vakul.garg@nxp.com>
To: Horia Geanta <horia.geanta@nxp.com>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Cc: Aymen Sghaier <aymen.sghaier@nxp.com>,
	"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
	"davem@davemloft.net" <davem@davemloft.net>
Subject: RE: [PATCH] crypto: caam/jr - optimize job ring enqueue and dequeue operations
Date: Tue, 5 Mar 2019 17:35:01 +0000	[thread overview]
Message-ID: <DB7PR04MB42528B5F67984BB8CBF54EDC8B720@DB7PR04MB4252.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <VI1PR0402MB3485BD912D8FA0E1A33CBA5298720@VI1PR0402MB3485.eurprd04.prod.outlook.com>



> -----Original Message-----
> From: Horia Geanta
> Sent: Tuesday, March 5, 2019 10:14 PM
> To: Vakul Garg <vakul.garg@nxp.com>; linux-crypto@vger.kernel.org
> Cc: Aymen Sghaier <aymen.sghaier@nxp.com>;
> herbert@gondor.apana.org.au; davem@davemloft.net
> Subject: Re: [PATCH] crypto: caam/jr - optimize job ring enqueue and
> dequeue operations
> 
> On 3/5/2019 9:00 AM, Vakul Garg wrote:
> > Instead of reading job ring's occupancy registers for every req/rsp
> > enqueued/dequeued respectively, we read these registers once and store
> > them in memory. After completing a job enqueue/dequeue, we decrement
> > these values. When these values become zero, we refresh the snapshot
> > of job ring's occupancy registers. This eliminates need of expensive
> > device register read operations for every job enqueued and dequeued
> > and hence makes caam_jr_enqueue() and caam_jr_dequeue() faster.
> >
> How expensive?
> Please share the case you benchmarked and performance improvement you
> noticed.

The performance of kernel ipsec improved by about 6% on ls1028.

> 
> Somewhat related: it seems that after commit a0ca6ca022ac ("crypto: caam
> - one tasklet per job ring") the "outlock" spinlock could be removed, this
> being a good candidate for further improvement.
> 
Yes, I remember I discussed it before. 
There are other inefficiencies as well.
Will submit patches. 

> > Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
> > ---
> >  drivers/crypto/caam/intern.h |  1 +
> >  drivers/crypto/caam/jr.c     | 12 ++++++++++--
> >  2 files changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/crypto/caam/intern.h
> > b/drivers/crypto/caam/intern.h index 5869ad58d497..b6d96e2ecf4c
> 100644
> > --- a/drivers/crypto/caam/intern.h
> > +++ b/drivers/crypto/caam/intern.h
> > @@ -59,6 +59,7 @@ struct caam_drv_private_jr {
> >  	int out_ring_read_index;	/* Output index "tail" */
> >  	int tail;			/* entinfo (s/w ring) tail index */
> >  	struct jr_outentry *outring;	/* Base of output ring, DMA-safe */
> > +	u32 inpring_avail;		/* Number of free entries in i/p
> ring*/
> Locality: this should be near the other enqueue-related structure members.
> 
> Nitpick: use "input" instead of "i/p".
> 

Sending v2. 

> Thanks,
> Horia


  reply	other threads:[~2019-03-05 17:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05  7:00 [PATCH] crypto: caam/jr - optimize job ring enqueue and dequeue operations Vakul Garg
2019-03-05 16:43 ` Horia Geanta
2019-03-05 17:35   ` Vakul Garg [this message]
2019-03-05 17:55     ` Horia Geanta

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=DB7PR04MB42528B5F67984BB8CBF54EDC8B720@DB7PR04MB4252.eurprd04.prod.outlook.com \
    --to=vakul.garg@nxp.com \
    --cc=aymen.sghaier@nxp.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=horia.geanta@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    /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).