From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: "Horia Geantă" <horia.geanta@nxp.com>,
"Thomas Gleixner" <tglx@linutronix.de>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org
Subject: Re: [PATCH 11/14] Revert "crypto: caam - get rid of tasklet"
Date: Wed, 9 Nov 2016 08:53:22 +0000 [thread overview]
Message-ID: <20161109085322.GY1041@n2100.armlinux.org.uk> (raw)
In-Reply-To: <1478681184-9442-12-git-send-email-horia.geanta@nxp.com>
Please include Thomas in this.
On Wed, Nov 09, 2016 at 10:46:21AM +0200, Horia Geantă wrote:
> This reverts commit 66d2e2028091a074aa1290d2eeda5ddb1a6c329c.
>
> Quoting from Russell's findings:
> https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg21136.html
>
> [quote]
> Okay, I've re-tested, using a different way of measuring, because using
> openssl speed is impractical for off-loaded engines. I've decided to
> use this way to measure the performance:
>
> dd if=/dev/zero bs=1048576 count=128 | /usr/bin/time openssl dgst -md5
>
> For the threaded IRQs case gives:
>
> 0.05user 2.74system 0:05.30elapsed 52%CPU (0avgtext+0avgdata 2400maxresident)k
> 0.06user 2.52system 0:05.18elapsed 49%CPU (0avgtext+0avgdata 2404maxresident)k
> 0.12user 2.60system 0:05.61elapsed 48%CPU (0avgtext+0avgdata 2460maxresident)k
> => 5.36s => 25.0MB/s
>
> and the tasklet case:
>
> 0.08user 2.53system 0:04.83elapsed 54%CPU (0avgtext+0avgdata 2468maxresident)k
> 0.09user 2.47system 0:05.16elapsed 49%CPU (0avgtext+0avgdata 2368maxresident)k
> 0.10user 2.51system 0:04.87elapsed 53%CPU (0avgtext+0avgdata 2460maxresident)k
> => 4.95 => 27.1MB/s
>
> which corresponds to an 8% slowdown for the threaded IRQ case. So,
> tasklets are indeed faster than threaded IRQs.
>
> [...]
>
> I think I've proven from the above that this patch needs to be reverted
> due to the performance regression, and that there _is_ most definitely
> a deterimental effect of switching from tasklets to threaded IRQs.
> [/quote]
>
> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
> ---
> drivers/crypto/caam/intern.h | 1 +
> drivers/crypto/caam/jr.c | 25 ++++++++++++++++---------
> 2 files changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h
> index 5d4c05074a5c..e2bcacc1a921 100644
> --- a/drivers/crypto/caam/intern.h
> +++ b/drivers/crypto/caam/intern.h
> @@ -41,6 +41,7 @@ struct caam_drv_private_jr {
> struct device *dev;
> int ridx;
> struct caam_job_ring __iomem *rregs; /* JobR's register space */
> + struct tasklet_struct irqtask;
> int irq; /* One per queue */
>
> /* Number of scatterlist crypt transforms active on the JobR */
> diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
> index 7331ea734f37..c8604dfadbf5 100644
> --- a/drivers/crypto/caam/jr.c
> +++ b/drivers/crypto/caam/jr.c
> @@ -73,6 +73,8 @@ static int caam_jr_shutdown(struct device *dev)
>
> ret = caam_reset_hw_jr(dev);
>
> + tasklet_kill(&jrp->irqtask);
> +
> /* Release interrupt */
> free_irq(jrp->irq, dev);
>
> @@ -128,7 +130,7 @@ static irqreturn_t caam_jr_interrupt(int irq, void *st_dev)
>
> /*
> * Check the output ring for ready responses, kick
> - * the threaded irq if jobs done.
> + * tasklet if jobs done.
> */
> irqstate = rd_reg32(&jrp->rregs->jrintstatus);
> if (!irqstate)
> @@ -150,13 +152,18 @@ static irqreturn_t caam_jr_interrupt(int irq, void *st_dev)
> /* Have valid interrupt at this point, just ACK and trigger */
> wr_reg32(&jrp->rregs->jrintstatus, irqstate);
>
> - return IRQ_WAKE_THREAD;
> + preempt_disable();
> + tasklet_schedule(&jrp->irqtask);
> + preempt_enable();
> +
> + return IRQ_HANDLED;
> }
>
> -static irqreturn_t caam_jr_threadirq(int irq, void *st_dev)
> +/* Deferred service handler, run as interrupt-fired tasklet */
> +static void caam_jr_dequeue(unsigned long devarg)
> {
> int hw_idx, sw_idx, i, head, tail;
> - struct device *dev = st_dev;
> + struct device *dev = (struct device *)devarg;
> struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);
> void (*usercall)(struct device *dev, u32 *desc, u32 status, void *arg);
> u32 *userdesc, userstatus;
> @@ -230,8 +237,6 @@ static irqreturn_t caam_jr_threadirq(int irq, void *st_dev)
>
> /* reenable / unmask IRQs */
> clrsetbits_32(&jrp->rregs->rconfig_lo, JRCFG_IMSK, 0);
> -
> - return IRQ_HANDLED;
> }
>
> /**
> @@ -389,10 +394,11 @@ static int caam_jr_init(struct device *dev)
>
> jrp = dev_get_drvdata(dev);
>
> + tasklet_init(&jrp->irqtask, caam_jr_dequeue, (unsigned long)dev);
> +
> /* Connect job ring interrupt handler. */
> - error = request_threaded_irq(jrp->irq, caam_jr_interrupt,
> - caam_jr_threadirq, IRQF_SHARED,
> - dev_name(dev), dev);
> + error = request_irq(jrp->irq, caam_jr_interrupt, IRQF_SHARED,
> + dev_name(dev), dev);
> if (error) {
> dev_err(dev, "can't connect JobR %d interrupt (%d)\n",
> jrp->ridx, jrp->irq);
> @@ -454,6 +460,7 @@ static int caam_jr_init(struct device *dev)
> out_free_irq:
> free_irq(jrp->irq, dev);
> out_kill_deq:
> + tasklet_kill(&jrp->irqtask);
> return error;
> }
>
> --
> 2.4.4
>
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2016-11-09 8:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 8:46 [PATCH 00/14] crypto: caam - fixes, clean-up Horia Geantă
2016-11-09 8:46 ` [PATCH 01/14] crypto: caam - fix AEAD givenc descriptors Horia Geantă
2016-11-09 8:46 ` [PATCH 02/14] crypto: caam - completely remove error propagation handling Horia Geantă
2016-11-09 8:46 ` [PATCH 03/14] crypto: caam - desc.h fixes Horia Geantă
2016-11-09 8:46 ` [PATCH 04/14] crypto: caam - fix sparse warnings Horia Geantă
2016-11-09 8:46 ` [PATCH 05/14] crypto: caam - fix smatch warnings Horia Geantă
2016-11-09 8:46 ` [PATCH 06/14] crypto: caam - remove unused may_sleep in dbg_dump_sg() Horia Geantă
2016-11-09 8:46 ` [PATCH 07/14] crypto: caam - remove unused command from aead givencrypt Horia Geantă
2016-11-09 8:46 ` [PATCH 08/14] crypto: caam - trivial code clean-up Horia Geantă
2016-11-09 8:46 ` [PATCH 09/14] crypto: caam - remove unreachable code in report_ccb_status() Horia Geantă
2016-11-09 8:46 ` [PATCH 10/14] crypto: caam - fix DMA API mapping leak in ablkcipher code Horia Geantă
2016-11-09 8:46 ` [PATCH 11/14] Revert "crypto: caam - get rid of tasklet" Horia Geantă
2016-11-09 8:53 ` Russell King - ARM Linux [this message]
2016-11-09 23:17 ` Thomas Gleixner
2016-11-09 23:19 ` Thomas Gleixner
2016-11-09 8:46 ` [PATCH 12/14] crypto: caam - move sec4_sg_entry to sg_sw_sec4.h Horia Geantă
2016-11-09 8:46 ` [PATCH 13/14] crypto: caam - constify pointer to descriptor buffer Horia Geantă
2016-11-09 8:46 ` [PATCH 14/14] crypto: caam - merge identical ahash_final/finup shared desc Horia Geantă
2016-11-13 11:35 ` [PATCH 00/14] crypto: caam - fixes, clean-up Herbert Xu
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=20161109085322.GY1041@n2100.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=linux-crypto@vger.kernel.org \
--cc=tglx@linutronix.de \
/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 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.