[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aMEn4czyuqrQ1+oF@intel.com>
Date: Wed, 10 Sep 2025 15:25:21 +0800
From: Chao Gao <chao.gao@...el.com>
To: "Xin Li (Intel)" <xin@...or.com>
CC: <linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>,
<linux-pm@...r.kernel.org>, <seanjc@...gle.com>, <pbonzini@...hat.com>,
<tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
<dave.hansen@...ux.intel.com>, <x86@...nel.org>, <hpa@...or.com>,
<rafael@...nel.org>, <pavel@...nel.org>, <brgerst@...il.com>,
<david.kaplan@....com>, <peterz@...radead.org>, <andrew.cooper3@...rix.com>,
<kprateek.nayak@....com>, <arjan@...ux.intel.com>,
<rick.p.edgecombe@...el.com>, <dan.j.williams@...el.com>
Subject: Re: [RFC PATCH v1 1/5] x86/boot: Shift VMXON from KVM init to CPU
startup phase
> 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);
Powered by blists - more mailing lists