lkml.org 
[lkml]   [2021]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v3 13/22] kvm: x86: Intercept #NM for saving IA32_XFD_ERR
Date
> From: Tian, Kevin
> Sent: Wednesday, December 29, 2021 10:53 AM
> > > + case MSR_IA32_XFD:
> > > + ret = kvm_set_msr_common(vcpu, msr_info);
> > > + if (!ret && data) {
> > > + vcpu->arch.trap_nm = true;
> > > + vmx_update_exception_bitmap(vcpu);
> >
> > This is wrong, it fails to clear vcpu->arch.trap_nm and update the bitmap if
> > the
> > MSR is cleared.
>
> In concept you are right if just looking at this patch. It's pointless to
> trap #NM if guest xfd is cleared.
>
> But here we need think about patch22 which disables write interception
> for xfd. With that in consideration we use the 1st non-zero write as the
> hint indicating that guest might enable xfd-related usages thus always
> trap #NM after this point.
>
> It's not a good ordering, but Paolo wants to put the optimization in the
> end of this series. But we do need to put a clear comment here explaining
> the always-trap policy.

Given write emulation of XFD is not disabled in this patch, it reads cleaner
to always update exception bitmap according to guest xfd value at this
stage. So we will follow your suggestion here and then change to check
msr bitmap when write emulation is disabled in patch22.

Thanks
Kevin

\
 
 \ /
  Last update: 2021-12-29 07:51    [W:0.123 / U:0.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site