Re: [PATCH v2 08/19] crypto: x86/ghash - limit FPU preemption

From: Eric Biggers
Date: Thu Oct 13 2022 - 02:03:27 EST


On Wed, Oct 12, 2022 at 04:59:20PM -0500, Robert Elliott wrote:
> - kernel_fpu_begin();
> - clmul_ghash_update(dst, src, srclen, &ctx->shash);
> - kernel_fpu_end();
> + while (srclen >= GHASH_BLOCK_SIZE) {
> + unsigned int fpulen = min(srclen, FPU_BYTES);
> +
> + kernel_fpu_begin();
> + while (fpulen >= GHASH_BLOCK_SIZE) {
> + int n = min_t(unsigned int, fpulen, GHASH_BLOCK_SIZE);
> +
> + clmul_ghash_update(dst, src, n, &ctx->shash);
> +
> + srclen -= n;
> + fpulen -= n;
> + src += n;
> + }
> + kernel_fpu_end();
> + }

Another loop that doesn't make sense. Why is this only passing 16 bytes at a
time into the assembly code? There shouldn't be an inner loop here at all.

- Eric