Skip to contentSkip to conversation

nested vmx: Fix the booting of L2 PAE guest

PATCH In review Dongxiao Xu 5 participants 9 messages Jun 24, 2013 – Jun 27, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nested vmx: Fix the booting of L2 PAE guest

When doing virtual VM entry and virtual VM exit, we need to sychronize the PAE PDPTR related VMCS registers. With this fix, we can boot 32bit PAE L2 guest (Win7 & RHEL6.4) on "Xen on Xen" environment.

---
 xen/arch/x86/hvm/vmx/vvmx.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +15 -12
index bb7688f..5dfbc54 100644
@@ -864,6 +864,13 @@ static const u16 vmcs_gstate_field[] = {
     GUEST_SYSENTER_EIP,
 };
 
+static const u16 gpdptr_fields[] = {
+    GUEST_PDPTR0,
+    GUEST_PDPTR1,
+    GUEST_PDPTR2,
+    GUEST_PDPTR3,
+};
+
 /*
  * Context: shadow -> virtual VMCS
  */
@@ -1053,18 +1060,6 @@ static void load_shadow_guest_state(struct vcpu *v)
                      (__get_vvmcs(vvmcs, CR4_READ_SHADOW) & cr_gh_mask);
     __vmwrite(CR4_READ_SHADOW, cr_read_shadow);
 
-    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         (v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
-    {
-        static const u16 gpdptr_fields[] = {
-            GUEST_PDPTR0,
-            GUEST_PDPTR1,
-            GUEST_PDPTR2,
-            GUEST_PDPTR3,
-        };
-        vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdptr_fields), gpdptr_fields);
-    }
-
     /* TODO: CR3 target control */
 }
 
@@ -1159,6 +1154,10 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
     if ( lm_l1 != lm_l2 )
         paging_update_paging_modes(v);
 
+    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
+         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+        vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdptr_fields), gpdptr_fields);
+
     regs->eip = __get_vvmcs(vvmcs, GUEST_RIP);
     regs->esp = __get_vvmcs(vvmcs, GUEST_RSP);
     regs->eflags = __get_vvmcs(vvmcs, GUEST_RFLAGS);
@@ -1294,6 +1293,10 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
     sync_vvmcs_guest_state(v, regs);
     sync_exception_state(v);
 
+    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
+         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+        shadow_to_vvmcs_bulk(v, ARRAY_SIZE(gpdptr_fields), gpdptr_fields);
+
     vmx_vmcs_switch(v->arch.hvm_vmx.vmcs, nvcpu->nv_n1vmcx);
 
     nestedhvm_vcpu_exit_guestmode(v);
Signature · 1 line
1.8.1.5
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Dongxiao Xu

When doing virtual VM entry and virtual VM exit, we need to sychronize the PAE PDPTR related VMCS registers. With this fix, we can boot 32bit PAE L2 guest (Win7 & RHEL6.4) on "Xen on Xen" environment.

Quoted 63 lines
---
 xen/arch/x86/hvm/vmx/vvmx.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +15 -12
index bb7688f..5dfbc54 100644
@@ -864,6 +864,13 @@ static const u16 vmcs_gstate_field[] = {
     GUEST_SYSENTER_EIP,
 };
 
+static const u16 gpdptr_fields[] = {
+    GUEST_PDPTR0,
+    GUEST_PDPTR1,
+    GUEST_PDPTR2,
+    GUEST_PDPTR3,
+};
+
 /*
  * Context: shadow -> virtual VMCS
  */
@@ -1053,18 +1060,6 @@ static void load_shadow_guest_state(struct vcpu *v)
                      (__get_vvmcs(vvmcs, CR4_READ_SHADOW) & cr_gh_mask);
     __vmwrite(CR4_READ_SHADOW, cr_read_shadow);
 
-    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         (v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
-    {
-        static const u16 gpdptr_fields[] = {
-            GUEST_PDPTR0,
-            GUEST_PDPTR1,
-            GUEST_PDPTR2,
-            GUEST_PDPTR3,
-        };
-        vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdptr_fields), gpdptr_fields);
-    }
-
     /* TODO: CR3 target control */
 }
 
