[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALMp9eToT-af8kntKK2TiFHHUcUQgU25GaaNqq49RZZt2Buffg@mail.gmail.com>
Date: Tue, 6 Jan 2026 09:56:35 -0800
From: Jim Mattson <jmattson@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
x86@...nel.org, stable@...r.kernel.org
Subject: Re: [PATCH 1/4] x86/fpu: Clear XSTATE_BV[i] in save state whenever XFD[i]=1
On Mon, Jan 5, 2026 at 5:17 PM Sean Christopherson <seanjc@...gle.com> wrote:
>
> On Mon, Jan 05, 2026, Jim Mattson wrote:
> > On Thu, Jan 1, 2026 at 1:13 AM Paolo Bonzini <pbonzini@...hat.com> wrote:
> > >
> > > From: Sean Christopherson <seanjc@...gle.com>
> > > ...
> > > + /*
> > > + * KVM's guest ABI is that setting XFD[i]=1 *can* immediately revert
> > > + * the save state to initialized.
> >
> > This comment suggests that an entry should be added to
> > Documentation/virt/kvm/x86/errata.rst.
>
> Hmm, I don't think it's necessary, the SDM (in a style more suited for the APM,
> *sigh*), "recommends" that software not rely on state being maintained when disabled
> via XFD.
>
> Before doing so, system software should first initialize AMX state (e.g., by
> executing TILERELEASE); maintaining AMX state in a non-initialized state may
> have negative power and performance implications and will prevent the execution
> of In-Field Scan tests. In addition, software should not rely on the state of
> the tile data after setting IA32_XFD[17] or IA32_XFD[18]; software should always
> reload or reinitialize the tile data after clearing IA32_XFD[17] and IA32_XFD[18].
>
> System software should not use XFD to implement a “lazy restore” approach to
> management of the TILEDATA state component. This approach will not operate correctly
> for a variety of reasons. One is that the LDTILECFG and TILERELEASE instructions
> initialize TILEDATA and do not cause an #NM exception. Another is that an execution
> of XSAVE, XSAVEC, XSAVEOPT, or XSAVES by a user thread will save TILEDATA as
> initialized instead of the data expected by the user thread.
>
> I suppose that doesn't _quite_ say that the CPU is allowed to clobber state, but
> it's darn close.
>
> I'm definitely not opposed to officially documenting KVM's virtual CPU implementation,
> but IMO calling it an erratum is a bit unfair.
Apologies. You're right. Though Intel is a bit coy, the only way to
interpret that section of the SDM is to conclude that the AMX state in
the CPU becomes undefined when XFD[18] is set.
Powered by blists - more mailing lists