[LP 1851709] Cannot launch KVM guests if EPT is disabled

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[LP 1851709] Cannot launch KVM guests if EPT is disabled

Thadeu Lima de Souza Cascardo-3
It has been reported as failure to launch 64-bit linux VMs when kvm-intel
ept module parameter is off. It is off by default on old Intel CPUs.

The bionic revert has been tested as works fine. kvm-unit-tests has been
run there as well and no regressions found.



--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU Bionic] Revert "KVM: x86: Manually calculate reserved bits when loading PDPTRS"

Thadeu Lima de Souza Cascardo-3
BugLink: https://bugs.launchpad.net/bugs/1851709

This reverts commit c5d574d63996442c80e886c60278a790230f4d2b.

This commit has caused failure to launch 64-bit linux VMs when kvm-intel
ept module parameter is off. It is off by default on old Intel CPUs.

Signed-off-by: Thadeu Lima de Souza Cascardo <[hidden email]>
---
 arch/x86/kvm/x86.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ddbd7578ae25..d59095ab1f1c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -566,14 +566,8 @@ static int kvm_read_nested_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn,
        data, offset, len, access);
 }
 
-static inline u64 pdptr_rsvd_bits(struct kvm_vcpu *vcpu)
-{
- return rsvd_bits(cpuid_maxphyaddr(vcpu), 63) | rsvd_bits(5, 8) |
-       rsvd_bits(1, 2);
-}
-
 /*
- * Load the pae pdptrs.  Return 1 if they are all valid, 0 otherwise.
+ * Load the pae pdptrs.  Return true is they are all valid.
  */
 int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
 {
@@ -592,7 +586,8 @@ int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
  }
  for (i = 0; i < ARRAY_SIZE(pdpte); ++i) {
  if ((pdpte[i] & PT_PRESENT_MASK) &&
-    (pdpte[i] & pdptr_rsvd_bits(vcpu))) {
+    (pdpte[i] &
+     vcpu->arch.mmu.guest_rsvd_check.rsvd_bits_mask[0][2])) {
  ret = 0;
  goto out;
  }
--
2.20.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU Disco] Revert "KVM: x86: Manually calculate reserved bits when loading PDPTRS"

Thadeu Lima de Souza Cascardo-3
In reply to this post by Thadeu Lima de Souza Cascardo-3
BugLink: https://bugs.launchpad.net/bugs/1851709

This reverts commit 208007519a7385a57b0c0a3c180142a521594876.

This commit has caused failure to launch 64-bit linux VMs when kvm-intel
ept module parameter is off. It is off by default on old Intel CPUs.

Signed-off-by: Thadeu Lima de Souza Cascardo <[hidden email]>
---
 arch/x86/kvm/x86.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f832fa5011cd..fd00cfdfb6c3 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -672,14 +672,8 @@ static int kvm_read_nested_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn,
        data, offset, len, access);
 }
 
