Re: [PATCH v5 24/28] x86/fpu/xstate: Use per-task xstate mask for saving xstate in signal frame

From: Andy Lutomirski
Date: Sun May 23 2021 - 23:15:27 EST


On 5/23/21 12:32 PM, Chang S. Bae wrote:
> Entering a signal handler, the kernel saves xstate in signal frame. The
> dynamic user state is better to be saved only when used. fpu->state_mask
> can help to exclude unused states.
>
> Returning from a signal handler, XRSTOR(S) re-initializes the excluded
> state components.

If I'm reading this right, it means that tasks that have ever used AMX
get one format and tasks that haven't get another one. Do we really
want that? We could instead look at the actual XINUSE mask.

BTW, the current FPU signal restore code is horrific. I'm not convinced
we want to make any changes to the signal handling until that code gets
cleaned up.

--Andy