Re: [PATCH v15 09/41] KVM: x86: Load guest FPU state when access XSAVE-managed MSRs

Sean Christopherson
2025-09-17T21:56:27Z

On Wed, Sep 17, 2025, Sean Christopherson wrote:
> On Tue, Sep 16, 2025, Binbin Wu wrote:
> > > +/*
> > > + * Lock and/or reload guest FPU and access xstate MSRs. For accesses initiated
> >
> >
> > Lock is unconditional and reload is conditional.
> > "and/or" seems not accurate?
>
> Agreed. This?
>
> /*
> * Lock andr (re)load guest FPU and access xstate MSRs. For accesses initiated
> * by host, guest FPU is loaded in __msr_io(). For accesses initiated by guest,
> * guest FPU should have been loaded already.
> */

That's not very good either.

/*
* Lock (and if necessary, re-load) the guest FPU, i.e. XSTATE, and access an
* MSR that is managed via XSTATE. Note, the caller is responsible for doing
* the initial FPU load, this helper only ensures that guest state is resident
* in hardware (the kernel can load its FPU state in IRQ context).
*/