lkml.org 
[lkml]   [2024]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v18 007/121] KVM: VMX: Reorder vmx initialization with kvm vendor initialization
    On Thu, Feb 01, 2024 at 05:34:44PM +0800,
    Xiaoyao Li <xiaoyao.li@intel.com> wrote:

    > > diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c
    > > index 18cecf12c7c8..443db8ec5cd5 100644
    > > --- a/arch/x86/kvm/vmx/main.c
    > > +++ b/arch/x86/kvm/vmx/main.c
    > > @@ -171,7 +171,7 @@ struct kvm_x86_init_ops vt_init_ops __initdata = {
    > > static int __init vt_init(void)
    > > {
    > > unsigned int vcpu_size, vcpu_align;
    > > - int cpu, r;
    > > + int r;
    > > if (!kvm_is_vmx_supported())
    > > return -EOPNOTSUPP;
    > > @@ -182,18 +182,14 @@ static int __init vt_init(void)
    > > */
    > > hv_init_evmcs();
    > > - /* vmx_hardware_disable() accesses loaded_vmcss_on_cpu. */
    > > - for_each_possible_cpu(cpu)
    > > - INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu));
    > > -
    > > - r = kvm_x86_vendor_init(&vt_init_ops);
    > > - if (r)
    > > - return r;
    > > -
    > > r = vmx_init();
    > > if (r)
    > > goto err_vmx_init;
    > > + r = kvm_x86_vendor_init(&vt_init_ops);
    > > + if (r)
    > > + goto err_vendor_init;
    > > +
    >
    > we cannot simply change the calling order of vmx_init() and
    > kvm_x86_vendor_init(). There is dependency between them.
    >
    > e.g.,
    >
    > kvm_x86_vendor_init()
    > -> ops->hardware_setup()
    > -> vmx_hardware_setup()
    >
    > will update 'enable_ept' based on hardware capability (e.g., if the hardware
    > support EPT or not), while 'enable_ept' is used in vmx_init().

    I gave up this clean up to drop this patch with v19.
    --
    Isaku Yamahata <isaku.yamahata@linux.intel.com>

    \
     
     \ /
      Last update: 2024-05-27 15:22    [W:2.715 / U:0.040 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site