[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276F75834DB60F73B8BDD258C4B9@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Wed, 5 Jan 2022 00:23:45 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: "Christopherson,, Sean" <seanjc@...gle.com>,
"Zhong, Yang" <yang.zhong@...el.com>
CC: "x86@...nel.org" <x86@...nel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"corbet@....net" <corbet@....net>,
"shuah@...nel.org" <shuah@...nel.org>,
"Nakajima, Jun" <jun.nakajima@...el.com>,
"jing2.liu@...ux.intel.com" <jing2.liu@...ux.intel.com>,
"Liu, Jing2" <jing2.liu@...el.com>,
"Zeng, Guang" <guang.zeng@...el.com>,
"Wang, Wei W" <wei.w.wang@...el.com>
Subject: RE: [PATCH v4 14/21] kvm: x86: Disable RDMSR interception of
IA32_XFD_ERR
> From: Sean Christopherson <seanjc@...gle.com>
> Sent: Wednesday, January 5, 2022 3:35 AM
>
> On Wed, Dec 29, 2021, Yang Zhong wrote:
> > From: Jing Liu <jing2.liu@...el.com>
> >
> > Disable read emulation of IA32_XFD_ERR MSR if guest cpuid includes XFD.
> > This saves one unnecessary VM-exit in guest #NM handler, given that the
> > MSR is already restored with the guest value before the guest is resumed.
> >
> > Suggested-by: Paolo Bonzini <pbonzini@...hat.com>
> > Signed-off-by: Jing Liu <jing2.liu@...el.com>
> > Signed-off-by: Yang Zhong <yang.zhong@...el.com>
> > ---
> > arch/x86/kvm/vmx/vmx.c | 6 ++++++
> > arch/x86/kvm/vmx/vmx.h | 2 +-
> > 2 files changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > index 4e51de876085..638665b3e241 100644
> > --- a/arch/x86/kvm/vmx/vmx.c
> > +++ b/arch/x86/kvm/vmx/vmx.c
> > @@ -162,6 +162,7 @@ static u32
> vmx_possible_passthrough_msrs[MAX_POSSIBLE_PASSTHROUGH_MSRS] = {
> > MSR_FS_BASE,
> > MSR_GS_BASE,
> > MSR_KERNEL_GS_BASE,
> > + MSR_IA32_XFD_ERR,
> > #endif
> > MSR_IA32_SYSENTER_CS,
> > MSR_IA32_SYSENTER_ESP,
> > @@ -7228,6 +7229,11 @@ static void vmx_vcpu_after_set_cpuid(struct
> kvm_vcpu *vcpu)
> > }
> > }
> >
> > + if (boot_cpu_has(X86_FEATURE_XFD))
>
> This should be kvm_cpu_cap_has(), not boot_cpu_has(). If 32-bit kernels
> don't
> suppress XFD in boot_cpu_data, then using boot_cpus_has() is wrong. And
> even if
> XFD is suppressed, using kvm_cpu_cap_has() is still preferable.
>
Make sense.
Powered by blists - more mailing lists