All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-4.11] x86/VT-x: Fix printing of EFER in vmcs_dump_vcpu()
@ 2018-05-31 16:03 Andrew Cooper
  2018-06-01  4:05 ` Juergen Gross
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Cooper @ 2018-05-31 16:03 UTC (permalink / raw)
  To: Xen-devel
  Cc: Juergen Gross, Andrew Cooper, Kevin Tian, Jun Nakajima, Jan Beulich

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.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Jun Nakajima <jun.nakajima@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>
CC: Juergen Gross <jgross@suse.com>

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

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 70c2fb7..b783ff0 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -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)));
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH for-4.11] x86/VT-x: Fix printing of EFER in vmcs_dump_vcpu()
  2018-05-31 16:03 [PATCH for-4.11] x86/VT-x: Fix printing of EFER in vmcs_dump_vcpu() Andrew Cooper
@ 2018-06-01  4:05 ` Juergen Gross
  2018-06-01  7:55 ` Jan Beulich
  2018-06-05  3:02 ` Tian, Kevin
  2 siblings, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2018-06-01  4:05 UTC (permalink / raw)
  To: Andrew Cooper, Xen-devel; +Cc: Kevin Tian, Jun Nakajima, Jan Beulich

On 31/05/18 18:03, Andrew Cooper 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.
> 
> Instead of modifying efer, change the PDPTE conditional to use
> VM_ENTRY_IA32E_MODE.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for-4.11] x86/VT-x: Fix printing of EFER in vmcs_dump_vcpu()
  2018-05-31 16:03 [PATCH for-4.11] x86/VT-x: Fix printing of EFER in vmcs_dump_vcpu() Andrew Cooper
  2018-06-01  4:05 ` Juergen Gross
@ 2018-06-01  7:55 ` Jan Beulich
  2018-06-05  3:02 ` Tian, Kevin
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2018-06-01  7:55 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Juergen Gross, Kevin Tian, Jun Nakajima, Xen-devel

>>> On 31.05.18 at 18:03, <andrew.cooper3@citrix.com> 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.

> Instead of modifying efer, change the PDPTE conditional to use
> VM_ENTRY_IA32E_MODE.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for-4.11] x86/VT-x: Fix printing of EFER in vmcs_dump_vcpu()
  2018-05-31 16:03 [PATCH for-4.11] x86/VT-x: Fix printing of EFER in vmcs_dump_vcpu() Andrew Cooper
  2018-06-01  4:05 ` Juergen Gross
  2018-06-01  7:55 ` Jan Beulich
@ 2018-06-05  3:02 ` Tian, Kevin
  2 siblings, 0 replies; 4+ messages in thread
From: Tian, Kevin @ 2018-06-05  3:02 UTC (permalink / raw)
  To: Andrew Cooper, Xen-devel; +Cc: Juergen Gross, Nakajima, Jun, Jan Beulich

> From: Andrew Cooper [mailto:andrew.cooper3@citrix.com]
> 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.
> 
> Instead of modifying efer, change the PDPTE conditional to use
> VM_ENTRY_IA32E_MODE.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Kevin Tian <kevin.tian@intel.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-05  3:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-31 16:03 [PATCH for-4.11] x86/VT-x: Fix printing of EFER in vmcs_dump_vcpu() Andrew Cooper
2018-06-01  4:05 ` Juergen Gross
2018-06-01  7:55 ` Jan Beulich
2018-06-05  3:02 ` Tian, Kevin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.