[PATCH v2] arm64: fpsimd: avoid restoring fpcr if the contents haven't changed

Will Deacon will.deacon at arm.com
Mon Jun 30 02:03:18 PDT 2014


On Fri, Jun 27, 2014 at 06:33:58PM +0100, Ard Biesheuvel wrote:
> On 27 June 2014 17:53, Will Deacon <will.deacon at arm.com> wrote:
> > Writing to the FPCR is commonly implemented as a self-synchronising
> > operation in the CPU, so avoid writing to the register when the saved
> > value matches that in the hardware already.

[...]

> >  .macro fpsimd_restore_partial state, tmpnr1, tmpnr2
> >         ldp     w\tmpnr1, w\tmpnr2, [\state]
> >         msr     fpsr, x\tmpnr1
> > -       msr     fpcr, x\tmpnr2
> > +       fpsimd_restore_fpcr x\tmpnr1, x\tmpnr2
> 
> Ehm, isn't this the wrong way around?

Yup, well spotted. I'll give the crypto selftests a run to test this path
with the fix (I was just running paranoia in userspace before).

Will



More information about the linux-arm-kernel mailing list