lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 30 Dec 2022 17:04:44 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Robert Elliott <elliott@....com>
Cc:     davem@...emloft.net, Jason@...c4.com, ardb@...nel.org,
        ap420073@...il.com, David.Laight@...lab.com, ebiggers@...nel.org,
        tim.c.chen@...ux.intel.com, peter@...jl.ca, tglx@...utronix.de,
        mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
        linux-crypto@...r.kernel.org, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 07/13] crypto: x86/ghash - restructure FPU context saving

On Mon, Dec 19, 2022 at 04:02:17PM -0600, Robert Elliott wrote:
> Wrap each of the calls to clmul_hash_update and clmul_ghash__mul
> in its own set of kernel_fpu_begin and kernel_fpu_end calls, preparing
> to limit the amount of data processed by each _update call to avoid
> RCU stalls.
> 
> This is more like how polyval-clmulni_glue is structured.
> 
> Fixes: 0e1227d356e9 ("crypto: ghash - Add PCLMULQDQ accelerated implementation")
> Suggested-by: Herbert Xu <herbert@...dor.apana.org.au>
> Signed-off-by: Robert Elliott <elliott@....com>
> ---
>  arch/x86/crypto/ghash-clmulni-intel_glue.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/crypto/ghash-clmulni-intel_glue.c b/arch/x86/crypto/ghash-clmulni-intel_glue.c
> index beac4b2eddf6..1bfde099de0f 100644
> --- a/arch/x86/crypto/ghash-clmulni-intel_glue.c
> +++ b/arch/x86/crypto/ghash-clmulni-intel_glue.c
> @@ -80,7 +80,6 @@ static int ghash_update(struct shash_desc *desc,
>  	struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
>  	u8 *dst = dctx->buffer;
>  
> -	kernel_fpu_begin();
>  	if (dctx->bytes) {
>  		int n = min(srclen, dctx->bytes);
>  		u8 *pos = dst + (GHASH_BLOCK_SIZE - dctx->bytes);
> @@ -91,10 +90,14 @@ static int ghash_update(struct shash_desc *desc,
>  		while (n--)
>  			*pos++ ^= *src++;
>  
> -		if (!dctx->bytes)
> +		if (!dctx->bytes) {
> +			kernel_fpu_begin();
>  			clmul_ghash_mul(dst, &ctx->shash);
> +			kernel_fpu_end();
> +		}
>  	}
>  
> +	kernel_fpu_begin();
>  	clmul_ghash_update(dst, src, srclen, &ctx->shash);
>  	kernel_fpu_end();

Why is this necessary? Couldn't you just add the kernel_fpu_yield
calls even without this patch?

This just seems to be adding some unnecessary begin/end calls.

Cheers,
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