Re: [PATCH 11/30] KVM: VMX: Refactor VMX module init/exit functions

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

 



> +static void __exit vt_exit(void)
> +{
> +	kvm_exit();
> +	vmx_exit();
> +}
> +module_exit(vt_exit);
> +
> +static int __init vt_init(void)
> +{
> +	int r;
> +
> +	r = vmx_init();
> +	if (r)
> +		return r;
> +
> +	/*
> +	 * Common KVM initialization _must_ come last, after this, /dev/kvm is
> +	 * exposed to userspace!
> +	 */
> +	r = kvm_init(sizeof(struct vcpu_vmx), __alignof__(struct vcpu_vmx),
> +		     THIS_MODULE);
> +	if (r)
> +		goto err_kvm_init;
> +
> +	return 0;
> +
> +err_kvm_init:
> +	vmx_exit();
> +	return r;
> +}
> +module_init(vt_init);
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 6c56d5235f0f..8d3cfef0cf3b 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -8588,7 +8588,7 @@ __init int vmx_hardware_setup(void)
>  	return r;
>  }
>  
> -static void vmx_cleanup_l1d_flush(void)
> +static void __exit vmx_cleanup_l1d_flush(void)
>  {
>  	if (vmx_l1d_flush_pages) {
>  		free_pages((unsigned long)vmx_l1d_flush_pages, L1D_CACHE_ORDER);
> @@ -8598,23 +8598,16 @@ static void vmx_cleanup_l1d_flush(void)
>  	l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
>  }
>  
> -static void __vmx_exit(void)
> +void __exit vmx_exit(void)
>  {
>  	allow_smaller_maxphyaddr = false;
>  
>  	vmx_cleanup_l1d_flush();
> -}
>  
> -static void __exit vmx_exit(void)
> -{
> -	kvm_exit();
> -	__vmx_exit();
>  	kvm_x86_vendor_exit();
> -
>  }
> -module_exit(vmx_exit);
>  

Hi Paolo,

I think you will still meet the "section mismatch in reference: vt_init ..."
warning reported by LKP, for which I posted a diff to address:

https://lore.kernel.org/kvm/BL1PR11MB59780AA56D67068C906A40BAF7E02@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/#m825784c4d3f5e2651455295d8f1bd9a4ac8ecdd8




[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