Re: [RFC PATCH v1 1/5] x86/boot: Shift VMXON from KVM init to CPU startup phase

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

 



> void vmx_vm_destroy(struct kvm *kvm)
>@@ -8499,10 +8396,6 @@ __init int vmx_hardware_setup(void)
> 
> 	vmx_set_cpu_caps();
> 
>-	r = alloc_kvm_area();
>-	if (r && nested)
>-		nested_vmx_hardware_unsetup();
>-

There is a "return r" at the end of this function. with the removal
of "r = alloc_kvm_area()", @r may be uninitialized.

> 	kvm_set_posted_intr_wakeup_handler(pi_wakeup_handler);
> 
> 	/*
>@@ -8554,7 +8447,7 @@ int __init vmx_init(void)
> 
> 	KVM_SANITY_CHECK_VM_STRUCT_SIZE(kvm_vmx);
> 
>-	if (!kvm_is_vmx_supported())
>+	if (!(cr4_read_shadow() & X86_CR4_VMXE))
> 		return -EOPNOTSUPP;
> 
> 	/*
>diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
>index 916441f5e85c..0eec314b79c2 100644
>--- a/arch/x86/power/cpu.c
>+++ b/arch/x86/power/cpu.c
>@@ -206,11 +206,11 @@ static void notrace __restore_processor_state(struct saved_context *ctxt)
> 	/* cr4 was introduced in the Pentium CPU */
> #ifdef CONFIG_X86_32
> 	if (ctxt->cr4)
>-		__write_cr4(ctxt->cr4);
>+		__write_cr4(ctxt->cr4 & ~X86_CR4_VMXE);

any reason to mask off X86_CR4_VMXE here?

I assume before suspend, VMXOFF is executed and CR4.VMXE is cleared. then
ctxt->cr4 here won't have CR4.VMXE set.

> #else
> /* CONFIG X86_64 */
> 	wrmsrq(MSR_EFER, ctxt->efer);
>-	__write_cr4(ctxt->cr4);
>+	__write_cr4(ctxt->cr4 & ~X86_CR4_VMXE);




[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