Re: [DISCUSSION] x86: In-Kernel Use of Extended General-Purpose Registers
From: Peter Zijlstra
Date: Wed Nov 26 2025 - 11:30:59 EST
On Mon, Nov 24, 2025 at 09:32:23PM +0000, Chang S. Bae wrote:
> This follows how vector registers are used today in places like crypto
> routines. AVX state usage is bracketed by kernel_fpu_begin() /
> kernel_fpu_end(). EGPRs could be similarly used in a small bounded
> region.
>
> Under this model:
>
> * No changes are needed to the existing XSTATE management API.
>
> * Preemption and softirqs would be disabled while EGPRs are live,
> subsequently limiting usage to small regions.
>
> * This lends itself mostly to hand-written assembly, which is less
> scalable for broader adoption.
IIRC it isn't hard to make kernel_fpu_begin/end() preemptible. It came
up with the last xsave rework -- mostly in the context of -rt, but
nobody ever picked it up and did it.