-static inline u64 pdptr_rsvd_bits(struct kvm_vcpu *vcpu)
-{
- return rsvd_bits(cpuid_maxphyaddr(vcpu), 63) | rsvd_bits(5, 8) |
-       rsvd_bits(1, 2);
-}
-
 /*
- * Load the pae pdptrs.  Return 1 if they are all valid, 0 otherwise.
+ * Load the pae pdptrs.  Return true is they are all valid.
  */
 int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
 {
@@ -698,7 +692,8 @@ int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
  }
  for (i = 0; i < ARRAY_SIZE(pdpte); ++i) {
  if ((pdpte[i] & PT_PRESENT_MASK) &&
-    (pdpte[i] & pdptr_rsvd_bits(vcpu))) {
+    (pdpte[i] &
+     vcpu->arch.mmu->guest_rsvd_check.rsvd_bits_mask[0][2])) {
  ret = 0;
  goto out;
  }
--
2.20.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [LP 1851709] Cannot launch KVM guests if EPT is disabled

Stefan Bader-2
In reply to this post by Thadeu Lima de Souza Cascardo-3
On 12.11.19 10:16, Thadeu Lima de Souza Cascardo wrote:
> It has been reported as failure to launch 64-bit linux VMs when kvm-intel
> ept module parameter is off. It is off by default on old Intel CPUs.
>
> The bionic revert has been tested as works fine. kvm-unit-tests has been
> run there as well and no regressions found.
>
>
>
Acked-by: Stefan Bader <[hidden email]>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

ACK: [LP 1851709] Cannot launch KVM guests if EPT is disabled

Andrea Righi
In reply to this post by Thadeu Lima de Souza Cascardo-3
On Tue, Nov 12, 2019 at 06:16:26AM -0300, Thadeu Lima de Souza Cascardo wrote:
> It has been reported as failure to launch 64-bit linux VMs when kvm-intel
> ept module parameter is off. It is off by default on old Intel CPUs.
>
> The bionic revert has been tested as works fine. kvm-unit-tests has been
> run there as well and no regressions found.

Looks good to me.

Acked-by: Andrea Righi <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED: [LP 1851709] Cannot launch KVM guests if EPT is disabled

Stefan Bader-2
In reply to this post by Thadeu Lima de Souza Cascardo-3
On 12.11.19 10:16, Thadeu Lima de Souza Cascardo wrote:
> It has been reported as failure to launch 64-bit linux VMs when kvm-intel
> ept module parameter is off. It is off by default on old Intel CPUs.
>
> The bionic revert has been tested as works fine. kvm-unit-tests has been
> run there as well and no regressions found.
>
>
>
Applied to disco+bionic/master-next. Thanks.

-Stefan


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: APPLIED: [LP 1851709] Cannot launch KVM guests if EPT is disabled

Thomas Lamprecht
On 11/12/19 11:32 AM, Stefan Bader wrote:

> On 12.11.19 10:16, Thadeu Lima de Souza Cascardo wrote:
>> It has been reported as failure to launch 64-bit linux VMs when kvm-intel
>> ept module parameter is off. It is off by default on old Intel CPUs.
>>
>> The bionic revert has been tested as works fine. kvm-unit-tests has been
>> run there as well and no regressions found.
>>
>>
>>
> Applied to disco+bionic/master-next. Thanks.
>

Why did you go the revert route and not the "backport the missing
pieces"[0] one? For Disco cherry-picking upstream commit
bf03d4f9334728bf7c8ffc7de787df48abd6340e is enough (tested here).  For
disco the backport for 4.14[0] should be a working (did not tested yet).
The patch which made problem show up was not a issue itself, and a valid
fix, older kernel just missed some supporting fix, i.e., [0]. So, FWIWW,
IMO it would be better to backport that instead of reverting.

cheers,
Thomas

[0]: https://lore.kernel.org/stable/20191111233718.28438-1-sean.j.christopherson@.../T/


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: APPLIED: [LP 1851709] Cannot launch KVM guests if EPT is disabled

Thomas Lamprecht
On 11/12/19 2:00 PM, Thomas Lamprecht wrote:
> For disco the backport for 4.14[0] should be a working (did not tested yet).

Sorry, s/disco/bionic/

> [0]: https://lore.kernel.org/stable/20191111233718.28438-1-sean.j.christopherson@.../T/



--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: APPLIED: [LP 1851709] Cannot launch KVM guests if EPT is disabled

Thadeu Lima de Souza Cascardo-3
In reply to this post by Thomas Lamprecht
On Tue, Nov 12, 2019 at 02:00:45PM +0100, Thomas Lamprecht wrote:

> On 11/12/19 11:32 AM, Stefan Bader wrote:
> > On 12.11.19 10:16, Thadeu Lima de Souza Cascardo wrote:
> >> It has been reported as failure to launch 64-bit linux VMs when kvm-intel
> >> ept module parameter is off. It is off by default on old Intel CPUs.
> >>
> >> The bionic revert has been tested as works fine. kvm-unit-tests has been
> >> run there as well and no regressions found.
> >>
> >>
> >>
> > Applied to disco+bionic/master-next. Thanks.
> >
>
> Why did you go the revert route and not the "backport the missing
> pieces"[0] one? For Disco cherry-picking upstream commit
> bf03d4f9334728bf7c8ffc7de787df48abd6340e is enough (tested here).  For
> disco the backport for 4.14[0] should be a working (did not tested yet).
> The patch which made problem show up was not a issue itself, and a valid
> fix, older kernel just missed some supporting fix, i.e., [0]. So, FWIWW,
> IMO it would be better to backport that instead of reverting.
>
> cheers,
> Thomas
>
> [0]: https://lore.kernel.org/stable/20191111233718.28438-1-sean.j.christopherson@.../T/

Reverting was considered the safest option at the time we decided to fix
this regression in time for releases today.

In fact, the backport had not been sent by Sean yet at the time, and,
though we have already noticed the message where it was explained what
needed to be backported, we still considered it safer to revert.

The revert of the revert followed by the fix backport will probably follow
in a future release.

Hope that explains the situation.
Cascardo.

>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: APPLIED: [LP 1851709] Cannot launch KVM guests if EPT is disabled

Thomas Lamprecht
On 11/12/19 7:37 PM, Thadeu Lima de Souza Cascardo wrote:

> On Tue, Nov 12, 2019 at 02:00:45PM +0100, Thomas Lamprecht wrote:
>> On 11/12/19 11:32 AM, Stefan Bader wrote:
>>> On 12.11.19 10:16, Thadeu Lima de Souza Cascardo wrote:
>>>> It has been reported as failure to launch 64-bit linux VMs when kvm-intel
>>>> ept module parameter is off. It is off by default on old Intel CPUs.
>>>>
>>>> The bionic revert has been tested as works fine. kvm-unit-tests has been
>>>> run there as well and no regressions found.
>>>>
>>>>
>>>>
>>> Applied to disco+bionic/master-next. Thanks.
>>>
>>
>> Why did you go the revert route and not the "backport the missing
>> pieces"[0] one? For Disco cherry-picking upstream commit
>> bf03d4f9334728bf7c8ffc7de787df48abd6340e is enough (tested here).  For
>> disco the backport for 4.14[0] should be a working (did not tested yet).
>> The patch which made problem show up was not a issue itself, and a valid
>> fix, older kernel just missed some supporting fix, i.e., [0]. So, FWIWW,
>> IMO it would be better to backport that instead of reverting.
>>
>> cheers,
>> Thomas
>>
>> [0]: https://lore.kernel.org/stable/20191111233718.28438-1-sean.j.christopherson@.../T/
>
> Reverting was considered the safest option at the time we decided to fix
> this regression in time for releases today.
>
> In fact, the backport had not been sent by Sean yet at the time, and,
> though we have already noticed the message where it was explained what
> needed to be backported, we still considered it safer to revert.
>
> The revert of the revert followed by the fix backport will probably follow
> in a future release.
>
> Hope that explains the situation.

Yes it does, and sorry I was not aware of that timing difference then :)
FWIW, It's the same route we went with anyway (first revert, then backport).

cheers,
Thomas


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team