On 23/05/2024 5:16 pm, Jan Beulich wrote:
> On 23.05.2024 13:16, Andrew Cooper wrote:
>> First, if XSAVE is available in hardware but not visible to the guest, the
>> dynamic leaves shouldn't be filled in.
>>
>> Second, the comment concerning XSS state is wrong. VT-x doesn't manage
>> host/guest state automatically, but there is provision for "host only" bits
>> to
>> be set, so the implications are still accurate.
>>
>> Introduce xstate_compressed_size() to mirror the uncompressed one. Cross
>> check it at boot.
>>
>> Signed-off-by: Andrew Cooper <[email protected]>
> Reviewed-by: Jan Beulich <[email protected]>
Thanks.
> Irrespective ...
>
>> v3:
>> * Adjust commit message about !XSAVE guests
>> * Rebase over boot time cross check
>> * Use raw policy
> ... it should probably have occurred to me earlier on to ask: Why raw policy?
> Isn't the host one the more appropriate one to use for any kind of internal
> decisions?
State information is identical in all policies. It's the ABI of the
X{SAVE,RSTOR}* instructions.
Beyond that, consistency.
xstate_uncompressed_size() does strictly need to be the raw policy,
because it is used by recalculate_xstate() to calculate the host policy.
xstate_compressed_size() doesn't have the same restriction, but should
use the same source of data.
Finally, xstate_{un,}compressed_size() aren't really tied to a choice of
features in the first place. They shouldn't be limited to the
host_policy's subset of active features.
~Andrew