From: Tero Kristo <t-kristo@ti.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: <lokeshvutla@ti.com>, <davem@davemloft.net>,
<linux-crypto@vger.kernel.org>, <tony@atomide.com>,
<linux-omap@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCHv3 03/11] crypto: omap-sham: implement context export/import APIs
Date: Thu, 1 Sep 2016 09:12:59 +0300 [thread overview]
Message-ID: <60a5ed40-5552-3ec8-fa21-7e6fb8213fc3@ti.com> (raw)
In-Reply-To: <20160901033320.GA650@gondor.apana.org.au>
On 01/09/16 06:33, Herbert Xu wrote:
> On Mon, Aug 29, 2016 at 05:11:35PM +0300, Tero Kristo wrote:
>>
>>>> +static int omap_sham_export(struct ahash_request *req, void *out)
>>>> +{
>>>> + struct omap_sham_reqctx *rctx = ahash_request_ctx(req);
>>>> +
>>>> + while (omap_sham_flush(req) == -EINPROGRESS)
>>>> + msleep(10);
>>>
>>> Do we really need this? You must not call export until the previous
>>> operation has completed.
>>>
>>> Cheers,
>>>
>>
>> Sorry about a late reply, I was out on vacation.
>>
>> For OMAP SHAM, this is actually needed, because the driver still has
>> a very large internal buffer for performance reasons, and the whole
>> buffer can't be exported. The flush functionality pushes out
>> sufficient amount of data to the hardware, so that the rest of the
>> buffer can be exported to the available space.
>
> It doesn't matter whether you have a buffer or not. The point
> is that the completion function should not be called until the
> operation is actually complete. This is the whole point of the
> async interface.
>
> As the user must not call export until the completion function
> has been called, there should be no need to wait in the export
> function.
Well, but the driver doesn't flush its buffers automatically, it caches
data until it has sufficient amount available. So, assuming you want to
do this:
sham_init
sham_update 256 bytes
sham_update 256 bytes
wait until two above updates are complete
sham_export
... the execution hangs at the wait phase as the driver is still waiting
for more data to cache, and will never complete the two update requests.
Currently, the driver is written in such way that it waits until it has
enough data cached before starting to push it out to hardware, or waits
until sham_final to be called. Pushing out small pieces of data causes
severe performance degradation on the driver, as setting up the DMA
operation itself is rather costly.
Either way, flush for the buffers is needed, I wonder if automatic flush
should be added also based on some timer.
-Tero
next prev parent reply other threads:[~2016-09-01 6:13 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 10:28 [PATCHv3 00/11] crypto: omap HW crypto fixes Tero Kristo
2016-08-04 10:28 ` [PATCHv3 01/11] crypto: omap-sham: avoid executing tasklet where not needed Tero Kristo
2016-08-04 10:28 ` [PATCHv3 02/11] crypto: omap-sham: add support for flushing the buffer Tero Kristo
2016-08-04 10:28 ` [PATCHv3 03/11] crypto: omap-sham: implement context export/import APIs Tero Kristo
2016-08-09 10:06 ` Herbert Xu
2016-08-29 14:11 ` Tero Kristo
2016-09-01 3:33 ` Herbert Xu
2016-09-01 6:12 ` Tero Kristo [this message]
2016-09-01 6:16 ` Herbert Xu
2016-09-01 6:56 ` Tero Kristo
2016-09-01 7:19 ` Herbert Xu
2016-09-01 7:28 ` Tero Kristo
2016-09-01 7:31 ` Herbert Xu
2016-09-01 7:46 ` Tero Kristo
2016-09-05 12:06 ` Tero Kristo
2016-09-07 13:29 ` Herbert Xu
2016-08-04 10:28 ` [PATCHv3 04/11] crypto: omap-sham: fix software fallback handling Tero Kristo
2016-08-04 10:28 ` [PATCHv3 05/11] crypto: omap-sham: fix SW fallback HMAC handling for omap2/omap3 Tero Kristo
2016-08-04 10:28 ` [PATCHv3 06/11] crypto: omap-des: Fix support for unequal lengths Tero Kristo
2016-09-13 9:35 ` Herbert Xu
2016-09-15 9:15 ` Tero Kristo
2016-08-04 10:28 ` [PATCHv3 07/11] crypto: omap-aes: use runtime_pm autosuspend for clock handling Tero Kristo
2016-08-04 10:28 ` [PATCHv3 08/11] crypto: omap-aes: Add support for multiple cores Tero Kristo
2016-08-04 10:28 ` [PATCHv3 09/11] crypto: omap-aes: Add fallback support Tero Kristo
2016-08-04 10:28 ` [PATCHv3 10/11] crypto: omap-aes: fix crypto engine initialization order Tero Kristo
2016-08-04 10:28 ` [PATCHv3 11/11] crypto: omap-des: " Tero Kristo
2016-09-13 12:38 ` [PATCHv3 00/11] crypto: omap HW crypto fixes Herbert Xu
2016-09-15 9:12 ` Tero Kristo
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=60a5ed40-5552-3ec8-fa21-7e6fb8213fc3@ti.com \
--to=t-kristo@ti.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=lokeshvutla@ti.com \
--cc=tony@atomide.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