Skip to contentSkip to conversation

x86/VT-x: Fix printing of EFER in vmcs_dump_vcpu()

PATCH In review Andrew Cooper 4 participants 4 messages May 31, 2018 – Jun 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/VT-x: Fix printing of EFER in vmcs_dump_vcpu()

This is essentially a "take 2" of c/s 82540b66ce "x86/VT-x: Fix determination of EFER.LMA in vmcs_dump_vcpu()" because in hindight, that change was more problematic than useful.

The original reason was to fix the logic for determining when not to print the PDPTE pointers. However, mutating the efer variable (particularly LME and LMA) before printing it interferes with diagnosing vmentry failures.

Instead of modifying efer, change the PDPTE conditional to use VM_ENTRY_IA32E_MODE.

---
CC: Jan Beulich <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
CC: Juergen Gross <[email protected]>

This wants taking for 4.11. It is zero risk for running VMs, but fixes a regression in the diagnostics of crashed VMs.

---
 xen/arch/x86/hvm/vmx/vmcs.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
xen/arch/x86/hvm/vmx/vmcs.c +2 -5
index 70c2fb7..b783ff0 100644
@@ -1788,10 +1788,7 @@ void vmcs_dump_vcpu(struct vcpu *v)
     vmentry_ctl = vmr32(VM_ENTRY_CONTROLS),
     vmexit_ctl = vmr32(VM_EXIT_CONTROLS);
     cr4 = vmr(GUEST_CR4);
-
-    /* EFER.LMA is read as zero, and is loaded from vmentry_ctl on entry. */
-    BUILD_BUG_ON(VM_ENTRY_IA32E_MODE << 1 != EFER_LMA);
-    efer = vmr(GUEST_EFER) | ((vmentry_ctl & VM_ENTRY_IA32E_MODE) << 1);
+    efer = vmr(GUEST_EFER);
 
     printk("*** Guest State ***\n");
     printk("CR0: actual=0x%016lx, shadow=0x%016lx, gh_mask=%016lx\n",
@@ -1801,7 +1798,7 @@ void vmcs_dump_vcpu(struct vcpu *v)
     printk("CR3 = 0x%016lx\n", vmr(GUEST_CR3));
     if ( (v->arch.hvm_vmx.secondary_exec_control &
           SECONDARY_EXEC_ENABLE_EPT) &&
-         (cr4 & X86_CR4_PAE) && !(efer & EFER_LMA) )
+         (cr4 & X86_CR4_PAE) && !(vmentry_ctl & VM_ENTRY_IA32E_MODE) )
     {
         printk("PDPTE0 = 0x%016lx  PDPTE1 = 0x%016lx\n",
                vmr(GUEST_PDPTE(0)), vmr(GUEST_PDPTE(1)));
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 4 lines · Andrew Cooper

This is essentially a "take 2" of c/s 82540b66ce "x86/VT-x: Fix determination of EFER.LMA in vmcs_dump_vcpu()" because in hindight, that change was more problematic than useful.

Quoted 8 lines

The original reason was to fix the logic for determining when not to print the PDPTE pointers. However, mutating the efer variable (particularly LME and LMA) before printing it interferes with diagnosing vmentry failures.

Instead of modifying efer, change the PDPTE conditional to use VM_ENTRY_IA32E_MODE.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Andrew Cooper
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 31.05.18 at 18:03, <[email protected]> wrote:

This is essentially a "take 2" of c/s 82540b66ce "x86/VT-x: Fix determination of EFER.LMA in vmcs_dump_vcpu()" because in hindight, that change was more problematic than useful.

The original reason was to fix the logic for determining when not to print the PDPTE pointers. However, mutating the efer variable (particularly LME and LMA) before printing it interferes with diagnosing vmentry failures.

I was wondering then, but not enough to ask back.

Quoted 4 lines

Instead of modifying efer, change the PDPTE conditional to use VM_ENTRY_IA32E_MODE.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 1/1
#3 lore raw
In reply to Andrew Cooper
Quoted 13 lines

From: Andrew Cooper [mailto:[email protected]]
Sent: Friday, June 1, 2018 12:03 AM

This is essentially a "take 2" of c/s 82540b66ce "x86/VT-x: Fix determination of EFER.LMA in vmcs_dump_vcpu()" because in hindight, that change was more
problematic than useful.

The original reason was to fix the logic for determining when not to print the
PDPTE pointers. However, mutating the efer variable (particularly LME and LMA) before printing it interferes with diagnosing vmentry failures.

Quoted 4 lines

Instead of modifying efer, change the PDPTE conditional to use VM_ENTRY_IA32E_MODE.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel