RE: [PATCH v4 12/21] kvm: x86: Intercept #NM for saving IA32_XFD_ERR

From: Tian, Kevin
Date: Tue Jan 04 2022 - 19:27:21 EST


> From: Sean Christopherson <seanjc@xxxxxxxxxx>
> Sent: Wednesday, January 5, 2022 4:01 AM
>
> On Wed, Dec 29, 2021, Yang Zhong wrote:
> > +static void handle_nm_fault_irqoff(struct kvm_vcpu *vcpu)
> > +{
> > + rdmsrl(MSR_IA32_XFD_ERR, vcpu->arch.guest_fpu.xfd_err);
> > + kvm_queue_exception(vcpu, NM_VECTOR);
>
> This is still wrong, even though no additional supported is needed to support
> nested XFD. If L1 wants to intercept #NM, then KVM must not inject the #NM
> and
> must not read XFD_ERR.

Sure. This v4 was sent out before we settled down this open in v3
discussion. We did fix it later and posted the sample logic here:

https://lore.kernel.org/all/BN9PR11MB52767789D59239DF5DD524758C469@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/

Will include this fix in v5.

Thanks
Kevin