[kvm-unit-tests PATCH] x86: vmx_tests: pml: Skip PML test if it's not enabled in underlying

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

 



PML in VM depends on "enable PML" in VM-execution control, check this
before vmwrite to PMLADDR, because this field doesn't exist if PML is
disabled in VM-execution control.

Signed-off-by: Robert Hoo <robert.hu@xxxxxxxxxxxxxxx>
---
 x86/vmx_tests.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 4f712eb..8663112 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -1502,13 +1502,16 @@ static int pml_init(struct vmcs *vmcs)
 		return VMX_TEST_EXIT;
 	}
 
+	ctrl_cpu = vmcs_read(CPU_EXEC_CTRL1) & CPU_PML;
+	if (!ctrl_cpu) {
+		printf("\tPML is not enabled\n");
+		return VMX_TEST_EXIT;
+	}
+
 	pml_log = alloc_page();
 	vmcs_write(PMLADDR, (u64)pml_log);
 	vmcs_write(GUEST_PML_INDEX, PML_INDEX - 1);
 
-	ctrl_cpu = vmcs_read(CPU_EXEC_CTRL1) | CPU_PML;
-	vmcs_write(CPU_EXEC_CTRL1, ctrl_cpu);
-
 	return VMX_TEST_START;
 }
 
-- 
1.8.3.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux