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

classic Classic list List threaded Threaded
6 messages Options
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
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
|

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

Tyler Hicks-2
On 2019-11-11 19:24:32, Thadeu Lima de Souza Cascardo wrote:
> 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]>

Acked-by: Tyler Hicks <[hidden email]>

Thanks!

Tyler

> ---
>  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

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

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

Khaled Elmously
In reply to this post by Thadeu Lima de Souza Cascardo-3
Was there a bug link for this regression?


On 2019-11-11 19:24:32 , Thadeu Lima de Souza Cascardo wrote:

> 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

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

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

Po-Hsu Lin (Sam)
I think this one can be used:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1851709

On Tue, Nov 12, 2019 at 12:13 PM Khaled Elmously
<[hidden email]> wrote:

>
> Was there a bug link for this regression?
>
>
> On 2019-11-11 19:24:32 , Thadeu Lima de Souza Cascardo wrote:
> > 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
>
> --
> 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: [SRU Bionic] Revert "KVM: x86: Manually calculate reserved bits when loading PDPTRS"

Thadeu Lima de Souza Cascardo-3
On Tue, Nov 12, 2019 at 12:17:36PM +0800, Po-Hsu Lin wrote:
> I think this one can be used:
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1851709

Sorry, I meant to use the other one, which has been marked as duplicated of this one.

LP: #1851709 is good enough. Notice that this has been tested to fix the issue.

I will send again including the fix for disco.

Cascardo.


>
> On Tue, Nov 12, 2019 at 12:13 PM Khaled Elmously
> <[hidden email]> wrote:
> >
> > Was there a bug link for this regression?
> >
> >
> > On 2019-11-11 19:24:32 , Thadeu Lima de Souza Cascardo wrote:
> > > 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
> >
> > --
> > 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
|

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

Stefan Bader-2
In reply to this post by Thadeu Lima de Souza Cascardo-3
This was re-submitted in a different thread.


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

signature.asc (849 bytes) Download Attachment