[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y3RDPOerOIf6SwI0@google.com>
Date: Wed, 16 Nov 2022 01:56:12 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: "Huang, Kai" <kai.huang@...el.com>
Cc: "imbrenda@...ux.ibm.com" <imbrenda@...ux.ibm.com>,
"aou@...s.berkeley.edu" <aou@...s.berkeley.edu>,
"mjrosato@...ux.ibm.com" <mjrosato@...ux.ibm.com>,
"vkuznets@...hat.com" <vkuznets@...hat.com>,
"farman@...ux.ibm.com" <farman@...ux.ibm.com>,
"chenhuacai@...nel.org" <chenhuacai@...nel.org>,
"paul.walmsley@...ive.com" <paul.walmsley@...ive.com>,
"palmer@...belt.com" <palmer@...belt.com>,
"maz@...nel.org" <maz@...nel.org>,
"anup@...infault.org" <anup@...infault.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"borntraeger@...ux.ibm.com" <borntraeger@...ux.ibm.com>,
"aleksandar.qemu.devel@...il.com" <aleksandar.qemu.devel@...il.com>,
"frankja@...ux.ibm.com" <frankja@...ux.ibm.com>,
"oliver.upton@...ux.dev" <oliver.upton@...ux.dev>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"Yao, Yuan" <yuan.yao@...el.com>,
"farosas@...ux.ibm.com" <farosas@...ux.ibm.com>,
"david@...hat.com" <david@...hat.com>,
"james.morse@....com" <james.morse@....com>,
"mpe@...erman.id.au" <mpe@...erman.id.au>,
"alexandru.elisei@....com" <alexandru.elisei@....com>,
"linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"kvmarm@...ts.linux.dev" <kvmarm@...ts.linux.dev>,
"suzuki.poulose@....com" <suzuki.poulose@....com>,
"kvm-riscv@...ts.infradead.org" <kvm-riscv@...ts.infradead.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-mips@...r.kernel.org" <linux-mips@...r.kernel.org>,
"kvmarm@...ts.cs.columbia.edu" <kvmarm@...ts.cs.columbia.edu>,
"Gao, Chao" <chao.gao@...el.com>,
"atishp@...shpatra.org" <atishp@...shpatra.org>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>
Subject: Re: [PATCH 33/44] KVM: x86: Do VMX/SVM support checks directly in
vendor code
On Tue, Nov 15, 2022, Huang, Kai wrote:
> On Wed, 2022-11-02 at 23:19 +0000, Sean Christopherson wrote:
> > +static bool __init kvm_is_vmx_supported(void)
> > +{
> > + if (!cpu_has_vmx()) {
> > + pr_err("CPU doesn't support VMX\n");
> > + return false;
> > + }
> > +
> > + if (!boot_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) ||
> > + !boot_cpu_has(X86_FEATURE_VMX)) {
> > + pr_err("VMX not enabled in MSR_IA32_FEAT_CTL\n");
> > + return false;
> > + }
> > +
> > + return true;
> > +}
> > +
> > static int __init vmx_check_processor_compat(void)
> > {
> > struct vmcs_config vmcs_conf;
> > struct vmx_capability vmx_cap;
> >
> > - if (!this_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) ||
> > - !this_cpu_has(X86_FEATURE_VMX)) {
> > - pr_err("VMX is disabled on CPU %d\n", smp_processor_id());
> > + if (!kvm_is_vmx_supported())
> > return -EIO;
> > - }
> >
>
> Looks there's a functional change here -- the old code checks local cpu's
> feature bits but the new code always checks bsp's feature bits. Should have no
> problem I think, though.
Ouch. The bad check will defeat the purpose of doing compat checks. Nice catch!
Powered by blists - more mailing lists