[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3/5] VMX: dump further control state



On 20/01/15 11:06, Jan Beulich wrote:
A few relevant control state fields did not get dumped so far; in
particular, VM_ENTRY_INSTRUCTION_LEN got printed twice (instead of also
printing VM_EXIT_INSTRUCTION_LEN). Where suitable (to reduce the amount
of output) make some of the dumping conditional upon guest settings
(this isn't required for correctness as vmr() already uses
__vmread_safe(), i.e. it is fine to access non-existing fields).

Also drop casts.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>


--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1520,31 +1520,35 @@ void vmcs_dump_vcpu(struct vcpu *v)
 
     printk("*** Control State ***\n");
     printk("PinBased=%08x CPUBased=%08x SecondaryExec=%08x\n",
-           (uint32_t)vmr(PIN_BASED_VM_EXEC_CONTROL),
-           (uint32_t)vmr(CPU_BASED_VM_EXEC_CONTROL),
-           (uint32_t)vmr(SECONDARY_VM_EXEC_CONTROL));
+           vmr32(PIN_BASED_VM_EXEC_CONTROL),
+           vmr32(CPU_BASED_VM_EXEC_CONTROL),
+           vmr32(SECONDARY_VM_EXEC_CONTROL));
     printk("EntryControls=%08x ExitControls=%08x\n", vmentry_ctl, vmexit_ctl);
-    printk("ExceptionBitmap=%08x\n",
-           (uint32_t)vmr(EXCEPTION_BITMAP));
+    printk("ExceptionBitmap=%08x PFECmask=%08x PFECmatch=%08x\n",
+           vmr32(EXCEPTION_BITMAP),
+           vmr32(PAGE_FAULT_ERROR_CODE_MASK),
+           vmr32(PAGE_FAULT_ERROR_CODE_MATCH));
     printk("VMEntry: intr_info=%08x errcode=%08x ilen=%08x\n",
-           (uint32_t)vmr(VM_ENTRY_INTR_INFO),
-           (uint32_t)vmr(VM_ENTRY_EXCEPTION_ERROR_CODE),
-           (uint32_t)vmr(VM_ENTRY_INSTRUCTION_LEN));
+           vmr32(VM_ENTRY_INTR_INFO),
+           vmr32(VM_ENTRY_EXCEPTION_ERROR_CODE),
+           vmr32(VM_ENTRY_INSTRUCTION_LEN));
     printk("VMExit: intr_info=%08x errcode=%08x ilen=%08x\n",
-           (uint32_t)vmr(VM_EXIT_INTR_INFO),
-           (uint32_t)vmr(VM_EXIT_INTR_ERROR_CODE),
-           (uint32_t)vmr(VM_ENTRY_INSTRUCTION_LEN));
-    printk("        reason=%08x qualification=%08x\n",
-           (uint32_t)vmr(VM_EXIT_REASON),
-           (uint32_t)vmr(EXIT_QUALIFICATION));
+           vmr32(VM_EXIT_INTR_INFO),
+           vmr32(VM_EXIT_INTR_ERROR_CODE),
+           vmr32(VM_EXIT_INSTRUCTION_LEN));
+    printk("        reason=%08x qualification=%016lx\n",
+           vmr32(VM_EXIT_REASON), vmr(EXIT_QUALIFICATION));
     printk("IDTVectoring: info=%08x errcode=%08x\n",
-           (uint32_t)vmr(IDT_VECTORING_INFO),
-           (uint32_t)vmr(IDT_VECTORING_ERROR_CODE));
-    printk("TPR Threshold = 0x%02x\n",
-           (uint32_t)vmr(TPR_THRESHOLD));
+           vmr32(IDT_VECTORING_INFO), vmr32(IDT_VECTORING_ERROR_CODE));
     printk("TSC Offset = 0x%016lx\n", vmr(TSC_OFFSET));
-    printk("EPT pointer = 0x%08x%08x\n",
-           (uint32_t)vmr(EPT_POINTER_HIGH), (uint32_t)vmr(EPT_POINTER));
+    if ( (v->arch.hvm_vmx.exec_control & CPU_BASED_TPR_SHADOW) ||
+         (vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT) )
+        printk("TPR Threshold = 0x%02x  PostedIntrVec = 0x%02x\n",
+               vmr32(TPR_THRESHOLD), vmr16(POSTED_INTR_NOTIFICATION_VECTOR));
+    if ( (v->arch.hvm_vmx.secondary_exec_control &
+          SECONDARY_EXEC_ENABLE_EPT) )
+        printk("EPT pointer = 0x%016lx  EPTP index = 0x%04x\n",
+               vmr(EPT_POINTER), vmr16(EPTP_INDEX));
     n = vmr32(CR3_TARGET_COUNT);
     for ( i = 0; i + 1 < n; i += 2 )
         printk("CR3 target%u=%016lx target%u=%016lx\n",
@@ -1552,8 +1556,14 @@ void vmcs_dump_vcpu(struct vcpu *v)
                i + 1, vmr(CR3_TARGET_VALUE(i + 1)));
     if ( i < n )
         printk("CR3 target%u=%016lx\n", i, vmr(CR3_TARGET_VALUE(i)));
-    printk("Virtual processor ID = 0x%04x\n",
-           (uint32_t)vmr(VIRTUAL_PROCESSOR_ID));
+    if ( v->arch.hvm_vmx.secondary_exec_control &
+         SECONDARY_EXEC_PAUSE_LOOP_EXITING )
+        printk("PLE Gap=%08x Window=%08x\n",
+               vmr32(PLE_GAP), vmr32(PLE_WINDOW));
+    if ( v->arch.hvm_vmx.secondary_exec_control &
+         (SECONDARY_EXEC_ENABLE_VPID | SECONDARY_EXEC_ENABLE_VMFUNC) )
+        printk("Virtual processor ID = 0x%04x VMfunc controls = %016lx\n",
+               vmr16(VIRTUAL_PROCESSOR_ID), vmr(VMFUNC_CONTROL));
 
     vmx_vmcs_exit(v);
 }
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -213,6 +213,7 @@ extern u32 vmx_vmentry_control;
 #define SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY    0x00000200
 #define SECONDARY_EXEC_PAUSE_LOOP_EXITING       0x00000400
 #define SECONDARY_EXEC_ENABLE_INVPCID           0x00001000
+#define SECONDARY_EXEC_ENABLE_VMFUNC            0x00002000
 #define SECONDARY_EXEC_ENABLE_VMCS_SHADOWING    0x00004000
 extern u32 vmx_secondary_exec_control;
 
@@ -306,6 +307,7 @@ extern u64 vmx_basic_msr;
 enum vmcs_field {
     VIRTUAL_PROCESSOR_ID            = 0x00000000,
     POSTED_INTR_NOTIFICATION_VECTOR = 0x00000002,
+    EPTP_INDEX                      = 0x00000004,
     GUEST_ES_SELECTOR               = 0x00000800,
     GUEST_CS_SELECTOR               = 0x00000802,
     GUEST_SS_SELECTOR               = 0x00000804,
@@ -342,6 +344,7 @@ enum vmcs_field {
     APIC_ACCESS_ADDR_HIGH           = 0x00002015,
     PI_DESC_ADDR                    = 0x00002016,
     PI_DESC_ADDR_HIGH               = 0x00002017,
+    VMFUNC_CONTROL                  = 0x00002018,
     EPT_POINTER                     = 0x0000201a,
     EPT_POINTER_HIGH                = 0x0000201b,
     EOI_EXIT_BITMAP0                = 0x0000201c,




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.