[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aa17648c001704d83dcf641c1c7e9894e65eb87a.camel@intel.com>
Date: Wed, 16 Aug 2023 09:47:11 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "binbin.wu@...ux.intel.com" <binbin.wu@...ux.intel.com>
CC: "Gao, Chao" <chao.gao@...el.com>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"David.Laight@...LAB.COM" <David.Laight@...LAB.COM>,
"Zeng, Guang" <guang.zeng@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"robert.hu@...ux.intel.com" <robert.hu@...ux.intel.com>
Subject: Re: [PATCH v10 3/9] KVM: x86: Use KVM-governed feature framework to
track "LAM enabled"
> > > --- a/arch/x86/kvm/vmx/vmx.c
> > > +++ b/arch/x86/kvm/vmx/vmx.c
> > > @@ -7783,6 +7783,9 @@ static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
> > > vmx->msr_ia32_feature_control_valid_bits &=
> > > ~FEAT_CTL_SGX_LC_ENABLED;
> > >
> > > + if (boot_cpu_has(X86_FEATURE_LAM))
> > > + kvm_governed_feature_check_and_set(vcpu, X86_FEATURE_LAM);
> > > +
> > If you want to use boot_cpu_has(), it's better to be done at your last patch to
> > only set the cap bit when boot_cpu_has() is true, I suppose.
> Yes, but new version of kvm_governed_feature_check_and_set() of
> KVM-governed feature framework will check against kvm_cpu_cap_has() as well.
> I will remove the if statement and call
> kvm_governed_feature_check_and_set() directly.
> https://lore.kernel.org/kvm/20230815203653.519297-2-seanjc@google.com/
>
I mean kvm_cpu_cap_has() checks against the host CPUID directly while here you
are using boot_cpu_has(). They are not the same.
If LAM should be only supported when boot_cpu_has() is true then it seems you
can just only set the LAM cap bit when boot_cpu_has() is true. As you also
mentioned above the kvm_governed_feature_check_and_set() here internally does
kvm_cpu_cap_has().
Powered by blists - more mailing lists