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

From: Thiago Macieira
Date: Wed Aug 18 2021 - 17:04:52 EST


On Wednesday, 18 August 2021 13:43:50 PDT Bae, Chang Seok wrote:
> > Then our API needs improving. An app should be able to ask the kernel
> > "Do you support AMX?" get a proper answer and act accordingly.
>
> Maybe I’m missing something, but I wonder what’s the difference from
> reading XCR0.

That assumes the kernel will always enable the bits in XCR0, like it is doing
today and with your patch, because modifying it is a VM exit.

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.

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