RE: [RFC PATCH v2 1/2] x86/fpu: detect AVX task
From: David Laight
Date: Tue Nov 13 2018 - 09:56:26 EST
From: Li, Aubrey
> Sent: 13 November 2018 13:07
...
> > Isn't there an obvious optimisation to execute VZEROALL during system call
> > entry?
>
> I'm not aware of this in the kernel, maybe you are talking about some
> optimization in glibc?
I've not seen it anywhere either.
IIRC all the xmm and ymm registers are 'caller saved'.
Since system calls all look like function calls the compiler
has to assume that the registers can be modified.
This means that it is safe for the system call code to change them.
It mustn't leak kernel values out to userspace, but it can zero them.
So adding VZEROALL on system call entry would save the FP save code having
to save and restore any of the xmm/ymm registers.
IIRC the hardware just saves a flag indicating that they are all zero.
All the registers do need saving if the kernel is entered by an
interrupt or fault.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)