lkml.org 
[lkml]   [2022]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 05/19] crypto: x86/crc - limit FPU preemption
Date


> -----Original Message-----
> From: Herbert Xu <herbert@gondor.apana.org.au>
> Sent: Wednesday, October 12, 2022 9:00 PM
> To: Elliott, Robert (Servers) <elliott@hpe.com>
> Cc: davem@davemloft.net; tim.c.chen@linux.intel.com; ap420073@gmail.com;
> ardb@kernel.org; linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 05/19] crypto: x86/crc - limit FPU preemption
>
> On Wed, Oct 12, 2022 at 04:59:17PM -0500, Robert Elliott wrote:
> >
> > @@ -170,9 +179,17 @@ static int __crc32c_pcl_intel_finup(u32 *crcp, const u8
> *data, unsigned int len,
> > u8 *out)
> > {
> > if (len >= CRC32C_PCL_BREAKEVEN && crypto_simd_usable()) {
> > - kernel_fpu_begin();
> > - *(__le32 *)out = ~cpu_to_le32(crc_pcl(data, len, *crcp));
> > - kernel_fpu_end();
> > + do {
> > + unsigned int chunk = min(len, FPU_BYTES);
> > +
> > + kernel_fpu_begin();
> > + *crcp = crc_pcl(data, chunk, *crcp);
>
> How about storing the intermediate result in a local variable
> instead of overwriting *crcp?
>
> Thanks,

The _update function does so, and it's not marked const here,
so seemed prudent to keep up to date.

Do the callers understand it's no longer valid after finup, or
is there any case they might treat finup like an update and try
again?

\
 
 \ /
  Last update: 2022-10-14 00:35    [W:0.113 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site