@@ -1159,6 +1154,10 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
     if ( lm_l1 != lm_l2 )
         paging_update_paging_modes(v);
 
+    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
+         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+        vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdptr_fields), gpdptr_fields);
+
     regs->eip = __get_vvmcs(vvmcs, GUEST_RIP);
     regs->esp = __get_vvmcs(vvmcs, GUEST_RSP);
     regs->eflags = __get_vvmcs(vvmcs, GUEST_RFLAGS);
@@ -1294,6 +1293,10 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
     sync_vvmcs_guest_state(v, regs);
     sync_exception_state(v);
 
+    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
+         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+        shadow_to_vvmcs_bulk(v, ARRAY_SIZE(gpdptr_fields), gpdptr_fields);
+
     vmx_vmcs_switch(v->arch.hvm_vmx.vmcs, nvcpu->nv_n1vmcx);
 
     nestedhvm_vcpu_exit_guestmode(v);
#2 lore raw

Hi stakeholders,

I saw the patch is not merged yet. Do you have any other comment about this patch? I think it is a critical fix for 4.3 release in nested virtualization side.

Thanks,
Dongxiao

Quoted 89 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Monday, June 24, 2013 2:46 PM
To: Xu, Dongxiao; [email protected]
Subject: Re: [Xen-devel] [PATCH] nested vmx: Fix the booting of L2 PAE guest

Quoted 7 lines · Dongxiao Xu

When doing virtual VM entry and virtual VM exit, we need to sychronize the PAE PDPTR related VMCS registers. With this fix, we can boot 32bit PAE L2 guest (Win7 & RHEL6.4) on "Xen on Xen" environment.

xen/arch/x86/hvm/vmx/vvmx.c static void load_shadow_guest_state(struct vcpu

Quoted 23 lines
---
 xen/arch/x86/hvm/vmx/vvmx.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +7 -0
index bb7688f..5dfbc54 100644
@@ -864,6 +864,13 @@ static const u16 vmcs_gstate_field[] = {
     GUEST_SYSENTER_EIP,
 };
 
+static const u16 gpdptr_fields[] = {
+    GUEST_PDPTR0,
+    GUEST_PDPTR1,
+    GUEST_PDPTR2,
+    GUEST_PDPTR3,
+};
+
 /*
  * Context: shadow -> virtual VMCS
  */
@@ -1053,18 +1060,6 @@ static void load_shadow_guest_state(struct vcpu

*v)

xen/arch/x86/hvm/vmx/vvmx.c static void load_shadow_guest_state(struct vcpu · line 1060

Quoted 1 line
xen/arch/x86/hvm/vmx/vvmx.c +0 -0
                      (__get_vvmcs(vvmcs, CR4_READ_SHADOW) &

cr_gh_mask);

xen/arch/x86/hvm/vmx/vvmx.c static void load_shadow_guest_state(struct vcpu *v)

Quoted 12 lines
xen/arch/x86/hvm/vmx/vvmx.c +0 -10
     __vmwrite(CR4_READ_SHADOW, cr_read_shadow);
 
-    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         (v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
-    {
-        static const u16 gpdptr_fields[] = {
-            GUEST_PDPTR0,
-            GUEST_PDPTR1,
-            GUEST_PDPTR2,
-            GUEST_PDPTR3,
-        };
-        vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdptr_fields),

gpdptr_fields);

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmentry(struct cpu_user_regs

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +0 -2
-    }
-
     /* TODO: CR3 target control */
 }
 
@@ -1159,6 +1154,10 @@ static void virtual_vmentry(struct cpu_user_regs

*regs)

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmentry(struct cpu_user_regs *regs)

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +3 -0
     if ( lm_l1 != lm_l2 )
         paging_update_paging_modes(v);
 
+    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
+         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+        vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdptr_fields),

gpdptr_fields);

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmexit(struct cpu_user_regs

Quoted 5 lines
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
+
     regs->eip = __get_vvmcs(vvmcs, GUEST_RIP);
     regs->esp = __get_vvmcs(vvmcs, GUEST_RSP);
     regs->eflags = __get_vvmcs(vvmcs, GUEST_RFLAGS);
@@ -1294,6 +1293,10 @@ static void virtual_vmexit(struct cpu_user_regs

*regs)

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmexit(struct cpu_user_regs *regs)

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +3 -0
     sync_vvmcs_guest_state(v, regs);
     sync_exception_state(v);
 
+    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
+         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+        shadow_to_vvmcs_bulk(v, ARRAY_SIZE(gpdptr_fields),

gpdptr_fields);

Quoted 4 lines
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
+
     vmx_vmcs_switch(v->arch.hvm_vmx.vmcs, nvcpu->nv_n1vmcx);
 
     nestedhvm_vcpu_exit_guestmode(v);
#3 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Dongxiao

Hi stakeholders,

I saw the patch is not merged yet. Do you have any other comment about this patch? I think it is a critical fix for 4.3 release in nested virtualization side.

Irrespective of Keir's ack I was hoping for an ack from one of the VMX maintainers. Even more so as they are, just like you, working for Intel I think it would be appropriate for you to get in touch with them to fulfill their maintainer task here. In fact you should have Cc-ed them with your initial patch submission.

Independently of that, you should have also Cc-ed George if you want this to go in for 4.3. In the absence of this, I had simply put this on my post-4.3 queue...

Jan

Quoted 95 lines
Quoted 77 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Monday, June 24, 2013 2:46 PM
To: Xu, Dongxiao; [email protected]
Subject: Re: [Xen-devel] [PATCH] nested vmx: Fix the booting of L2 PAE guest

Quoted 7 lines · Dongxiao Xu

When doing virtual VM entry and virtual VM exit, we need to sychronize the PAE PDPTR related VMCS registers. With this fix, we can boot 32bit PAE L2 guest (Win7 & RHEL6.4) on "Xen on Xen" environment.

xen/arch/x86/hvm/vmx/vvmx.c static void load_shadow_guest_state(struct vcpu

Quoted 23 lines
---
 xen/arch/x86/hvm/vmx/vvmx.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +7 -0
index bb7688f..5dfbc54 100644
@@ -864,6 +864,13 @@ static const u16 vmcs_gstate_field[] = {
     GUEST_SYSENTER_EIP,
 };
 
+static const u16 gpdptr_fields[] = {
+    GUEST_PDPTR0,
+    GUEST_PDPTR1,
+    GUEST_PDPTR2,
+    GUEST_PDPTR3,
+};
+
 /*
  * Context: shadow -> virtual VMCS
  */
@@ -1053,18 +1060,6 @@ static void load_shadow_guest_state(struct vcpu

*v)

xen/arch/x86/hvm/vmx/vvmx.c static void load_shadow_guest_state(struct vcpu · line 1060

Quoted 1 line
xen/arch/x86/hvm/vmx/vvmx.c +0 -0
                      (__get_vvmcs(vvmcs, CR4_READ_SHADOW) &

cr_gh_mask);

xen/arch/x86/hvm/vmx/vvmx.c static void load_shadow_guest_state(struct vcpu *v)

Quoted 12 lines
xen/arch/x86/hvm/vmx/vvmx.c +0 -10
     __vmwrite(CR4_READ_SHADOW, cr_read_shadow);
 
-    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         (v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
-    {
-        static const u16 gpdptr_fields[] = {
-            GUEST_PDPTR0,
-            GUEST_PDPTR1,
-            GUEST_PDPTR2,
-            GUEST_PDPTR3,
-        };
-        vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdptr_fields),

gpdptr_fields);

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmentry(struct cpu_user_regs

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +0 -2
-    }
-
     /* TODO: CR3 target control */
 }
 
@@ -1159,6 +1154,10 @@ static void virtual_vmentry(struct cpu_user_regs

*regs)

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmentry(struct cpu_user_regs *regs)

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +3 -0
     if ( lm_l1 != lm_l2 )
         paging_update_paging_modes(v);
 
+    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
+         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+        vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdptr_fields),

gpdptr_fields);

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmexit(struct cpu_user_regs

Quoted 5 lines
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
+
     regs->eip = __get_vvmcs(vvmcs, GUEST_RIP);
     regs->esp = __get_vvmcs(vvmcs, GUEST_RSP);
     regs->eflags = __get_vvmcs(vvmcs, GUEST_RFLAGS);
@@ -1294,6 +1293,10 @@ static void virtual_vmexit(struct cpu_user_regs

*regs)

Quoted 12 lines

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmexit(struct cpu_user_regs *regs)

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +3 -0
     sync_vvmcs_guest_state(v, regs);
     sync_exception_state(v);
 
+    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
+         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+        shadow_to_vvmcs_bulk(v, ARRAY_SIZE(gpdptr_fields),

gpdptr_fields);

Quoted 4 lines
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
+
     vmx_vmcs_switch(v->arch.hvm_vmx.vmcs, nvcpu->nv_n1vmcx);
 
     nestedhvm_vcpu_exit_guestmode(v);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
Quoted 12 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Dongxiao

Hi stakeholders,

I saw the patch is not merged yet. Do you have any other comment about this patch? I think it is a critical fix for 4.3 release in nested virtualization side.

Irrespective of Keir's ack I was hoping for an ack from one of the VMX maintainers. Even more so as they are, just like you, working for Intel I think it would be appropriate for you to get in touch with them to fulfill their maintainer task here. In fact you should have Cc-ed them with your initial patch submission.

Quoted 3 lines

Independently of that, you should have also Cc-ed George if you want this to go in for 4.3. In the absence of this, I had simply put this on my post-4.3 queue...

Well normally I think I would have said "no" to this change. You guys haven't done a very good job of engaging with the release process we've been trying to develop -- you didn't report this bug to me so that I could track it and make informed decisions regarding the release.

However, I still consider nested VMX as "experimental" -- the fact that in the current tree, Win7 won't boot on Xen-on-Xen kind of confirms that status to me. :-) Since it is experimental, like the ARM port, it has a slightly different release criteria: basically, as long as you don't touch code in the non-experimental path, you can take your own risks regarding breaking functionality.

Given that this patch only touches code inside vvmx.c, I'm assuming that this code *cannot* be touched by anyone who is *not* running in nested virt mode.

If that's correct, I'm inclined to say we can accept it. But I'd be interested in hearing other people's opinions.

-George

#5 lore raw
Quoted 14 lines
Quoted 1 line
Quoted 1 line · George Dunlap
Quoted 12 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Dongxiao

Hi stakeholders,

I saw the patch is not merged yet. Do you have any other comment about this patch? I think it is a critical fix for 4.3 release in nested virtualization side.

Irrespective of Keir's ack I was hoping for an ack from one of the VMX maintainers. Even more so as they are, just like you, working for Intel I think it would be appropriate for you to get in touch with them to fulfill their maintainer task here. In fact you should have Cc-ed them with your initial patch submission.

Quoted 8 lines
Quoted 3 lines

Independently of that, you should have also Cc-ed George if you want this to go in for 4.3. In the absence of this, I had simply put this on my post-4.3 queue...

Well normally I think I would have said "no" to this change. You guys haven't done a very good job of engaging with the release process we've been trying to develop -- you didn't report this bug to me so that I could track it and make informed decisions regarding the release.

So you probably meant this to be sent To: [email protected], and
Cc: <me>?

Quoted 7 lines

However, I still consider nested VMX as "experimental" -- the fact that in the current tree, Win7 won't boot on Xen-on-Xen kind of confirms that status to me. :-) Since it is experimental, like the ARM port, it has a slightly different release criteria: basically, as long as you don't touch code in the non-experimental path, you can take your own risks regarding breaking functionality.

Quoted 6 lines

Given that this patch only touches code inside vvmx.c, I'm assuming that this code *cannot* be touched by anyone who is *not* running in nested virt mode.

If that's correct, I'm inclined to say we can accept it. But I'd be interested in hearing other people's opinions.

I agree with that. And I may apply the patch perhaps tomorrow even if we don't hear anything from the VMX maintainers.

Jan

#6 lore raw
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · George Dunlap
Quoted 15 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Dongxiao

Hi stakeholders,

I saw the patch is not merged yet. Do you have any other comment about this patch? I think it is a critical fix for 4.3 release in nested virtualization side.

Irrespective of Keir's ack I was hoping for an ack from one of the VMX maintainers. Even more so as they are, just like you, working for Intel I think it would be appropriate for you to get in touch with them to fulfill their maintainer task here. In fact you should have Cc-ed them with your initial patch submission.

Independently of that, you should have also Cc-ed George if you want this to go in for 4.3. In the absence of this, I had simply put this on my post-4.3 queue...

Quoted 6 lines
Quoted 4 lines

Well normally I think I would have said "no" to this change. You guys haven't done a very good job of engaging with the release process we've been trying to develop -- you didn't report this bug to me so that I could track it and make informed decisions regarding the release.

So you probably meant this to be sent To: [email protected], and
Cc: <me>?

Yes, sorry -- I meant the "you guys" to be the developers working on nested vmx. You (Jan) have been very engaged with the process, and I appreciate it. :-)

-George

#7 lore raw
In reply to George Dunlap
Quoted 30 lines
Quoted 1 line
Quoted 1 line · George Dunlap
Quoted 12 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Dongxiao

Hi stakeholders,

I saw the patch is not merged yet. Do you have any other comment about this patch? I think it is a critical fix for 4.3 release in nested virtualization side.

Irrespective of Keir's ack I was hoping for an ack from one of the VMX maintainers. Even more so as they are, just like you, working for Intel I think it would be appropriate for you to get in touch with them to fulfill their maintainer task here. In fact you should have Cc-ed them with your initial patch submission.

Quoted 3 lines

Independently of that, you should have also Cc-ed George if you want this to go in for 4.3. In the absence of this, I had simply put this on my post-4.3 queue...

Well normally I think I would have said "no" to this change. You guys haven't done a very good job of engaging with the release process we've been trying to develop -- you didn't report this bug to me so that I could track it and make informed decisions regarding the release.

However, I still consider nested VMX as "experimental" -- the fact that in the current tree, Win7 won't boot on Xen-on-Xen kind of confirms that status to me. :-) Since it is experimental, like the ARM port, it has a slightly different release criteria: basically, as long as you don't touch code in the non-experimental path, you can take your own risks regarding breaking functionality.

Quoted 6 lines

