linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: tcrypt: don't disable irqs and wait
@ 2017-04-25  8:25 Gilad Ben-Yossef
  2017-04-26 12:05 ` Horia Geantă
  2017-05-18  5:25 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Gilad Ben-Yossef @ 2017-04-25  8:25 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: linux-crypto, linux-kernel, gilad.benyossef, Ofir Drang

The tcrypt AEAD cycles speed tests disables irqs during the test, which is
broken at the very least since commit
'1425d2d17f7309c6 ("crypto: tcrypt - Fix AEAD speed tests")'
adds a wait for completion as part of the test and probably since
switching to the new AEAD API.

While the result of taking a cycle count diff may not mean much on SMP
systems if the task migrates, it's good enough for tcrypt being the quick
& dirty dev tool it is. It's also what all the other (i.e. hash) cycle
speed tests do.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Reported-by: Ofir Drang <ofir.drang@arm.com>
---
 crypto/tcrypt.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 9a11f3c..0dd6a43 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -138,8 +138,6 @@ static int test_aead_cycles(struct aead_request *req, int enc, int blen)
 	int ret = 0;
 	int i;
 
-	local_irq_disable();
-
 	/* Warm-up run. */
 	for (i = 0; i < 4; i++) {
 		if (enc)
@@ -169,8 +167,6 @@ static int test_aead_cycles(struct aead_request *req, int enc, int blen)
 	}
 
 out:
-	local_irq_enable();
-
 	if (ret == 0)
 		printk("1 operation in %lu cycles (%d bytes)\n",
 		       (cycles + 4) / 8, blen);
-- 
2.1.4

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

* Re: [PATCH] crypto: tcrypt: don't disable irqs and wait
  2017-04-25  8:25 [PATCH] crypto: tcrypt: don't disable irqs and wait Gilad Ben-Yossef
@ 2017-04-26 12:05 ` Horia Geantă
  2017-05-18  5:25 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Horia Geantă @ 2017-04-26 12:05 UTC (permalink / raw)
  To: Gilad Ben-Yossef, Herbert Xu, David S. Miller
  Cc: linux-crypto, linux-kernel, gilad.benyossef, Ofir Drang

On 4/25/2017 11:25 AM, Gilad Ben-Yossef wrote:
> The tcrypt AEAD cycles speed tests disables irqs during the test, which is
> broken at the very least since commit
> '1425d2d17f7309c6 ("crypto: tcrypt - Fix AEAD speed tests")'
> adds a wait for completion as part of the test and probably since
> switching to the new AEAD API.
> 
> While the result of taking a cycle count diff may not mean much on SMP
> systems if the task migrates, it's good enough for tcrypt being the quick
> & dirty dev tool it is. It's also what all the other (i.e. hash) cycle
> speed tests do.
> 
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> Reported-by: Ofir Drang <ofir.drang@arm.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>

I've also noticed this in CAAM accelerator - spin_unlock_bh() called
from caam_jr_enqueue() complains due to disabled interrupts:
WARNING: CPU: 4 PID: 2585 at kernel/softirq.c:161
.__local_bh_enable_ip+0x70/0xcc

Thanks,
Horia

> ---
>  crypto/tcrypt.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
> index 9a11f3c..0dd6a43 100644
> --- a/crypto/tcrypt.c
> +++ b/crypto/tcrypt.c
> @@ -138,8 +138,6 @@ static int test_aead_cycles(struct aead_request *req, int enc, int blen)
>  	int ret = 0;
>  	int i;
>  
> -	local_irq_disable();
> -
>  	/* Warm-up run. */
>  	for (i = 0; i < 4; i++) {
>  		if (enc)
> @@ -169,8 +167,6 @@ static int test_aead_cycles(struct aead_request *req, int enc, int blen)
>  	}
>  
>  out:
> -	local_irq_enable();
> -
>  	if (ret == 0)
>  		printk("1 operation in %lu cycles (%d bytes)\n",
>  		       (cycles + 4) / 8, blen);
> 

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

* Re: [PATCH] crypto: tcrypt: don't disable irqs and wait
  2017-04-25  8:25 [PATCH] crypto: tcrypt: don't disable irqs and wait Gilad Ben-Yossef
  2017-04-26 12:05 ` Horia Geantă
@ 2017-05-18  5:25 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2017-05-18  5:25 UTC (permalink / raw)
  To: Gilad Ben-Yossef
  Cc: David S. Miller, linux-crypto, linux-kernel, gilad.benyossef, Ofir Drang

On Tue, Apr 25, 2017 at 11:25:40AM +0300, Gilad Ben-Yossef wrote:
> The tcrypt AEAD cycles speed tests disables irqs during the test, which is
> broken at the very least since commit
> '1425d2d17f7309c6 ("crypto: tcrypt - Fix AEAD speed tests")'
> adds a wait for completion as part of the test and probably since
> switching to the new AEAD API.
> 
> While the result of taking a cycle count diff may not mean much on SMP
> systems if the task migrates, it's good enough for tcrypt being the quick
> & dirty dev tool it is. It's also what all the other (i.e. hash) cycle
> speed tests do.
> 
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> Reported-by: Ofir Drang <ofir.drang@arm.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2017-05-18  5:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25  8:25 [PATCH] crypto: tcrypt: don't disable irqs and wait Gilad Ben-Yossef
2017-04-26 12:05 ` Horia Geantă
2017-05-18  5:25 ` Herbert Xu

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).