> -----Original Message----- > From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> > Sent: Wednesday, October 12, 2022 9:00 PM > To: Elliott, Robert (Servers) <elliott@xxxxxxx> > Cc: davem@xxxxxxxxxxxxx; tim.c.chen@xxxxxxxxxxxxxxx; ap420073@xxxxxxxxx; > ardb@xxxxxxxxxx; linux-crypto@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx > 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?