Given that this patch only touches code inside vvmx.c, I'm assuming that this code *cannot* be touched by anyone who is *not* running in nested virt mode.

If that's correct, I'm inclined to say we can accept it. But I'd be interested in hearing other people's opinions.

Committed now that we have Eddie's ack.

Jan

#8 lore raw
In reply to Jan Beulich

My mailbox has problem :(
Anyway, acked.

Eddie

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, June 27, 2013 4:40 PM
To: Xu, Dongxiao
Cc: George Dunlap; Keir Fraser; Dong, Eddie; Nakajima, Jun; [email protected]
Subject: Re: [Xen-devel] [PATCH] nested vmx: Fix the booting of L2 PAE guest

Quoted 6 lines
Quoted 1 line
Quoted 1 line · Dongxiao

Hi stakeholders,

I saw the patch is not merged yet. Do you have any other comment about this patch? I think it is a critical fix for 4.3 release in nested virtualization side.

Irrespective of Keir's ack I was hoping for an ack from one of the VMX maintainers. Even more so as they are, just like you, working for Intel I think it would be appropriate for you to get in touch with them to fulfill their maintainer task here. In fact you should have Cc-ed them with your initial patch submission.

Independently of that, you should have also Cc-ed George if you want this to go in for 4.3. In the absence of this, I had simply put this on my post-4.3 queue...

Jan

Quoted 95 lines
Quoted 77 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Monday, June 24, 2013 2:46 PM
To: Xu, Dongxiao; [email protected]
Subject: Re: [Xen-devel] [PATCH] nested vmx: Fix the booting of L2 PAE guest

Quoted 7 lines · Dongxiao Xu

When doing virtual VM entry and virtual VM exit, we need to sychronize the PAE PDPTR related VMCS registers. With this fix, we can boot 32bit PAE L2 guest (Win7 & RHEL6.4) on "Xen on Xen" environment.

xen/arch/x86/hvm/vmx/vvmx.c static void load_shadow_guest_state(struct vcpu

Quoted 23 lines
---
 xen/arch/x86/hvm/vmx/vvmx.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +7 -0
index bb7688f..5dfbc54 100644
@@ -864,6 +864,13 @@ static const u16 vmcs_gstate_field[] = {
     GUEST_SYSENTER_EIP,
 };
 
+static const u16 gpdptr_fields[] = {
+    GUEST_PDPTR0,
+    GUEST_PDPTR1,
+    GUEST_PDPTR2,
+    GUEST_PDPTR3,
+};
+
 /*
  * Context: shadow -> virtual VMCS
  */
@@ -1053,18 +1060,6 @@ static void load_shadow_guest_state(struct vcpu

*v)

xen/arch/x86/hvm/vmx/vvmx.c static void load_shadow_guest_state(struct vcpu · line 1060

Quoted 1 line
xen/arch/x86/hvm/vmx/vvmx.c +0 -0
                      (__get_vvmcs(vvmcs, CR4_READ_SHADOW) &

cr_gh_mask);

xen/arch/x86/hvm/vmx/vvmx.c static void load_shadow_guest_state(struct vcpu *v)

Quoted 12 lines
xen/arch/x86/hvm/vmx/vvmx.c +0 -10
     __vmwrite(CR4_READ_SHADOW, cr_read_shadow);
 
-    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         (v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
-    {
-        static const u16 gpdptr_fields[] = {
-            GUEST_PDPTR0,
-            GUEST_PDPTR1,
-            GUEST_PDPTR2,
-            GUEST_PDPTR3,
-        };
-        vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdptr_fields),

gpdptr_fields);

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmentry(struct cpu_user_regs

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +0 -2
-    }
-
     /* TODO: CR3 target control */
 }
 
@@ -1159,6 +1154,10 @@ static void virtual_vmentry(struct cpu_user_regs

*regs)

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmentry(struct cpu_user_regs *regs)

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +3 -0
     if ( lm_l1 != lm_l2 )
         paging_update_paging_modes(v);
 
+    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
+         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+        vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdptr_fields),

gpdptr_fields);

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmexit(struct cpu_user_regs

Quoted 5 lines
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
+
     regs->eip = __get_vvmcs(vvmcs, GUEST_RIP);
     regs->esp = __get_vvmcs(vvmcs, GUEST_RSP);
     regs->eflags = __get_vvmcs(vvmcs, GUEST_RFLAGS);
@@ -1294,6 +1293,10 @@ static void virtual_vmexit(struct cpu_user_regs

*regs)

Quoted 12 lines

xen/arch/x86/hvm/vmx/vvmx.c static void virtual_vmexit(struct cpu_user_regs *regs)

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +3 -0
     sync_vvmcs_guest_state(v, regs);
     sync_exception_state(v);
 
+    if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
+         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+        shadow_to_vvmcs_bulk(v, ARRAY_SIZE(gpdptr_fields),

gpdptr_fields);

Quoted 4 lines
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
+
     vmx_vmcs_switch(v->arch.hvm_vmx.vmcs, nvcpu->nv_n1vmcx);
 
     nestedhvm_vcpu_exit_guestmode(v);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel