From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Bader Subject: Re: regression: nested: L1 3.15+ fails to load kvm-intel on L0 <3.10 Date: Thu, 19 Mar 2015 20:58:15 +0100 Message-ID: <550B2A57.4090406@canonical.com> References: <55093B52.5090904@canonical.com> <550942ED.4040809@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sa5m1hhpHTLVmqQmrwPI2MvwsUmgCoS03" To: Paolo Bonzini , kvm@vger.kernel.org, Linux Kernel Mailing List , Ben Hutchings Return-path: In-Reply-To: <550942ED.4040809@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sa5m1hhpHTLVmqQmrwPI2MvwsUmgCoS03 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 18.03.2015 10:18, Paolo Bonzini wrote: >=20 >=20 > On 18/03/2015 09:46, Stefan Bader wrote: >> >> Regardless of that, I wonder whether the below (this version untested)= sound >> acceptable for upstream? At least it would make debugging much simpler= =2E :) >> >> --- a/arch/x86/kvm/vmx.c >> +++ b/arch/x86/kvm/vmx.c >> @@ -2953,8 +2953,11 @@ static __init int adjust_vmx_controls(u32 ctl_m= in, u32 ct >> ctl |=3D vmx_msr_low; /* bit =3D=3D 1 in low word =3D=3D> mu= st be one */ >> >> /* Ensure minimum (required) set of control bits are supported= =2E */ >> - if (ctl_min & ~ctl) >> + if (ctl_min & ~ctl) { >> + printk(KERN_ERR "vmx: msr(%08x) does not match require= ments. " >> + "req=3D%08x cur=3D%08x\n", msr, ctl_mi= n, ctl); >> return -EIO; >> + } >> >> *result =3D ctl; >> return 0; >=20 > Yes, this is nice. Maybe -ENODEV. >=20 > Also, a minimal patch for Ubuntu would probably be: >=20 > @@ -2850,7 +2851,7 @@ static __init int setup_vmcs_config(struct vmcs_c= onfig *vmcs_conf) > vmx_capability.ept, vmx_capability.vpid); > } > =20 > - min =3D 0; > + min =3D VM_EXIT_SAVE_DEBUG_CONTROLS; > #ifdef CONFIG_X86_64 > min |=3D VM_EXIT_HOST_ADDR_SPACE_SIZE; > #endif >=20 > but I don't think it's a good idea to add it to stable kernels. Sorry, I got a bit confused on my assumptions. While the change above cau= ses guests to fail but the statement to say this is caused by host kernels be= fore this change was against better knowledge and wrong. The actual range was hosts running 3.2 which (maybe not perfect but at le= ast well enough) allowed to use nested vmx for guest kernel <3.15 will break.= But running 3.13 on the host has no issues. Comparing the rdmsr values of guests between those two host kernels, I fo= und that on 3.2 the exit control msr was very sparsely initialized. And looki= ng at the changes between 3.2 and 3.13 I found commit 33fb20c39e98b90813b5ab2d9a0d6faa6300caca Author: Jan Kiszka Date: Wed Mar 6 15:44:03 2013 +0100 KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS This was added in 3.10. So the range of kernels affected <3.10 back to wh= en nested vmx became somewhat usable. For 3.2 Ben (and obviously us) would b= e affected. Apart from that, I believe, it is only 3.4 which has an active longterm. At least that change looks safer for stable as it sounds like correcting things and not adding a feature. I was able to cherry-pick tha= t into a 3.2 kernel and then a 3.16 guest successfully can load the kvm-intel mo= dule again, of course with the same shortcomings as before. -Stefan >=20 > Paolo >=20 --sa5m1hhpHTLVmqQmrwPI2MvwsUmgCoS03 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJVCypfAAoJEOhnXe7L7s6j18gQAN7CMXYaaKsIAX+oudn0h7na FqjcJJMTUVnirmeTmX0435OizGA0wr+SDmgyIsVQq7/sGnNwUipnKBQeVvlCV0xT L1ohNxMQv7CcWRoXAQ9EhbeZEMYCxZLwv8gdEFAoP9Fq3IwVF2pF34dhaaEPsxT+ kMLoZLBuf3wtIlCGmwxfwsHQEWuX5bBbj4ORMD3/Yk/ITyoBp3cMhg2s7lWk2nvl FLTstSNUcWDo5Pl8tytdsTxGiqgcMlCFyJ8X09UWxyyeMHuU0TljzNJyR8qoyNdP TexlKMmlVGRBssDOj2BvW0PAEbAIvpNqKyk8/ZJkfF4k6MZj5crOFhS+8Pw5EFK3 3x8I6L1eloSMD2ef4nxGEp+I5xmTRmh7bobHUv5ge3dZ6/IScKj/DMoLcxpO2aMx WJa0HjKCtgRUgf1YDfmDj0zEktiXo9BnILDx0j+8sGh4DdU5J0eeG+sHjocc83F+ +5ina66DZfb4RQzrqzS+Al/SD4BVJwkCmNT+upBhhcBvsR+Aqse8H8pdLjnrR8VP 47pbkyGQHs++Ib3Mqs5nFelBnkBqCimYC1iFIagEpMhaI8B4psJC+OB/rc8rjUdF aCQfTFOs/uC5HQ4Udr0/5fSY4SX1g3qKM76adlcjl1tiEtwC7FyQaI3q6iwYUqGN cXHSXzQl8TsYTlmC0vEn =hCYp -----END PGP SIGNATURE----- --sa5m1hhpHTLVmqQmrwPI2MvwsUmgCoS03--