Re: [PATCH v4 1/2] x86/fpu: track AVX-512 usage of tasks

From: Andi Kleen
Date: Wed Dec 12 2018 - 13:00:49 EST


> Isn't a thread likely to clear the AVX registers at the end of a function
> that uses them.
> In particular this removes the massive overhead on certain cpus of
> switching between two AVX modes.
> So it is actually unlikely that XSAVE will need to save them at all?

Only if context switches only happened on function boundaries, which
is obviously not the case.

Yes the detection mechanism is not 100% accurate, but if AVX
is used significantly it should eventually detect it.
Think of it as a statistical sampling heuristic.

>
> As I've also said before the registers are caller saved and since
> systems calls are normal function calls the application code
> would have to save them across a system call.
> This allows the kernel to zero the registers on system call entry
> again meaning that XSAVE won't normally have to save them.

While I agree this would be nice, the Linux system call ABI
wasn't defined like this, so it cannot be done at this point.

-Andi