Re: [PATCH v9 12/26] x86/fpu/xstate: Use feature disable (XFD) to protect dynamic user state

Thiago Macieira
2021-08-19T16:07:29Z

On Wednesday, 18 August 2021 18:21:11 PDT Andy Lutomirski wrote:
> But it's not the only possible solution. A future kernel could decide to
> leave
> > some bits off and only enable upon request. That's how macOS/Darwin does
> > its AVX512 support.
>
> The fact that Darwin does this strongly suggests that real programs can
> handle it, which increases my inclination for Linux to do the same thing.

Yes and no... yes, programs could be made to handle this. I've reached to the
Intel team responsible for the instructions in the manual on how to detect
AVX512 and AMX, so the content is extended to say there's an OS-specific part
that software developers need to be aware of. But until then, it's not very
discoverable. As a result, there's plenty of software that could enable AVX512
on the Xeon-based Mac Pros but never do because the developers didn't know
that there was more than what the manual said. But the worst case that can
happen here is that the software gracefully falls back to AVX2 or an earlier
instruction set (unlike the Linux solution).

No, because XSETBV causes a VM exit, so we don't want to execute that on a
context switch, for performance reasons. That's probably not been a concern
for Apple developers, but is for Linux.

--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel DPG Cloud Engineering