KVM: VMX: make vmx_init a late init call to get to init process faster
PATCH 1/1 KVM: VMX: make vmx_init a late init call to get to init process faster
From: Colin Ian King <[email protected]>
Making vmx_init a late initcall improves QEMU kernel boot times to get to the init process. Average of 100 boots, QEMU boot average reduced from 0.776 seconds to 0.622 seconds (~19.8% faster) on Alder Lake i9-12900 and ~0.5% faster for non-QEMU UEFI boots.
[Take patch
https://github.com/clearlinux-pkgs/linux/commit/797db35496031b19ba37b1639ac5fa5db9159a06
and fix spelling of Alder Lake.]
--- arch/x86/kvm/vmx/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx/vmx.c +1 -1
@@ -8783,4 +8783,4 @@ static int __init vmx_init(void)kvm_x86_vendor_exit ();return r; } -module_init (vmx_init); +late_initcall (vmx_init);
Signature · 1 line
2.43.0
[CC: Update Colin’s address.]
Am 23.03.24 um 09:05 schrieb Paul Menzel:
Quoted 26 lines
From: Colin Ian King <[email protected]>
Making
vmx_inita late initcall improves QEMU kernel boot times to get to the init process. Average of 100 boots, QEMU boot average reduced from 0.776 seconds to 0.622 seconds (~19.8% faster) on Alder Lake i9-12900 and ~0.5% faster for non-QEMU UEFI boots.Signed-off-by Colin Ian King <[email protected]>[Take patch
https://github.com/clearlinux-pkgs/linux/commit/797db35496031b19ba37b1639ac5fa5db9159a06
and fix spelling of Alder Lake.]Signed-off-by Paul Menzel <[email protected]>--- arch/x86/kvm/vmx/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/kvm/vmx/vmx.c +1
-1@@ -8783,4 +8783,4 @@ static int __init vmx_init(void)kvm_x86_vendor_exit ();return r; } -module_init (vmx_init); +late_initcall (vmx_init)
Sean Christopherson
maintainerQuoted 6 lines · Paul Menzel
From: Colin Ian King <[email protected]>
Making
vmx_inita late initcall improves QEMU kernel boot times to get to the init process. Average of 100 boots, QEMU boot average reduced from 0.776 seconds to 0.622 seconds (~19.8% faster) on Alder Lake i9-12900 and ~0.5% faster for non-QEMU UEFI boots.
The changelog needs to better explain what "QEMU kernel boot times" means. I assume the test is a QEMU VM running a kernel KVM_INTEL built-in? This should also call out that late_initcall is #defined to module_init() when KVM is built as a module.
Quoted 14 lines
Signed-off-by Colin Ian King <[email protected]>[Take patch
https://github.com/clearlinux-pkgs/linux/commit/797db35496031b19ba37b1639ac5fa5db9159a06
and fix spelling of Alder Lake.]Signed-off-by Paul Menzel <[email protected]>--- arch/x86/kvm/vmx/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/kvm/vmx/vmx.c +0
-0
arch/x86/kvm/vmx/vmx.c static int __init vmx_init(void) · line 8786
Quoted 5 lines
arch/x86/kvm/vmx/vmx.c +1
-1@@ -8783,4 +8783,4 @@ static int __init vmx_init(void)kvm_x86_vendor_exit ();return r; } -module_init (vmx_init); +late_initcall (vmx_init);
_If_ we do this, then we should also give svm_init() and kvm_x86_init() the same treatment. I see no reason for vmx_init() to be special.
I'm not opposed to this, but I also have zero idea if this could have a negative impact userspace. E.g. what happens if some setup's init process expects /dev/kvm to exist? Will this break that?